hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.86k stars 9.21k forks source link

[Bug]: aws_codebuild_project.source.build_status_config.target_url should not be required #30153

Open slmg opened 1 year ago

slmg commented 1 year ago

Terraform Core Version

1.3.9

AWS Provider Version

4.59.0

Affected Resource(s)

aws_codebuild_project

Expected Behavior

The target_url is optional and should be infered from the source type and location. This is the default behaviour in CloudFormation.

Actual Behavior

Error - target_url is required.

Relevant Error/Panic Output Snippet

Error creating CodeBuild project: InvalidInputException: Build status target url cannot be empty

Terraform Configuration Files

terraform {
  required_version = "~> 1.3"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~>4.59"
    }
  }
}

provider "aws" {
  region = var.aws_region
}

resource "aws_codebuild_project" "ci" {
  name          = "project-ci"
  service_role  = "some valid service role"
  artifacts {
    type = "NO_ARTIFACTS"
  }
  environment {
    compute_type                = "BUILD_GENERAL1_SMALL"
    image                       = "aws/codebuild/standard:6.0"
    type                        = "LINUX_CONTAINER"
    image_pull_credentials_type = "CODEBUILD"
    privileged_mode             = true
  }
  source {
    type                = "GITHUB_ENTERPRISE"
    location            = "https://example.com/org/repo.git"
    git_clone_depth     = 1
    report_build_status = true
    build_status_config {
      context    = "CodeBuild CI"
    }
  }
  vpc_config {
    vpc_id             = "vpc id"
    subnets            = ["subnets id"]
    security_group_ids = ["security group ids"]
  }
}

Steps to Reproduce

terraform apply

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

justinretzolk commented 1 year ago

Hey @slmg 👋 Thank you for taking the time to raise this! It looks like this error might be coming from the AWS API itself. So that we have the necessary information in order to look into this, can you supply debug logs (redacted as needed) as well?