aws-samples / service-catalog-engine-for-terraform-os

Apache License 2.0
130 stars 40 forks source link

AWS provider overrided from engine cause problem with custom provider configurations #36

Open campaand opened 1 year ago

campaand commented 1 year ago

Hello, i noticed that, as described in the readme in the provider override paragraph, the file that overrides the provider is automatically created by the terraform engine after product launch.

However, I noticed that if in my configuration (inside my tar.gz file) I define the provider with some attributes, for example the default_tags or ignore_tags, these are not deployed but overwritten by "SERVICE_CATALOG_TERRAFORM_INTEGRATION-DO_NOT_DELETE": "pp-1234" where the value is generated by terraform engine.

If possible, i need the possibility to define aws provider by myself with some specific attributes.

For example, if i create aws provider with the following code snippet, all the information I entered as default_tags and ignore_tags are overwritten and therefore ignored

provider "aws" {
  default_tags {
    my_custom_tag_key = "custom_value"
  }
  ignore_tags {
    my_custom_tag_key_ignore = "custom_value_to_ignore"
  }
}

Thank you in advance for you contribution

zillidan commented 1 year ago

Hello Andrea,

Apologies for the issue faced in your specific use case as defined above. The ignorance of your custom provided default_tags and ignore_tags is by design as we use an overrides file. This limitation is called out here https://github.com/aws-samples/service-catalog-engine-for-terraform-os#provider-override.

We will work with our Product team to evaluate this enhancement.

smaly-amazon commented 1 year ago

Hi @campaand,

Adding a thought here.

The engine is designed to work in concert with Service Catalog features. In Service Catalog, tag options are the way you would apply a tag to all provisioned products based on the product or portfolio.

https://docs.aws.amazon.com/servicecatalog/latest/adminguide/tagoptions.html

You can use tag options instead of using default_tags in your provider block. This doesn't address the use of ignore_tags and other attributes in the provider block, but it is a partial solution.

By the way, the Service Catalog admin guide linked above is not correct when it states that tag options are not supported for Terraform Open Source products. We will correct this.

campaand commented 1 year ago

Hi @smaly-amazon, thanks for the feedback.

I will definitely try the TagOptions feature. At this point I wanted to know if the change to support custom configurations for the aws provider is planned. A fairly fundamental point would be that of ignore_tags or possibly other custom configurations of this type on this provider.

Thank you for your time and support

doug-fitzmaurice-rowden commented 5 months ago

To make this explicit, as I missed the comment above and read the docs page saying they weren't working: Both Tag Options and Custom Tags are supported - they are passed through by Service Catalogue to the various Lambda functions, and are written into the required_tags field in the provider override file.