Skip to content

Commit

Permalink
Merge pull request #40 from sourcefuse/fix-iam-role-policy
Browse files Browse the repository at this point in the history
Role attachment was creating an exclusive attachment and removing the policy from all other roles it was attached to.
  • Loading branch information
bcrysler authored Nov 27, 2023
2 parents 71b06ab + b635428 commit 225b039
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ module "ecs" {
| Name | Type |
|------|------|
| [aws_cloudwatch_log_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
| [aws_iam_policy_attachment.execution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy_attachment) | resource |
| [aws_iam_role.execution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
| [aws_iam_role_policy_attachment.execution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
| [aws_lb_listener.http](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener) | resource |
| [aws_lb_listener.https](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener) | resource |
| [aws_service_discovery_private_dns_namespace.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/service_discovery_private_dns_namespace) | resource |
Expand Down
2 changes: 1 addition & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Example demonstrating how to use terraform-aws-refarch-ecs.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_acm_domain_name"></a> [acm\_domain\_name](#input\_acm\_domain\_name) | Domain name the ACM Certificate belongs to | `string` | `"*.sfarcpoc.com"` | no |
| <a name="input_acm_domain_name"></a> [acm\_domain\_name](#input\_acm\_domain\_name) | Domain name the ACM Certificate belongs to | `string` | `"*.arc-poc.link"` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `"poc"` | no |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Namespace for the resources. | `string` | `"arc"` | no |
| <a name="input_private_subnet_names"></a> [private\_subnet\_names](#input\_private\_subnet\_names) | List of Private Subnet names in the VPC where the network resources currently exist.<br>If not defined, the default value from `terraform-aws-ref-arch-network` will be used.<br>From that module's example, the value is: [`example-dev-private-us-east-1a`, `example-dev-private-us-east-1b`] | `list(string)` | `[]` | no |
Expand Down
2 changes: 1 addition & 1 deletion example/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ variable "vpc_name" {
variable "acm_domain_name" {
description = "Domain name the ACM Certificate belongs to"
type = string
default = "*.sfarcpoc.com"
default = "*.arc-poc.link"
}
5 changes: 2 additions & 3 deletions iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ resource "aws_iam_role" "execution" {
}))
}

resource "aws_iam_policy_attachment" "execution" {
resource "aws_iam_role_policy_attachment" "execution" {
for_each = toset(var.execution_policy_attachment_arns)

name = "${local.cluster_name}-execution"
policy_arn = each.value
roles = [aws_iam_role.execution.name]
role = aws_iam_role.execution.name
}

0 comments on commit 225b039

Please sign in to comment.