davidjeddy / terraform-aws-org-ai-opt-out

AWS AI opt-out Organization Policy
Other
1 stars 1 forks source link

Re-running should not fail with PolicyTypeAlreadyEnabledException #2

Open aldenquimby opened 2 months ago

aldenquimby commented 2 months ago

Steps

Expected

Actual

module.org_ai_opt_out.terraform_data.this (local-exec): An error occurred (PolicyTypeAlreadyEnabledException) when calling the EnablePolicyType operation: The specified policy type is already enabled. ╷ │ Error: local-exec provisioner error │ │ with module.org_ai_opt_out.terraform_data.this, │ on .terraform/modules/org_ai_opt_out/enable_policies.tf line 2, in resource "terraform_data" "this": │ 2: provisioner "local-exec" { │ │ Error running command 'aws organizations enable-policy-type --root-id $(aws organizations list-roots | jq -r ".Roots[].Id") --policy-type AISERVICES_OPT_OUT_POLICY': exit status 254. Output: │ An error occurred (PolicyTypeAlreadyEnabledException) when calling the EnablePolicyType operation: The specified policy type is already enabled. │ ╵

aldenquimby commented 2 months ago

@davidjeddy update - it looks like when I upgrade to 0.2.0 this is fixed! Could you add a release on GH so it's clearer that's the latest version?

I removed the AWS_PROFILE and AWS_REGION checks locally to get things working - why did you have to add those env vars?