Terraform aws\u codebuild\u项目问题与来自S3的buildspec

Terraform aws\u codebuild\u项目问题与来自S3的buildspec,terraform,terraform-provider-aws,aws-codebuild,Terraform,Terraform Provider Aws,Aws Codebuild,创建构建项目(在AWS CodeBuild中)并在源代码部分中设置buildspec文件以使用来自s3(ARN)的路径时,会创建项目并将ARN作为内联命令而不是文件的路径。 有人知道这是为什么以及如何解决吗?这似乎是个怪癖,但是当buildspec托管在S3中时,执行CodeBuild项目没有问题。我检查并确认buildspec是从S3中检索的,并正常执行。只需运行您的项目并确认,您不需要“修复”任何东西 我使用以下buildspec进行了测试,与您共享的内容类似: provider "aws"

创建构建项目(在AWS CodeBuild中)并在源代码部分中设置buildspec文件以使用来自s3(ARN)的路径时,会创建项目并将ARN作为内联命令而不是文件的路径。
有人知道这是为什么以及如何解决吗?

这似乎是个怪癖,但是当buildspec托管在S3中时,执行CodeBuild项目没有问题。我检查并确认buildspec是从S3中检索的,并正常执行。只需运行您的项目并确认,您不需要“修复”任何东西

我使用以下buildspec进行了测试,与您共享的内容类似:

provider "aws" {
  region = "us-east-1"
}

resource "aws_codebuild_project" "test" {
  name          = "test-from-tf"
  description   = "test from terraform"
  build_timeout = "60"
  service_role  = "arn:aws:iam::123456789012:role/service-role/codebuild-al2-service-role"
  artifacts { type = "NO_ARTIFACTS" }
  environment {
    compute_type                = "BUILD_GENERAL1_SMALL"
    image                       = "aws/codebuild/standard:1.0"
    type                        = "LINUX_CONTAINER"
    image_pull_credentials_type = "CODEBUILD"
  }
  source {
    type            = "GITHUB"
    location        = "https://github.com/shariqmus/eb-python.git"
    git_clone_depth = 5
    buildspec       = "arn:aws:s3:::<bucket>/buildspec.yml"
  }
  source_version = "master"
}
提供程序“aws”{
region=“us-east-1”
}
资源“aws\U代码构建\U项目”“测试”{
name=“测试来自tf”
description=“从地形进行测试”
生成\u timeout=“60”
service_role=“arn:aws:iam::123456789012:role/service role/codebuild-al2-service-role”
工件{type=“NO_工件”}
环境{
compute\u type=“构建\u常规1\u小型”
image=“aws/codebuild/standard:1.0”
type=“LINUX\u容器”
image\u pull\u凭证\u type=“CODEBUILD”
}
来源{
type=“GITHUB”
位置=”https://github.com/shariqmus/eb-python.git"
git_克隆_深度=5
buildspec=“arn:aws:s3:::/buildspec.yml”
}
source\u version=“master”
}

请注意,您也可以将实际的buildspec命令放在TF文件的'source>buildspec'参数中,这可能是s3uri显示为buildspec source的一部分的原因。

请共享您的Terraform代码以更好地理解这一点。从AWS控制台或CLI创建项目时,不会注意到此行为。resource“AWS_codebuild_project”“test”{name=“test”description=“test”build_timeout=“60”service_role=AWS_iam_role.test artifacts{type=“NO_artifacts”}环境{compute type=“build_GENERAL1_SMALL”image=“AWS/codebuild/standard:1.0”type=“LINUX容器”映像\u pull\u凭证\u type=“CODEBUILD”}source{type=“GITHUB”location=”“git\u clone\u depth=5 buildspec=“arn:aws:path/to/buildspec.yml”}source\u version=“master”}