下面是我的 codebuild 和 codepipeline 资源块
resource "aws_codebuild_project" "xxxx_build" {
name = "xxxx-project"
service_role = aws_iam_role.iam_for_codebuild.arn
source {
type = "GITHUB"
location = "https://github.com/oihuegbu/terraformproject.git"
}
environment {
compute_type = "BUILD_GENERAL1_SMALL"
image = "aws/codebuild/amazonlinux-x86_64-standard:5.0"
type = "LINUX_CONTAINER"
}
artifacts {
type = "NO_ARTIFACTS"
}
}
resource "aws_codepipeline" "codepipeline" {
name = "xxxx-pipeline"
role_arn = aws_iam_role.iam_for_codepipeline.arn
artifact_store {
location = aws_s3_bucket.codepipeline_bucket.bucket
type = "S3"
}
stage {
name = "Source"
action {
name = "GitHubSource"
category = "Source"
owner = "ThirdParty"
provider = "Github"
output_artifacts = ["SourceOutput"]
version = "1"
configuration = {
Owner = "oihuegbu"
Repo = "terraformproject"
Branch = "main"
OAuthToken = var.github_token
}
}
}
stage {
name = "Build"
action {
name = "Build"
category = "Build"
owner = "AWS"
provider = "CodeBuild"
input_artifacts = ["SourceOutput"]
output_artifacts = ["build_output"]
version = "1"
configuration = {
ProjectName = "xxxx"
}
}
}
}
但是我在尝试部署时遇到此错误
│ Error: Error creating CodePipeline: InvalidActionDeclarationException: ActionType
(Category: 'Source', Provider: 'Github', Owner: 'ThirdParty', Version: '1') in action
'GitHubSource' is not available in region 'US_EAST_1'
│
│ with aws_codepipeline.codepipeline,
│ on codepipeline.tf line 1, in resource "aws_codepipeline" "codepipeline":
│ 1: resource "aws_codepipeline" "codepipeline" {
我认为这只是您的提供商设置中的拼写错误。尝试改变这个:
provider = "Github"
对此:
provider = "GitHub"