Difference between revisions of "Terraform resource: aws iam user"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
* https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_user | * https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_user | ||
+ | |||
+ | == Example == | ||
+ | <pre> | ||
+ | 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 | ||
+ | } | ||
+ | </pre> | ||
== Related == | == Related == |
Revision as of 10:26, 27 February 2023
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 }
Related
See also
- Terraform IAM resources:
aws_iam_user, aws_iam_group, aws_iam_role, aws_iam_role_policy_attachment
,aws_iam_policy
,aws_iam_role_policy, aws_iam_user_policy, aws_iam_user_policy_attachment
,aws_iam_access_key, aws_iam_group_policy, aws_iam_group_policy_attachment, aws_iam_openid_connect_provider
- Terraform AWS resources: IAM, Net, EC2, ECS, ECR, S3, Route53, ACM, CloudWatch, CloudFront SES, RDS, DLM
Advertising: