Difference between revisions of "Terraform resource: aws iam user"

From wikieduonline
Jump to navigation Jump to search
Line 42: Line 42:
 
   name = "mytest"
 
   name = "mytest"
 
  }
 
  }
 +
 +
=== Access key and [[SMTP]] password ===
 +
 +
{{aws iam user aws iam access key aws iam smtp password v4}}
  
 
== Related ==
 
== Related ==

Revision as of 11:41, 8 March 2024

Examples

Official example

resource "aws_iam_user" "lb" {
 name = "loadbalancer"
 path = "/system/"

 tags = {
   tag-key = "tag-value"
 }
}

resource "aws_iam_access_key" "lb" {
  user = aws_iam_user.lb.name
}

resource "aws_iam_user_policy" "lb_ro" {
 name = "test"
 user = aws_iam_user.lb.name

 policy = <<EOF
{
 "Version": "2012-10-17",
 "Statement": [
   {
     "Action": [
       "ec2:Describe*"
     ],
     "Effect": "Allow",
     "Resource": "*"
   }
 ]
}
EOF
}


Additional examples

resource "aws_iam_user" "mytest" {
 name = "mytest"
}

Access key and SMTP password

resource "aws_iam_user" "test" {
  name = "test"
  path = "/test/"
}

resource "aws_iam_access_key" "test" {
  user = aws_iam_user.test.name
}

output "aws_iam_smtp_password_v4" {
  value = aws_iam_access_key.test.ses_smtp_password_v4
}

Related

See also

Advertising: