Skip to content

Commit

Permalink
Merge pull request #31483 from hashicorp/remove-aws_codebuild_project…
Browse files Browse the repository at this point in the history
….source.auth

r/aws_codebuild_project: Remove `secondary_sources.auth` and `source.auth`
  • Loading branch information
ewbankkit authored May 19, 2023
2 parents a13a04f + 4bb37c3 commit a06c31b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 82 deletions.
3 changes: 3 additions & 0 deletions .changelog/31483.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:breaking-change
resource/aws_codebuild_project: The `secondary_sources.auth` and `source.auth` attributes have been removed
```
69 changes: 0 additions & 69 deletions internal/service/codebuild/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,28 +452,6 @@ func ResourceProject() *schema.Resource {
MaxItems: 12,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"auth": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"resource": {
Type: schema.TypeString,
Sensitive: true,
Optional: true,
Deprecated: "Use the aws_codebuild_source_credential resource instead",
},
"type": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice(codebuild.SourceAuthType_Values(), false),
Deprecated: "Use the aws_codebuild_source_credential resource instead",
},
},
},
Deprecated: "Use the aws_codebuild_source_credential resource instead",
},
"buildspec": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -565,28 +543,6 @@ func ResourceProject() *schema.Resource {
Required: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"auth": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"resource": {
Type: schema.TypeString,
Sensitive: true,
Optional: true,
Deprecated: "Use the aws_codebuild_source_credential resource instead",
},
"type": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice(codebuild.SourceAuthType_Values(), false),
Deprecated: "Use the aws_codebuild_source_credential resource instead",
},
},
},
Deprecated: "Use the aws_codebuild_source_credential resource instead",
},
"buildspec": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1292,17 +1248,6 @@ func expandProjectSourceData(data map[string]interface{}) codebuild.ProjectSourc
projectSource.ReportBuildStatus = aws.Bool(data["report_build_status"].(bool))
}

// Probe data for auth details (max of 1 auth per ProjectSource object)
if v, ok := data["auth"]; ok && len(v.([]interface{})) > 0 {
if auths := v.([]interface{}); auths[0] != nil {
auth := auths[0].(map[string]interface{})
projectSource.Auth = &codebuild.SourceAuth{
Type: aws.String(auth["type"].(string)),
Resource: aws.String(auth["resource"].(string)),
}
}
}

// Only valid for CODECOMMIT, GITHUB, GITHUB_ENTERPRISE, BITBUCKET source types.
if sourceType == codebuild.SourceTypeCodecommit || sourceType == codebuild.SourceTypeGithub || sourceType == codebuild.SourceTypeGithubEnterprise || sourceType == codebuild.SourceTypeBitbucket {
if v, ok := data["git_submodules_config"]; ok && len(v.([]interface{})) > 0 {
Expand Down Expand Up @@ -1833,9 +1778,6 @@ func flattenProjectSourceData(source *codebuild.ProjectSource) interface{} {

m["build_status_config"] = flattenProjectBuildStatusConfig(source.BuildStatusConfig)

if source.Auth != nil {
m["auth"] = []interface{}{sourceAuthToMap(source.Auth)}
}
if source.SourceIdentifier != nil {
m["source_identifier"] = aws.StringValue(source.SourceIdentifier)
}
Expand Down Expand Up @@ -2001,17 +1943,6 @@ func environmentVariablesToMap(environmentVariables []*codebuild.EnvironmentVari
return envVariables
}

func sourceAuthToMap(sourceAuth *codebuild.SourceAuth) map[string]interface{} {
auth := map[string]interface{}{}
auth["type"] = aws.StringValue(sourceAuth.Type)

if sourceAuth.Resource != nil {
auth["resource"] = aws.StringValue(sourceAuth.Resource)
}

return auth
}

func ValidProjectName(v interface{}, k string) (ws []string, errors []error) {
value := v.(string)
if !regexp.MustCompile(`^[A-Za-z0-9]`).MatchString(value) {
Expand Down
1 change: 0 additions & 1 deletion internal/service/codebuild/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ func TestAccCodeBuildProject_basic(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "project_visibility", "PRIVATE"),
resource.TestCheckResourceAttrPair(resourceName, "service_role", roleResourceName, "arn"),
resource.TestCheckResourceAttr(resourceName, "source.#", "1"),
resource.TestCheckResourceAttr(resourceName, "source.0.auth.#", "0"),
resource.TestCheckResourceAttr(resourceName, "source.0.git_clone_depth", "0"),
resource.TestCheckResourceAttr(resourceName, "source.0.insecure_ssl", "false"),
resource.TestCheckResourceAttr(resourceName, "source.0.location", "https://github.com/hashibot-test/aws-test.git"),
Expand Down
5 changes: 5 additions & 0 deletions website/docs/guides/version-5-upgrade.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Upgrade topics:
- [Resource: aws_budgets_budget](#resource-aws_budgets_budget)
- [Resource: aws_ce_anomaly_subscription](#resource-aws_ce_anomaly_subscription)
- [Resource: aws_cloudwatch_event_target](#resource-aws_cloudwatch_event_target)
- [Resource: aws_codebuild_project](#resource-aws_codebuild_project)
- [Resource: aws_connect_queue](#resource-aws_connect_queue)
- [Resource: aws_connect_routing_profile](#resource-aws_connect_routing_profile)
- [Resource: aws_docdb_cluster](#resource-aws_docdb_cluster)
Expand Down Expand Up @@ -126,6 +127,10 @@ The `threshold` attribute has been removed.

The `ecs_target.propagate_tags` attribute now has no default value. If no value is specified, the tags are not propagated.

## Resource: aws_codebuild_project

The `secondary_sources.auth` and `source.auth` attributes have been removed.

## Resource: aws_connect_queue

The `quick_connect_ids_associated` attribute has been removed.
Expand Down
12 changes: 0 additions & 12 deletions website/docs/r/codebuild_project.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ See [ProjectFileSystemLocation](https://docs.aws.amazon.com/codebuild/latest/API

### secondary_sources

* `auth` - (Optional, **Deprecated**) Configuration block with the authorization settings for AWS CodeBuild to access the source code to be built. This information is for the AWS CodeBuild console's use only. Use the [`aws_codebuild_source_credential` resource](codebuild_source_credential.html) instead. Auth blocks are documented below.
* `buildspec` - (Optional) The build spec declaration to use for this build project's related builds. This must be set when `type` is `NO_SOURCE`. It can either be a path to a file residing in the repository to be built or a local file path leveraging the `file()` built-in.
* `git_clone_depth` - (Optional) Truncate git history to this many commits. Use `0` for a `Full` checkout which you need to run commands like `git branch --show-current`. See [AWS CodePipeline User Guide: Tutorial: Use full clone with a GitHub pipeline source](https://docs.aws.amazon.com/codepipeline/latest/userguide/tutorials-github-gitclone.html) for details.
* `git_submodules_config` - (Optional) Configuration block. Detailed below.
Expand All @@ -363,11 +362,6 @@ See [ProjectFileSystemLocation](https://docs.aws.amazon.com/codebuild/latest/API
* `source_identifier` - (Required) An identifier for this project source. The identifier can only contain alphanumeric characters and underscores, and must be less than 128 characters in length.
* `type` - (Required) Type of repository that contains the source code to be built. Valid values: `CODECOMMIT`, `CODEPIPELINE`, `GITHUB`, `GITHUB_ENTERPRISE`, `BITBUCKET` or `S3`.

#### secondary_sources: auth

* `resource` - (Optional, **Deprecated**) Resource value that applies to the specified authorization type. Use the [`aws_codebuild_source_credential` resource](codebuild_source_credential.html) instead.
* `type` - (Required, **Deprecated**) Authorization type to use. The only valid value is `OAUTH`. This data type is deprecated and is no longer accurate or used. Use the [`aws_codebuild_source_credential` resource](codebuild_source_credential.html) instead.

#### secondary_sources: git_submodules_config

This block is only valid when the `type` is `CODECOMMIT`, `GITHUB` or `GITHUB_ENTERPRISE`.
Expand All @@ -386,7 +380,6 @@ This block is only valid when the `type` is `CODECOMMIT`, `GITHUB` or `GITHUB_EN

