Here is the terraform template for aws service catalog that I am building.
resource "aws_servicecatalog_product" "data-ml-pipeline-service-catalog-product" {
name = "data-ml-pipeline-service-catalog-product"
owner = "data-ml"
type = "CLOUD_FORMATION_TEMPLATE"
provisioning_artifact_parameters {
template_url = "https://s3.amazonaws.com/cf-templates-ozkq9d3hgiq2-us-east-1/temp1.json"
type = "CLOUD_FORMATION_TEMPLATE"
}
Based on this question, Terraform /AWS aws_servicecatalog_portfolio, this should work.
Exact error: Error: error creating Service Catalog Product: InvalidParametersException: Invalid templateBody. Please make sure that your template is valid
Edit: Here is the new template that I am using.
---
ModelBuildCodeCommitRepository:
Properties:
Code:
BranchName: main
S3:
Bucket: sagemaker-servicecatalog-seedcode-us-west-2
Key: toolchain/image-build-model-building-workflow-v1.0.zip
RepositoryDescription:
? "Fn::Sub"
: "SageMaker Model building workflow infrastructure as code for the Project ${SageMakerProjectName}"
RepositoryName:
? "Fn::Sub"
: "sagemaker-${SageMakerProjectName}-${SageMakerProjectId}-modelbuild"
Type: "AWS::CodeCommit::Repository"
Parameters:
SageMakerProjectId:
Description: "Service-generated id of the project"
NoEcho: true
Type: String
SageMakerProjectName:
AllowedPattern: "^[a-zA-Z](-*[a-zA-Z0-9])*"
Description: "Name of the project"
MaxLength: 32
MinLength: 1
NoEcho: true
Type: String
I'd like to provide a general answer to this error message.
AFAIK, InvalidParametersException: Invalid templateBody. Please make sure that your template is valid
can imply that AWS cannot access the template you're trying to create a Service Catalog product version from (the one which is usually provided by key LoadTemplateFromURL
).
There are 2 possible reasons for this:
!Sub
etc.cloudFormation:validateTemplate
is in place.Basically, this error message is misleading because it suggests that the template is invalid but actually the template cannot even be accessed in the 1st place.