[Idea] aws_iam_role and aws_iam_role is buddy for destroying #453
Labels
question
A question about existing functionality; most questions are re-routed to discuss.hashicorp.com.
service/iam
Issues and PRs that pertain to the iam service.
This issue was originally opened by @jim3ma as hashicorp/terraform#10966. It was migrated here as part of the provider split. The original body of the issue is below.
Hi there,
If we create a aws_iam_role resource name
role
, a aws_iam_role_policy namedrole_policy
for the aws_iam_role, another resource nameR
depends onrole
and other resources nameO
depend onR
, when destroy them, according the dependency, therole_policy
maybe be destroyed first. While destroy theR
, need the iam policy to destoryO
first. Because theR
depends on permission ofrole
( yes, it's therole_policy
), therole_policy
should not be destroyed before destroyrole
.We could just add a
depends_on
therole_policy
for theR
, but when use theR
for using module, we can't do it(currently, we can't usedepends_on
for using module). Terraform detects the dependency for us, sometimes Terraform destroys therole_policy
first.So, we think the
role
androle_policy
should be buddy for destroying, when destroy one of them, we should confirm thatall of them could be destroyed
!Solutions:
add an option:
buddy_destroy
add
depends_on
for using moduleI will provide more information after work.
Terraform Version
Terraform v0.8.0
Affected Resource(s)
The text was updated successfully, but these errors were encountered: