hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.82k stars 9.17k forks source link

[Bug]: aws_servicecatalog_provisioning_artifact - modifying timeouts doesn't work after initialisation #32061

Open boxrick opened 1 year ago

boxrick commented 1 year ago

Terraform Core Version

1.5.0

AWS Provider Version

5.4.0

Affected Resource(s)

aws_servicecatalog_provisioning_artifact

Expected Behavior

After setting timeouts upon first initialisation, then updating the timeouts later I would expect the timeouts to be updated.

Actual Behavior

However it only appears the initial values are used and then never updated again. I would expect when timeouts are modified it would use the updated value

Relevant Error/Panic Output Snippet

Terraform shows no changes

Terraform Configuration Files

# Product
resource "aws_servicecatalog_product" "this" {
  name        = "iamaproduct"
  owner       = "iamanowner"
  description = "iamadescription"
  type        = "CLOUD_FORMATION_TEMPLATE"

  provisioning_artifact_parameters {
    template_url = "https://gist.githubusercontent.com/boxrick/6ff96c96a611c54f3cdbf4de61e1a174/raw/1dcc426188008b5fbbdf773369863145a9a1ff25/cfn?_sm_au_=iVV6RFrLNpW0VrFRpGsWvKttvN1NG"
    name         = "1.0.0"
    type         = "CLOUD_FORMATION_TEMPLATE"
  }
}

# Artifact
resource "aws_servicecatalog_provisioning_artifact" "this" {
  name         = "1.2.3"
  product_id   = aws_servicecatalog_product.this.id
  type         = "CLOUD_FORMATION_TEMPLATE"
  template_url = "https://gist.githubusercontent.com/boxrick/6ff96c96a611c54f3cdbf4de61e1a174/raw/1dcc426188008b5fbbdf773369863145a9a1ff25/cfn?_sm_au_=iVV6RFrLNpW0VrFRpGsWvKttvN1NG"

  timeouts {
    create = "60s"
    read   = "60s"
    update = "60s"
    delete = "60s"
  }
}

Steps to Reproduce

Create the above resources, modify the 'timeouts' section in the aws_servicecatalog_provisioning_artifact. Then re-apply and it will not show any changes.

The only way to update is to delete the aws_servicecatalog_provisioning_artifact and re-create.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

boxrick commented 1 year ago

When I have delved further into it the 'private' section within the state file when base64 decoded seems to store the timeouts in addition to them being stored in the resource itself. Manually adjusting the resource timeouts in the state file doesn't seem to do anything, but deleting or updating the private metadata you can hack it in.

"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjo2MDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0="

echo 'eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJyZWFkIjo2MDAwMDAwMDAwMDAsInVwZGF0ZSI6MzAwMDAwMDAwMDAwfX0=' | base64 -d

{"e2bfb730-ecaa-11e6-8f88-34363bc7c4c0":{"create":300000000000,"delete":300000000000,"read":600000000000,"update":300000000000}}

justinretzolk commented 1 year ago

Hey @boxrick πŸ‘‹ Thank you for taking the time to raise this! I wouldn't expect that adjusting the custom timeouts for the resource would trigger an infrastructure change, since they're not actually modifying the resource, but rather adjusting the amount of time that the provider allows for particular parts of the CRUD operations. Are you seeing issues where you've extended one of the timeouts and the adjusted time is not being respected?

boxrick commented 1 year ago

Hey @boxrick πŸ‘‹ Thank you for taking the time to raise this! I wouldn't expect that adjusting the custom timeouts for the resource would trigger an infrastructure change, since they're not actually modifying the resource, but rather adjusting the amount of time that the provider allows for particular parts of the CRUD operations. Are you seeing issues where you've extended one of the timeouts and the adjusted time is not being respected?

Yes, exactly this. Once I have adjusted the custom timeouts, then updated the resource with other values the custom timeouts do not get changed or used with the resource. The only way to update these values is to destroy the resource entirely, or to change it in the state file directly as I list above.