Skip to content

Commit d0e53fc

Browse files
ryankingczimergebot
authored andcommitted
add force_detach_policies to aws_iam_role (#100)
add force_detach_policies to aws_iam_roleThis enables the role to be recreated without using name_prefix + create_before_destroy. Also fixes tests for running with go 1.12, will upgrade the travis build later. ### Test Plan * local unit tests ### References * https://www.terraform.io/docs/providers/aws/r/iam_role.html#force_detach_policies
1 parent 982ff3b commit d0e53fc

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ check-docs:
4949
done;
5050

5151
clean:
52-
rm **/*.tfstate*
52+
rm **/*.tfstate*; true
5353

5454
test: fmt
55-
GOCACHE=off AWS_PROFILE=cztack-ci-1 AWS_SDK_LOAD_CONFIG=true gotest -parallel 10 -test.timeout 45m $(TEST)
55+
AWS_PROFILE=cztack-ci-1 AWS_SDK_LOAD_CONFIG=true gotest -count=1 -parallel 10 -test.timeout 45m $(TEST)

aws-iam-role-crossacct/main.tf

+5
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@ resource "aws_iam_role" "role" {
1313
name = "${var.role_name}"
1414
path = "${var.iam_path}"
1515
assume_role_policy = "${data.aws_iam_policy_document.assume-role.json}"
16+
17+
# We have to force detach policies in order to recreate roles.
18+
# The other option would be to use name_prefix and create_before_destroy, but that
19+
# doesn't work if you want a role with a stable, memorable name.
20+
force_detach_policies = true
1621
}

0 commit comments

Comments
 (0)