Using terraform v0.11.11 and aws plugin v2.0.0_x4, I just started to receive an error when trying to create a Codebuild project in AWS.
The terraform section related to Codebuild is as follows:
resource "aws_codebuild_project" "codebuild-bitbucket" {
name = "validation-SD_REPOSITORY-SD_COUNTRY-SD_ENVIRONMENT"
description = "Validate Bitbucket Code from PR"
service_role = "${aws_iam_role.codebuild-role.arn}"
artifacts {
type = "S3"
location = "${aws_s3_bucket.artifact-store.bucket}"
packaging = "NONE"
}
environment {
compute_type = "BUILD_GENERAL1_SMALL"
image = "aws/codebuild/docker:18.09.0"
type = "LINUX_CONTAINER"
privileged_mode = "true"
environment_variable {
"name" = "ECRID"
"value" = "${var.codebuild_docker_ecr_id}"
}
environment_variable {
"name" = "ECRREGION"
"value" = "${var.region}"
}
}
source {
type = "BITBUCKET"
buildspec = "configuration/buildspec.yml"
location = "${var.specific_repo}"
auth {
type = "OAUTH"
}
report_build_status = "true"
}
tags = {
country = "${var.country_tag}"
}
}
resource "aws_codebuild_webhook" "codebuild-webhook-bitbucket" {
project_name = "${aws_codebuild_project.codebuild-bitbucket.name}"
}
After applying an update to my Codebuild configuration, adding a new environment variable, I'm receiving the following error:
Error: Error applying plan:
1 error(s) occurred:
* aws_codebuild_webhook.codebuild-webhook-bitbucket: 1 error(s) occurred:
* aws_codebuild_webhook.codebuild-webhook-bitbucket: ValidationException: 1 validation error detected: Value '' at 'newProjectVersion.webhook.branches' failed to satisfy constraint: Member must have length greater than or equal to 1
status code: 400, request id: 55dcfe4b-3ffe-11e9-ae77-a3b085c34d60
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
2019/03/06 10:55:22 [DEBUG] plugin: waiting for all plugin processes to complete...
2019-03-06T10:55:22.081Z [DEBUG] plugin.terraform-provider-aws_v2.0.0_x4: 2019/03/06 10:55:22 [ERR] plugin: plugin server: accept unix /tmp/plugin325591570: use of closed network connection
2019-03-06T10:55:22.082Z [DEBUG] plugin: plugin process exited: path=/tmp/working/.terraform/plugins/linux_amd64/terraform-provider-aws_v2.0.0_x4
make: *** [Makefile:6: apply] Error 1
Which is the issue? What can I do to solve it?
Thanks in advance.