Skip to content

Commit

Permalink
Merge pull request #4 from schollii/fix-iam-gen-bug
Browse files Browse the repository at this point in the history
remove obsolete resource
  • Loading branch information
schollii authored Mar 17, 2023
2 parents 349c319 + de338f7 commit b6132cc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
19 changes: 0 additions & 19 deletions bucket.tf
Original file line number Diff line number Diff line change
Expand Up @@ -195,22 +195,3 @@ resource "aws_iam_policy" "multi_stack_backends_module" {
}
POLICY
}

resource "aws_iam_policy" "multi_stack_backends_stack" {
for_each = local.iam_stacks_map

name = "multi-stack-backends.${local.manager_stack_id}.${each.key}"

policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:GetObject", "s3:PutObject"],
"Resource": "${aws_s3_bucket.tfstate_backends.arn}/${each.key}/*"
}
]
}
POLICY
}
4 changes: 3 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ resource "local_file" "this_backend" {
tfstate_lock_dyndb_table_id = aws_dynamodb_table.backend_locks.id
tfstate_backends_bucket_id = aws_s3_bucket.tfstate_backends.id
tfstate_backends_s3_obj_key = "${var.manager_s3_key_prefix}/terraform.tfstate"
tfstate_main_region = data.aws_region.tfstate_backends.name
})
}

Expand All @@ -42,5 +43,6 @@ resource "local_file" "stack_backend" {
tfstate_lock_dyndb_table_id = aws_dynamodb_table.backend_locks.id
tfstate_backends_bucket_id = aws_s3_bucket.tfstate_backends.id
tfstate_backends_s3_obj_key = "${each.value.stack_id}/${each.value.module_id}/terraform.tfstate"
tfstate_main_region = data.aws_region.tfstate_backends.name
})
}
}
2 changes: 0 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ output "access_control_iam_policies_for_tfstates" {
value = {
common = aws_iam_policy.multi_stack_backends_common.name
manager = one(aws_iam_policy.multi_stack_backends_manager[*].name)
stacks = [for p in aws_iam_policy.multi_stack_backends_stack : p.name]
sub_stacks = [for p in aws_iam_policy.multi_stack_backends_module : p.name]

}
}

0 comments on commit b6132cc

Please sign in to comment.