chore(e2e): Address issue with deleting roles/policies (#5646)

On destroy, there was an issue with deleting IAM roles due to the following error: DeleteConflict: Cannot delete entity, must detach all policies first

This commit adds an option to force the policy detachment, preventing the error.
This commit is contained in:
Michael Li authored and GitHub committed 2025-04-15 11:31:12 -04:00
1 parent f7c55678e0
commit 4304ec0c1c
3 files changed
+10 -7

No files matched your search

+3 -2
View File
@@ -32,8 +32,9 @@ data "aws_iam_policy_document" "boundary_profile" {
}
resource "aws_iam_role" "boundary_instance_role" {
name = "boundary_instance_role-${random_string.cluster_id.result}"
assume_role_policy = data.aws_iam_policy_document.boundary_instance_role.json
name = "boundary_instance_role-${random_string.cluster_id.result}"
assume_role_policy = data.aws_iam_policy_document.boundary_instance_role.json
force_detach_policies = true
}
resource "aws_iam_instance_profile" "boundary_profile" {
+4 -3
View File
@@ -36,9 +36,10 @@ data "aws_iam_policy_document" "vault_profile" {
}
resource "aws_iam_role" "vault_instance_role" {
count = var.deploy ? 1 : 0
name = "vault_instance_role-${random_string.cluster_id.result}"
assume_role_policy = data.aws_iam_policy_document.vault_instance_role.json
count = var.deploy ? 1 : 0
name = "vault_instance_role-${random_string.cluster_id.result}"
assume_role_policy = data.aws_iam_policy_document.vault_instance_role.json
force_detach_policies = true
}
resource "aws_iam_instance_profile" "vault_profile" {
+3 -2
View File
@@ -58,8 +58,9 @@ data "aws_iam_policy_document" "combined_policy_document" {
}
resource "aws_iam_role" "boundary_instance_role" {
name = "boundary_instance_role-${random_string.cluster_id.result}"
assume_role_policy = data.aws_iam_policy_document.boundary_instance_role.json
name = "boundary_instance_role-${random_string.cluster_id.result}"
assume_role_policy = data.aws_iam_policy_document.boundary_instance_role.json
force_detach_policies = true
}
resource "aws_iam_instance_profile" "boundary_profile" {