Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StackSet with auto_deployment gets administration_role_arn during refresh, resulting in update loop #23464

Open
fvant opened this issue Mar 2, 2022 · 11 comments
Labels
bug Addresses a defect in current functionality. service/cloudformation Issues and PRs that pertain to the cloudformation service.

Comments

@fvant
Copy link

fvant commented Mar 2, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

  • Terraform v1.1.2
  • provider aws v3.70.0

Affected Resource(s)

  • aws_cloudformation_stack_set

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "aws_cloudformation_stack_set" "stacksetOU" {

  count = var.OUs == null || !var.migrate ? 0 : 1
  auto_deployment {
    enabled                          = true
    retain_stacks_on_account_removal = false
  }

  name             = var.name
  permission_model = "SERVICE_MANAGED"
  template_body    = var.template_body
  parameters       = var.parameters
  capabilities     = var.capabilities
  tags             = var.tags

  timeouts {
    update = var.update
  }
}

Debug Output

Panic Output

Expected Behavior

There were no changes to the stack itself, so not update needed

Actual Behavior

The stackset is updated successfully, only to planned for update on the next run again.

This is the plan, showing that the administrator_role_arn will be removed (as it is service managed, it should not be there)
The update is successful when i check in the AWS Console Organizations

Terraform will perform the following actions:

  # module.BASELINE.aws_cloudformation_stack_set.stacksetOU[0] will be updated in-place

  ~ resource "aws_cloudformation_stack_set" "stacksetOU" {

      - administration_role_arn = "arn:aws:iam::11111111111:role/aws-service-role/stacksets.cloudformation.amazonaws.com/AWSServiceRoleForCloudFormationStackSetsOrgAdmin" -> null

        id                      = "BASELINE"
        name                    = "BASELINE"

Steps to Reproduce

Important Factoids

When i do add the administrator_role_arn to the configuration, just so it matches the state, i get this expected error

   1: resource "aws_cloudformation_stack_set" "stacksetOU" {

 "auto_deployment": conflicts with administration_role_arn

References

  • #0000
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/cloudformation Issues and PRs that pertain to the cloudformation service. labels Mar 2, 2022
@justinretzolk
Copy link
Member

Hey @fvant 👋 Thank you for taking the time to raise this! So that we have all of the necessary information in order to look into this, can you supply an example Terraform configuration as well? I'm not positive as to whether the engineer who looks at this will need debug logs or not for this one, but that may be something that we end up requesting as well.

@justinretzolk justinretzolk added waiting-response Maintainers are waiting on response from community or contributor. bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Mar 2, 2022
@ReadyElbow
Copy link

ReadyElbow commented Mar 4, 2022

Hi @justinretzolk , this is an issue I am also having with Terraform deployments at the moment. I would like to point out that I think this is part of a much wider problem with Terraform's AWS Provider implementation of AWS CloudFormation Stacksets.

In my instance, when Terraform attempts to deploy a second time because of this issue, it causes a much wider failure because other parameters cannot be configured such as FailureTolerance and MaxConcurrent (which stops timeout issues when deploying) detailed here: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html#stackset-ops-options.

The wider issues related are linked here and the only solution I have had is to avoid using SERVICE_MANAGED roles and make use of provisioners :( so I configure the required StackSet options.

#11380
#18490
#12877

I have noticed that you have commented on these so it would be great to get a much wider update to the issues present!
Thanks

Terraform version: 1.1.5
AWS Provider version: 4.3.0

@github-actions github-actions bot removed the waiting-response Maintainers are waiting on response from community or contributor. label Mar 4, 2022
@ReadyElbow
Copy link

@fvant @justinretzolk
Any updates on this?

@justinretzolk
Copy link
Member

Hey @ReadyElbow 👋 Thank you for checking in on this. Unfortunately, I'm not able to provide an estimate on when this will be looked into due to the potential of shifting priorities. We prioritize work by count of ":+1:" reactions, as well as a few other things. A larger prioritization document is in the works, but in the meantime additional information may be found in our issue lifecycle document.

@rayterrill
Copy link
Contributor

Looks like we're running into this. Not sure if this would work - but potentially a workaround here is to add:

  lifecycle {
    ignore_changes = [
        administration_role_arn
    ]
  }

@KarlCF
Copy link

KarlCF commented Apr 22, 2022

Subscribing because I'm running into the same issue, going to look into @rayterrill tip. Thanks!

@Kimnor
Copy link

Kimnor commented Sep 17, 2022

left a thumbs up. Running into exactly the same issue when trying to deploy a service_managed stackset

@brycelowe
Copy link

Same problem here. Adding the lifecycle rule is a great work around.

@acoppolawb
Copy link

Can confirm my org runs into this same issue - adding a lifecycle rule works as a workaround for now.

wideawakening pushed a commit to sysdiglabs/terraform-aws-secure-for-cloud that referenced this issue Dec 22, 2022
ignore 
- sysdig_secure_cloud_account.alias, since it's autopopulated on backend only, not on terraform state
- aws_cloudformation_stack_set.stackset.administration_role_arn, since [it's not gracefully handled](hashicorp/terraform-provider-aws#23464)
@josjaf
Copy link

josjaf commented Jan 13, 2023

the lifecycle rule works for now

alannix-lw pushed a commit to lacework/terraform-aws-agentless-scanning that referenced this issue Jan 28, 2023
Current issue with the AWS provider causes an update loop: hashicorp/terraform-provider-aws#23464
alannix-lw added a commit to lacework/terraform-aws-agentless-scanning that referenced this issue Jan 31, 2023
Current issue with the AWS provider causes an update loop: hashicorp/terraform-provider-aws#23464
ipcrm pushed a commit to lacework/terraform-aws-org-configuration that referenced this issue Nov 16, 2023
The administration_role_arn parameter is in constant drift. You cannot use
auto_deployment and specify that parameter. There is an open issue for
this here: hashicorp/terraform-provider-aws#23464

Currently the only fix is to ignore these changes via lifecycle rule
ipcrm pushed a commit to lacework/terraform-aws-org-configuration that referenced this issue Nov 16, 2023
The administration_role_arn parameter is in constant drift. You cannot use
auto_deployment and specify that parameter. There is an open issue for
this here: hashicorp/terraform-provider-aws#23464

Currently the only fix is to ignore these changes via lifecycle rule
@rauschbit
Copy link

can also confirm running into this same issue - adding a lifecycle rule works as a workaround for now.
any updates on this eventually?

daboom added a commit to draios/terraform-aws-secure-for-cloud that referenced this issue Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/cloudformation Issues and PRs that pertain to the cloudformation service.
Projects
None yet
Development

No branches or pull requests

10 participants