-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Service Catalog product version changes doesn't create a new version #19506
Comments
It looks like we are missing terraform-provider-aws/aws/resource_aws_servicecatalog_product.go Lines 68 to 111 in 5283e38
|
Workaround exists for provider But this does mean a dummy/initial CFT must be uploaded and active with the |
We've got a similar problem which (I think) requires the same solution: adding In our case we create the template via an resource "aws_s3_bucket_object" "template" {
key = "product.template"
bucket = aws_s3_bucket.my_templates.id
content = templatefile("${path.module}/templates/product.yml", {})
}
resource "aws_servicecatalog_product" "this" {
name = "example"
owner = data.aws_caller_identity.this.account_id
type = "CLOUD_FORMATION_TEMPLATE"
provisioning_artifact_parameters {
type = "CLOUD_FORMATION_TEMPLATE"
template_url = "https://${aws_s3_bucket.my_templates.bucket_domain_name}/${aws_s3_bucket_object.template.key}?version_id=${aws_s3_bucket_object.template.version_id}"
}
} What happens is that even though the template (and with it the For now we use an additional, separate |
@markvl
placeholder_template.yaml
However, I am still concerned how do update same version with the new cfn template without changing the file name ? How can I deploy/update the version with the latest changes to the template keeping the file name unchanged ? Changing the aws_servicecatalog_provisioning_artifact.name wont pick up the latest template. :( |
@mailjunze My workaround looks like this: resource "aws_s3_bucket_object" "template" {
key = "product.template"
bucket = aws_s3_bucket.my_templates.id
content = templatefile("${path.module}/templates/product.yml", {})
}
resource "aws_servicecatalog_product" "this" {
name = "example"
owner = data.aws_caller_identity.current.id
type = "CLOUD_FORMATION_TEMPLATE"
# Dummy version.
# Due to https://github.com/hashicorp/terraform-provider-aws/issues/19506 we
# have to use a separate resource here so the product version will be updated
# when the template is changed.
provisioning_artifact_parameters {
type = "CLOUD_FORMATION_TEMPLATE"
name = "don't use"
disable_template_validation = true
template_url = "invalid"
}
}
# Will be redundant once https://github.com/hashicorp/terraform-provider-aws/issues/19506 is fixed.
resource "aws_servicecatalog_provisioning_artifact" "this" {
name = "latest"
type = "CLOUD_FORMATION_TEMPLATE"
template_url = "https://${aws_s3_bucket.my_templates.bucket_domain_name}/${aws_s3_bucket_object.template.key}?version_id=${aws_s3_bucket_object.template.version_id}"
product_id = aws_servicecatalog_product.this.id
} When there is a change in the template, the |
Another way that also works well in case you use a |
Ran into the same thing. The issue being that we need to trigger a change. Terraform knows my yaml file has been updated, it just never fully overwrites the service catalog product. As others have mentioned, updating the version never makes its way to the catalog. The things we're missing is "ForceNew". There's another way we can do that. Hash your file and add for_each:
While a bit clunky, hashing the file gives us a unique value each time our file has been updated. Adding for_each to our resource would essentially "ForceNew" for_each hash in our list. So when our file updates, our hash updates, and we get a new resource. |
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Then changing the provisioning_artifact_parameters attributes:
Panic Output
Expected Behavior
Expected a new product version in the second apply with name "0.1.0" and description "minor release".
Actual Behavior
Nothing is created in AWS Service Catalog. The Terraform state file shows the changes but they are not reflected in the AWS console.
Steps to Reproduce
terraform apply
terraform apply
Important Factoids
The initial product version will also not be recreated if it is deleted which can be done by doing the following:
1.
terraform apply
2. In the AWS console, create a new product version manually.
3. Delete the original product version.
4.
terraform apply
and no changes are made.References
The text was updated successfully, but these errors were encountered: