Hello:
We have aws service catalog portfolio and EC2 product created by terraform, where this EC2 product will be provisioned from a cloud formation template with several parameters (such as VpcId, SubnetId, InstanceType, InstanceRole
etc.). Now we wish to provision this EC2 product, the question is: how could we pass these parameters from terraform to cloud formation template? Or what is the right way to do it?
Thanks in advance.
Terraform codes:
resource "aws_servicecatalog_provisioned_product" "this_provisioned_prod" {
name = "my-name"
product_id = "prod-xxxxx"
provisioning_artifact_id = "pa-xxxx"
}
resource "aws_servicecatalog_product" "this_prod" {
...
provisioning_artifact_parameters {
...
template_url = "https://my-bucket.s3.amazonaws.com/my-cft.yml"
}
}
my-cft.yml abstract:
Parameters:
VpcId:
Type: AWS::EC2::VPC::Id
Description: VPC ID on which EC2 instance will reside
ConstraintDescription: Must be the VPC Id of an existing virtual private cloud.
MinLength: 1
SubnetId:
Type: AWS::EC2::Subnet::Id
Description: Use Private Subnet
ConstraintDescription: Select a private subnet, public subnets not allowed.
MinLength: 1
...