Terraform /AWS aws_servicecatalog_portfolio

Mar*_*ewa 4 amazon-web-services terraform aws-service-catalog

我正在尝试通过 Terraform 部署服务目录。当我尝试通过代码部署服务目录产品时:

\n
#Service catalog product\nresource "aws_servicecatalog_product" "linuxDesktop" {\n  name  = "Linux Desktop"\n  description= "Cloud development environment configured for engineering staff. Runs AWS Linux."\n  owner = "IT"\n  type = "CLOUD_FORMATION_TEMPLATE"\n\n  provisioning_artifact_parameters {\n    template_url = "https://fdfdasfadfdf.s3.us-west-2.amazonaws.com/development-environment.yaml"\n  }\n}\n\n
Run Code Online (Sandbox Code Playgroud)\n

我从 terraform 收到错误:

\n
aws_servicecatalog_portfolio.portfolio: Creation complete after 2s [id=port-xe2ql6s2myy3s]\n\xe2\x95\xb7\n\xe2\x94\x82 Error: error creating Service Catalog Product: InvalidParametersException: The CLOUD_FORMATION_TEMPLATE Product Type only supports the following ProvisioningArtifact Types: CLOUD_FORMATION_TEMPLATE, ACCOUNT_FACTORY\n\xe2\x94\x82\n\xe2\x94\x82   with aws_servicecatalog_product.linuxDesktop,\n\xe2\x94\x82   on main.tf line 31, in resource "aws_servicecatalog_product" "linuxDesktop":\n\xe2\x94\x82   31: resource "aws_servicecatalog_product" "linuxDesktop" {\n
Run Code Online (Sandbox Code Playgroud)\n

Mar*_*cin 5

provisioning_artifact_parameters您还必须添加类型:

resource "aws_servicecatalog_product" "linuxDesktop" {
  name  = "Linux Desktop"
  description= "Cloud development environment configured for engineering staff. Runs AWS Linux."
  owner = "IT"
  type = "CLOUD_FORMATION_TEMPLATE"

  provisioning_artifact_parameters {
    template_url = "https://fdfdasfadfdf.s3.us-west-2.amazonaws.com/development-environment.yaml"
    type = "CLOUD_FORMATION_TEMPLATE"
  }
}

Run Code Online (Sandbox Code Playgroud)