I am new to terraform creating iam user using terraform
below is the .tf file
resource "aws_iam_user" "lb" {
name = "Ec2_view"
# 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
}
resource "aws_iam_user_login_profile" "u" {
user = "${aws_iam_user.lb.name}"
password_reset_required = true
pgp_key="keybase:terraform_user"
}
output "password" {
value="${aws_iam_user_login_profile.u.encrypted_password"
}
what does pgp_key mean in aws_iam_user_login_profile and steps to create pgp_key and using it in terraform code?
So first I install the AWS CLI. Then we run aws configure. [ ] $ aws configure AWS Access Key ID []: ENTER-YOUR-ACCESS-KEY-HERE AWS Secret Access Key []: ENTER-YOUR-SECRET-KEY-HERE Default region name []: us-west-2 Default output format []
keys takes a map and returns a list containing the keys from that map. The keys are returned in lexicographical order, ensuring that the result will be identical as long as the keys in the map don't change.
cidr_block - (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using ipv4_netmask_length . instance_tenancy - (Optional) A tenancy option for instances launched into the VPC.
Got the answer
keybase pgp gen
keybase:username_of_keybase
terraform output -raw password | base64 --decode | keybase pgp decrypt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With