Difference between revisions of "Terraform resource: aws iam instance profile"
Jump to navigation
Jump to search
(10 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | * https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_instance_profile | |
− | |||
− | |||
− | |||
− | |||
− | |||
+ | == Official example == | ||
+ | resource "aws_iam_instance_profile" "test_profile" { | ||
+ | name = "test_profile" | ||
+ | role = [[aws_iam_role]].role.name | ||
+ | } | ||
+ | |||
+ | data "[[aws_iam_policy_document]]" "assume_role" { | ||
+ | statement { | ||
+ | effect = "Allow" | ||
+ | |||
+ | principals { | ||
+ | type = "Service" | ||
+ | identifiers = ["ec2.amazonaws.com"] | ||
+ | } | ||
+ | |||
+ | actions = ["[[sts:AssumeRole]]"] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | resource "aws_iam_role" "role" { | ||
+ | name = "test_role" | ||
+ | path = "/" | ||
+ | assume_role_policy = data.aws_iam_policy_document.assume_role.json | ||
+ | } | ||
+ | == Related == | ||
+ | * [[Terraform EKS: terraform apply]] | ||
+ | * <code>[[aws iam create-instance-profile]]</code> | ||
+ | * <code>[[aws ssm get-instance-profile]]</code> | ||
+ | == See also == | ||
* {{tf aws iam}} | * {{tf aws iam}} | ||
* {{tf aws}} | * {{tf aws}} | ||
+ | |||
+ | [[Category:Terraform]] |
Latest revision as of 16:30, 29 May 2023
Official example[edit]
resource "aws_iam_instance_profile" "test_profile" { name = "test_profile" role = aws_iam_role.role.name } data "aws_iam_policy_document" "assume_role" { statement { effect = "Allow" principals { type = "Service" identifiers = ["ec2.amazonaws.com"] } actions = ["sts:AssumeRole"] } } resource "aws_iam_role" "role" { name = "test_role" path = "/" assume_role_policy = data.aws_iam_policy_document.assume_role.json }
Related[edit]
See also[edit]
- 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: provider, resources, modules, data sources, VPC, IAM, Net, EC2, S3, Route53, ACM, CloudWatch, SES, RDS, ECS,
awscc, autoscaling, EKS
Advertising: