File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed
modules/ecs-instance-profile Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 21
21
- ' --args=--only=terraform_standard_module_structure'
22
22
- ' --args=--only=terraform_workspace_remote'
23
23
- repo : git://github.com/pre-commit/pre-commit-hooks
24
- rev : v3.4.0
24
+ rev : v4.0.1
25
25
hooks :
26
26
- id : check-merge-conflict
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ No modules.
33
33
| [ aws_iam_role_policy_attachment.amazon_ssm_managed_instance_core] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment ) | resource |
34
34
| [ aws_iam_role_policy_attachment.ecs_ec2_cloudwatch_role] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment ) | resource |
35
35
| [ aws_iam_role_policy_attachment.ecs_ec2_role] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment ) | resource |
36
+ | [ aws_partition.current] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition ) | data source |
36
37
37
38
## Inputs
38
39
Original file line number Diff line number Diff line change
1
+ data "aws_partition" "current" {}
2
+
1
3
resource "aws_iam_role" "this" {
2
4
name = " ${ var . name } _ecs_instance_role"
3
5
path = " /ecs/"
@@ -27,17 +29,17 @@ resource "aws_iam_instance_profile" "this" {
27
29
28
30
resource "aws_iam_role_policy_attachment" "ecs_ec2_role" {
29
31
role = aws_iam_role. this . id
30
- policy_arn = " arn:aws :iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"
32
+ policy_arn = " arn:${ data . aws_partition . current . partition } :iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"
31
33
}
32
34
33
35
resource "aws_iam_role_policy_attachment" "amazon_ssm_managed_instance_core" {
34
36
count = var. include_ssm ? 1 : 0
35
37
36
38
role = aws_iam_role. this . id
37
- policy_arn = " arn:aws :iam::aws:policy/AmazonSSMManagedInstanceCore"
39
+ policy_arn = " arn:${ data . aws_partition . current . partition } :iam::aws:policy/AmazonSSMManagedInstanceCore"
38
40
}
39
41
40
42
resource "aws_iam_role_policy_attachment" "ecs_ec2_cloudwatch_role" {
41
43
role = aws_iam_role. this . id
42
- policy_arn = " arn:aws :iam::aws:policy/CloudWatchLogsFullAccess"
44
+ policy_arn = " arn:${ data . aws_partition . current . partition } :iam::aws:policy/CloudWatchLogsFullAccess"
43
45
}
You can’t perform that action at this time.
0 commit comments