[在AWS CodeBuild中创建构建项目并在源部分中设置buildspec文件以使用s3(ARN)的路径时,它将创建项目并将ARN用作内联命令,而不是用于文件。有谁知道这是为什么,以及如何解决这个问题?
这似乎是一个怪癖,但是当buildspec托管在S3中时,执行CodeBuild项目没有问题。我检查并确认从S3检索到buildspec并正常执行。只需运行您的项目并确认,您无需“修复”任何内容。
我测试了以下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"
}
[请注意,您也可以将实际的buildspec命令放在TF文件的'source> buildspec'参数中,这可能是S3 URI显示为buildspec源的一部分的原因。