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.85k stars 9.2k forks source link

[Enhancement]: Related to AWS Service Catalog resource aws_servicecatalog_provisioned_product attribute "provisioning parameter" #37177

Open kaul-abhi opened 6 months ago

kaul-abhi commented 6 months ago

Description

Hello Team, Greetings of the day!! The query is related to AWS Service Catalog and Terraform. I have query regarding API Provisioned Product of Service Catalog which has provisioning parameter as argument to be provided while creating provisioned product. Kindly note that provisioning parameter is synonymous to input variable of Terraform module/code which spoke user provides the value while deploying the module. That is defined as key value pair in "string" format as below :

 "ProvisioningParameters": [ 
      { 
         "Key": "string",
         "Value": "string"
      }
   ],

My query is that if the input variable is defined not a string but say a complex data structure like map ( objects) or list( object) then how that would work. Regarding map of string i tested it and converted map of string structure to single line string interpolation. For example below is a map:

original_map = {
    key1 = "value1"
    key2 = "value2"
    key3 = "value3"
  }

which i convertd to string with value : {"key1":"value1","key2":"value2","key3":"value3"}

but what about more complex structure if someone have in their terraform modules like map of object or lists of objects. How it will fit into provisioning parameter attribute of provisionedProduct API design. Request your help in that perspective.

For example, i have this input variable defined in one of terraform module like this :

variable "portfolios" {
  description = "List of portfolios with their details."
  type        = list(object({
    name                = string
    description         = string
    provider_name       = string
    distributor         = string
    support_description = string
    support_email       = string
    support_url         = string
    spoke_accounts      = list(number)
    products            = list(object({
      name               = string
      owner              = string
      description        = string
      tf_module_location = optional(string)
      artifacts   = list(object({
        name          = string
        template_path = string
        description   = string
        guidance      = optional(string)
        active        = optional(bool)
      }))
    }))
  }))
}

PFB links for reference:

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/servicecatalog_provisioned_product

https://docs.aws.amazon.com/servicecatalog/latest/dg/API_ProvisionProduct.html

Affected Resource(s) and/or Data Source(s)

aws_servicecatalog_provisionedproduct

Potential Terraform Configuration

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 6 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

justinretzolk commented 3 months ago

Hey @kaul-abhi πŸ‘‹ In the scenario you described, the module could process the input (if the module intended to be opinionated about the structure), or the jsonencode() function could be used to convert the map to a string for use with the value argument.

justinretzolk commented 1 week ago

Hey @kaul-abhi πŸ‘‹ I wanted to follow up here to see if you were still having issues, or if we're okay to close this issue.