mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-03-20 22:01:25 -04:00
Fixes #10341 ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSIAMInstanceProfile_' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2016/11/30 14:32:59 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSIAMInstanceProfile_ -timeout 120m === RUN TestAccAWSIAMInstanceProfile_importBasic --- PASS: TestAccAWSIAMInstanceProfile_importBasic (20.22s) === RUN TestAccAWSIAMInstanceProfile_basic --- PASS: TestAccAWSIAMInstanceProfile_basic (18.71s) === RUN TestAccAWSIAMInstanceProfile_namePrefix --- PASS: TestAccAWSIAMInstanceProfile_namePrefix (18.58s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws57.535s ```
1.8 KiB
1.8 KiB
layout, page_title, sidebar_current, description
| layout | page_title | sidebar_current | description |
|---|---|---|---|
| aws | AWS: aws_iam_instance_profile | docs-aws-resource-iam-instance-profile | Provides an IAM instance profile. |
aws_iam_instance_profile
Provides an IAM instance profile.
Example Usage
resource "aws_iam_instance_profile" "test_profile" {
name = "test_profile"
roles = ["${aws_iam_role.role.name}"]
}
resource "aws_iam_role" "role" {
name = "test_role"
path = "/"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}
Argument Reference
The following arguments are supported:
name- (Optional, Forces new resource) The profile's name.name_prefix- (Optional, Forces new resource) Creates a unique name beginning with the specified prefix. Conflicts withname.path- (Optional, default "/") Path in which to create the profile.roles- (Required) A list of role names to include in the profile.
Attribute Reference
-
id- The instance profile's ID. -
arn- The ARN assigned by AWS to the instance profile. -
create_date- The creation timestamp of the instance profile. -
name- The instance profile's name. -
path- The path of the instance profile in IAM. -
roles- The list of roles assigned to the instance profile. -
unique_id- The unique ID assigned by AWS.
Import
Instance Profiles can be imported using the name, e.g.
$ terraform import aws_iam_instance_profile.test_profile app-instance-profile-1