Creating ServiceCatalog Provisioned Products with zero length string parameters

How would one go about using the new ServiceCatalog_Provisioned_Product when the parameters in the underlying Cloudformation template accept default values with zero length strings?

For example, I have this snippet of CFN:

Parameters:
  PredefinedDatabaseSubnetIds:
    Description: |
      Predefined database subnets where the databases will be deployed. Defined as
      a comma separated list of subnet IDs. If you have selected a pre-defined VPC,
      you MUST specify Database Subnet IDs here.
    Type: CommaDelimitedList
    Default: ""

With this Terraform:

resource "random_id" "id" {
  byte_length = 8
}

resource "aws_servicecatalog_provisioned_product" "prod1330" {
  name = "tef-${random_id.id.hex}"
  accept_language = "en"
  notification_arns = [""]
  provisioning_artifact_id = "pa-XXXX"
  product_id = "prod-XXXX"
  provisioning_parameters {
    key = "PredefinedDatabaseSubnetIds"
    value = ""
  }
}

In the ServiceCatalog console, I get an error saying:

AmazonCloudFormationException  ParameterValue for ParameterKey PredefinedDatabaseSubnetIds is required (Service: AmazonCloudFormation; Status Code: 400; Error Code: ValidationError; Request ID: 4f77c99d-3c0c-4a9a-8d03-0336cf07331c; Proxy: null)

Is there a way to submit zero length string parameters through Terraform? I know the Cloudofrmation works just fine by itself and that going through the ServiceCatalog UI works also.

Hi @Joeturbot , Do we have any workaround or fix for this?

@infotokabil My workaround was to bypass Service Catalog completely and use CloudFormation directly. I don’t know if this has been resolved in the AWS Terraform provider or not.

1 Like