### source

* `auth` - (Optional, **Deprecated**) Configuration block with the authorization settings for AWS CodeBuild to access the source code to be built. This information is for the AWS CodeBuild console's use only. Use the [`aws_codebuild_source_credential` resource](codebuild_source_credential.html) instead. Auth blocks are documented below.
* `buildspec` - (Optional) Build specification to use for this build project's related builds. This must be set when `type` is `NO_SOURCE`.
* `git_clone_depth` - (Optional) Truncate git history to this many commits. Use `0` for a `Full` checkout which you need to run commands like `git branch --show-current`. See [AWS CodePipeline User Guide: Tutorial: Use full clone with a GitHub pipeline source](https://docs.aws.amazon.com/codepipeline/latest/userguide/tutorials-github-gitclone.html) for details.
* `git_submodules_config` - (Optional) Configuration block. Detailed below.
Expand All @@ -396,11 +389,6 @@ This block is only valid when the `type` is `CODECOMMIT`, `GITHUB` or `GITHUB_EN
* `build_status_config` - (Optional) Configuration block that contains information that defines how the build project reports the build status to the source provider. This option is only used when the source provider is `GITHUB`, `GITHUB_ENTERPRISE`, or `BITBUCKET`. `build_status_config` blocks are documented below.
* `type` - (Required) Type of repository that contains the source code to be built. Valid values: `CODECOMMIT`, `CODEPIPELINE`, `GITHUB`, `GITHUB_ENTERPRISE`, `BITBUCKET`, `S3`, `NO_SOURCE`.

#### source: auth

* `resource` - (Optional, **Deprecated**) Resource value that applies to the specified authorization type. Use the [`aws_codebuild_source_credential` resource](codebuild_source_credential.html) instead.
* `type` - (Required, **Deprecated**) Authorization type to use. The only valid value is `OAUTH`. This data type is deprecated and is no longer accurate or used. Use the [`aws_codebuild_source_credential` resource](codebuild_source_credential.html) instead.

#### source: git_submodules_config

This block is only valid when the `type` is `CODECOMMIT`, `GITHUB` or `GITHUB_ENTERPRISE`.
Expand Down

0 comments on commit a06c31b

Please sign in to comment.