There is AWS CodePipeline based on two Github source. Requirement is to restrict the pipeline auto trigger for primary source only. Found this snippet from terraform aws samples to disable auto trigger.
I tried the same but getting error (Tested with latest hashicorp/aws "4.57.1" version too) –
Error: updating CodePipeline (xxxx): InvalidActionDeclarationException: Action configuration for action ‘2ndSource’ contains unknown configuration ‘PollForSourceChanges’
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.57.1"
}
}
}
resource "aws_codepipeline" "service" {
name = "${var.environment}-${var.name}"
role_arn = var.codepipeline_role_arn
artifact_store {
location = "${var.aws_s3_bucket_id}"
type = "S3"
}
stage {
name = "Source"
action {
name = "Source"
category = "Source"
owner = "AWS"
provider = "CodeStarSourceConnection"
version = "1"
output_artifacts = ["source"]
configuration = {
ConnectionArn = var.codestarconn_role_arn
FullRepositoryId = var.source_location
BranchName = var.source_version
}
run_order = "1"
}
action {
name = "2ndSource"
category = "Source"
owner = "AWS"
provider = "CodeStarSourceConnection"
version = "1"
output_artifacts = ["source2"]
configuration = {
ConnectionArn = var.codestarconn_role_arn
FullRepositoryId = var.deploy_repo
BranchName = var.deploy_branch
PollForSourceChanges = "false" // ---->> Throwing error
}
run_order = "2"
}
}
}
2
Answers
After a lots of googling...found
DetectChanges = "false"
. It suffice my requirement.PollForSourceChanges
is used for AWS Source actions such as S3, CodeCommit. For Github, Bitbucket, Github Enterprise we use CodeStar Connection and you can disable the auto trigger by configuring the parameterDetectChanges
asfalse
. Here are the full list of Configuration parameters for CodeStar Connection source action.