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

From wikieduonline
Jump to navigation Jump to search
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
* <code>[[aws_iam_user]]</code> https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_user
+
<code>[[aws_iam_user]]</code> https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_user
  
== Example ==
+
== Examples ==
  
 +
=== Official example ===
 
  resource "aws_iam_user" "lb" {
 
  resource "aws_iam_user" "lb" {
 
   name = "loadbalancer"
 
   name = "loadbalancer"
 
   path = "/system/"
 
   path = "/system/"
 
   
 
   
   tags = {
+
   [[tags]] = {
 
     tag-key = "tag-value"
 
     tag-key = "tag-value"
 
   }
 
   }
Line 19: Line 20:
 
   name = "test"
 
   name = "test"
 
   user = aws_iam_user.lb.name
 
   user = aws_iam_user.lb.name
 
+
 
   policy = <<EOF
 
   policy = <<EOF
 
  {
 
  {
Line 26: Line 27:
 
     {
 
     {
 
       "Action": [
 
       "Action": [
         "ec2:Describe*"
+
         "[[ec2:Describe]]*"
 
       ],
 
       ],
 
       "Effect": "Allow",
 
       "Effect": "Allow",
Line 35: Line 36:
 
  EOF
 
  EOF
 
  }
 
  }
 +
 +
=== Additional examples ===
 +
resource "aws_iam_user" "mytest" {
 +
  name = "mytest"
 +
}
 +
 +
=== Access key and [[SMTP]] password ===
 +
 +
{{aws iam user aws iam access key aws iam smtp password v4}}
  
 
== Related ==
 
== Related ==
 
* <code>[[aws_iam_role]]</code>
 
* <code>[[aws_iam_role]]</code>
 +
* <code>[[aws_iam_user_policy]]</code>
 +
* [[Terraform EKS module]]: <code>[[aws_auth_users]]</code>
 +
* [[AWS IAM users]]
 +
* <code>[[aws_identitystore_user]]</code>
  
 
== See also ==
 
== See also ==
 +
* {{aws_iam_user}}
 
* {{terraform aws iam resources}}
 
* {{terraform aws iam resources}}
  
 
[[Category:Terraform]]
 
[[Category:Terraform]]

Latest revision as of 16:20, 10 October 2024

aws_iam_user https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_user

Examples[edit]

Official example[edit]

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[edit]

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

Access key and SMTP password[edit]

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[edit]

See also[edit]

Advertising: