aws_iam_user_group_membership

Provides a resource for adding an IAM User to IAM Groups. This resource can be used multiple times with the same user for non-overlapping groups.

To exclusively manage the users in a group, see the aws_iam_group_membership resource.

Example usage

resource "aws_iam_user_group_membership" "example1" {
  user = "${aws_iam_user.user1.name}"

  groups = [
    "${aws_iam_group.group1.name}",
    "${aws_iam_group.group2.name}",
  ]
}

resource "aws_iam_user_group_membership" "example2" {
  user = "${aws_iam_user.user1.name}"

  groups = [
    "${aws_iam_group.group3.name}",
  ]
}

resource "aws_iam_user" "user1" {
  name = "user1"
}

resource "aws_iam_group" "group1" {
  name = "group1"
}

resource "aws_iam_group" "group2" {
  name = "group2"
}

resource "aws_iam_group" "group3" {
  name = "group3"
}

Argument Reference

The following arguments are supported:

Attributes Reference

  • user - The name of the IAM User
  • groups - The list of IAM Groups

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/r/iam_user_group_membership.html