Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/aws_codebuild_project: Prevent panic with missing environment variable type #5052

Merged
merged 1 commit into from
Jul 2, 2018

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Jul 2, 2018

This fixes a panic caused by 20b148f, which was released in version 1.21.0 of the AWS provider to support aws_codebuild_project environment variable types.

2018-06-27T17:20:34.979Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: panic: interface conversion: interface {} is nil, not string
2018-06-27T17:20:34.979Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: 
2018-06-27T17:20:34.979Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: goroutine 3260 [running]:
2018-06-27T17:20:34.979Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsCodeBuildProjectEnvironmentHash(0x27aa2a0, 0xc4207216e0, 0xc42177aa58)
2018-06-27T17:20:34.979Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_codebuild_project.go:838 +0x8f6
2018-06-27T17:20:34.979Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Set).hash(0xc42177aa40, 0x27aa2a0, 0xc4207216e0, 0x7f594678c870, 0x0)
2018-06-27T17:20:34.979Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/set.go:205 +0x3d
2018-06-27T17:20:34.979Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Set).add(0xc42177aa40, 0x27aa2a0, 0xc4207216e0, 0x2a8b700, 0x2483801, 0xc42177aa40)
2018-06-27T17:20:34.980Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/set.go:192 +0x72
2018-06-27T17:20:34.980Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.(*Set).Add(0xc42177aa40, 0x27aa2a0, 0xc4207216e0)
2018-06-27T17:20:34.980Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/set.go:69 +0x44
2018-06-27T17:20:34.980Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema.NewSet(0x2e6e130, 0xc422013e30, 0x1, 0x1, 0xc42177a860)
2018-06-27T17:20:34.980Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/vendor/github.com/hashicorp/terraform/helper/schema/set.go:56 +0x7a
2018-06-27T17:20:34.980Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsCodeBuildProjectRead(0xc420fb2f50, 0x2954240, 0xc420096840, 0xc420fb2f50, 0x0)
2018-06-27T17:20:34.980Z [DEBUG] plugin.terraform-provider-aws_v1.25.0_x4: 	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_codebuild_project.go:567 +0x278

Changes proposed in this pull request:

  • Ignore missing type in environment variable TypeSet hashing instead of panicking

Output from acceptance testing:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSCodeBuildProject'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSCodeBuildProject -timeout 120m
=== RUN   TestAccAWSCodeBuildProject_importBasic
--- PASS: TestAccAWSCodeBuildProject_importBasic (21.44s)
=== RUN   TestAccAWSCodeBuildProject_basic
--- PASS: TestAccAWSCodeBuildProject_basic (31.19s)
=== RUN   TestAccAWSCodeBuildProject_BadgeEnabled
--- PASS: TestAccAWSCodeBuildProject_BadgeEnabled (30.25s)
=== RUN   TestAccAWSCodeBuildProject_BuildTimeout
--- PASS: TestAccAWSCodeBuildProject_BuildTimeout (29.04s)
=== RUN   TestAccAWSCodeBuildProject_Cache
--- PASS: TestAccAWSCodeBuildProject_Cache (52.90s)
=== RUN   TestAccAWSCodeBuildProject_Description
--- PASS: TestAccAWSCodeBuildProject_Description (37.35s)
=== RUN   TestAccAWSCodeBuildProject_EncryptionKey
--- PASS: TestAccAWSCodeBuildProject_EncryptionKey (49.93s)
=== RUN   TestAccAWSCodeBuildProject_Environment_EnvironmentVariable_Type
--- PASS: TestAccAWSCodeBuildProject_Environment_EnvironmentVariable_Type (31.71s)
=== RUN   TestAccAWSCodeBuildProject_Source_Auth
--- PASS: TestAccAWSCodeBuildProject_Source_Auth (31.02s)
=== RUN   TestAccAWSCodeBuildProject_Source_GitCloneDepth
--- PASS: TestAccAWSCodeBuildProject_Source_GitCloneDepth (37.94s)
=== RUN   TestAccAWSCodeBuildProject_Source_InsecureSSL
--- PASS: TestAccAWSCodeBuildProject_Source_InsecureSSL (37.15s)
=== RUN   TestAccAWSCodeBuildProject_Tags
--- PASS: TestAccAWSCodeBuildProject_Tags (29.12s)
=== RUN   TestAccAWSCodeBuildProject_VpcConfig
--- PASS: TestAccAWSCodeBuildProject_VpcConfig (58.06s)
=== RUN   TestAccAWSCodeBuildProject_WindowsContainer
--- PASS: TestAccAWSCodeBuildProject_WindowsContainer (30.45s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	507.613s

@bflad bflad added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/codebuild Issues and PRs that pertain to the codebuild service. labels Jul 2, 2018
@bflad bflad added this to the v1.26.0 milestone Jul 2, 2018
@bflad bflad requested a review from a team July 2, 2018 17:22
@ghost ghost added the size/XS Managed by automation to categorize the size of a PR. label Jul 2, 2018
@bflad bflad changed the title resousrce/aws_codebuild_project: Prevent panic with missing environment variable type resource/aws_codebuild_project: Prevent panic with missing environment variable type Jul 2, 2018
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@bflad bflad merged commit 47a8934 into master Jul 2, 2018
@bflad bflad deleted the b-aws_codebuild_project-env-type-panic branch July 2, 2018 18:25
bflad added a commit that referenced this pull request Jul 2, 2018
@bflad
Copy link
Contributor Author

bflad commented Jul 4, 2018

This has been released in version 1.26.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 4, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/codebuild Issues and PRs that pertain to the codebuild service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants