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

[Bug]: r/aws_servicecatalog_product - nested provisioning_artifact_parameters do not trigger replacement #31049

Closed
jar-b opened this issue Apr 28, 2023 · 5 comments · Fixed by #31061
Labels
bug Addresses a defect in current functionality. service/servicecatalog Issues and PRs that pertain to the servicecatalog service.
Milestone

Comments

@jar-b
Copy link
Member

jar-b commented Apr 28, 2023

Terraform Core Version

v1.4.3

AWS Provider Version

v4.64.0

Affected Resource(s)

  • aws_servicecatalog_product

Expected Behavior

Modifying any of the arguments nested inside provisioning_artifact_parameters should force a new resource, as this object cannot be sent to the UpdateProduct API.

Actual Behavior

Modifying an argument triggers an in-place update.

Relevant Error/Panic Output Snippet

# aws_servicecatalog_product.test will be updated in-place
  ~ resource "aws_servicecatalog_product" "test" {
        id                  = "prod-yvlap7stzboxu"
        name                = "example"
        tags                = {
            "Name" = "example"
        }
        # (13 unchanged attributes hidden)

      ~ provisioning_artifact_parameters {
          ~ name                        = "example" -> "example-updated"
            # (4 unchanged attributes hidden)
        }
    }

Terraform Configuration Files

# additional configuration omitted for brevity
resource "aws_servicecatalog_product" "test" {
  description         = "example"
  distributor         = "example"
  name                = "example"
  owner               = "example"
  type                = "CLOUD_FORMATION_TEMPLATE"
  support_description = "example"
  support_email       = "no-reply@hashicorp.com"
  support_url         = "http://example.com"

  provisioning_artifact_parameters {
    description                 = "example"
    disable_template_validation = true
    name                        = "example" # <-- update this after creation
    template_url                = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_object.test.key}"
    type                        = "CLOUD_FORMATION_TEMPLATE"
  }

  tags = {
    Name = "example"
  }
}

Steps to Reproduce

  1. Create a service catalog product resource
  2. Modify any of the nested provisioning_artifact_parameters arguments
  3. Observe an in-place update

Debug Output

No response

Panic Output

No response

Important Factoids

While ForceNew is set for the parent provisioning_artifact_parameters, it should also be set for all required/optional nested arguments.

"provisioning_artifact_parameters": {
Type: schema.TypeList,
Required: true,
ForceNew: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"description": {
Type: schema.TypeString,
Optional: true,
},
"disable_template_validation": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"name": {
Type: schema.TypeString,
Optional: true,
},
"template_physical_id": {
Type: schema.TypeString,
Optional: true,
ExactlyOneOf: []string{
"provisioning_artifact_parameters.0.template_url",
"provisioning_artifact_parameters.0.template_physical_id",
},
},
"template_url": {
Type: schema.TypeString,
Optional: true,
ExactlyOneOf: []string{
"provisioning_artifact_parameters.0.template_url",
"provisioning_artifact_parameters.0.template_physical_id",
},
},
"type": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice(servicecatalog.ProvisioningArtifactType_Values(), false),
},
},
},
},

References

No response

Would you like to implement a fix?

None

@jar-b jar-b added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 28, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/servicecatalog Issues and PRs that pertain to the servicecatalog service. label Apr 28, 2023
@jar-b jar-b added this to the v5.0.0 milestone Apr 28, 2023
@jar-b
Copy link
Member Author

jar-b commented Apr 28, 2023

Adding to the v5.0.0 milestone. Although forcing re-creation is the correct behavior, the current behavior will not destroy a product when nested arguments change, and adjusting this in a minor version may be unexpected.

@jar-b
Copy link
Member Author

jar-b commented May 23, 2023

Closed by #31061, merged to main via #31392

@jar-b jar-b closed this as completed May 23, 2023
@github-actions
Copy link

This functionality has been released in v5.0.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/servicecatalog Issues and PRs that pertain to the servicecatalog service.
Projects
None yet
1 participant