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

Add aws.StringValue wrapper to prevent crash on missing environment name #10074

Merged
merged 2 commits into from
Sep 17, 2019

Conversation

ryndaniels
Copy link
Contributor

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Closes #10065

Release note for CHANGELOG:

BUG FIXES:
* ecs_task_definition_equivalency: Fix a crash if environment name is missing

Output from acceptance testing:

$ make testacc TESTARGS="-run=TestAwsEcsContainerDefinitionsAreEquivalent_"
==> Fixing source code with gofmt...
gofmt -s -w ./aws
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAwsEcsContainerDefinitionsAreEquivalent_ -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAwsEcsContainerDefinitionsAreEquivalent_basic
--- PASS: TestAwsEcsContainerDefinitionsAreEquivalent_basic (0.00s)
=== RUN   TestAwsEcsContainerDefinitionsAreEquivalent_portMappings
--- PASS: TestAwsEcsContainerDefinitionsAreEquivalent_portMappings (0.00s)
=== RUN   TestAwsEcsContainerDefinitionsAreEquivalent_portMappingsIgnoreHostPort
2019/09/11 13:53:20 [DEBUG] Canonical definitions are not equal.
First: [{"essential":true,"image":"wordpress","name":"wordpress","portMappings":[{"containerPort":80,"hostPort":80}]}]
Second: [{"essential":true,"image":"wordpress","name":"wordpress","portMappings":[{"containerPort":80}]}]
--- PASS: TestAwsEcsContainerDefinitionsAreEquivalent_portMappingsIgnoreHostPort (0.00s)
=== RUN   TestAwsEcsContainerDefinitionsAreEquivalent_arrays
--- PASS: TestAwsEcsContainerDefinitionsAreEquivalent_arrays (0.00s)
=== RUN   TestAwsEcsContainerDefinitionsAreEquivalent_negative
2019/09/11 13:53:20 [DEBUG] Canonical definitions are not equal.
First: [{"cpu":10,"environment":[{"name":"EXAMPLE_NAME","value":"foobar"}],"essential":true,"image":"wordpress","memory":500,"name":"wordpress"}]
Second: [{"cpu":10,"essential":true,"image":"wordpress","memory":500,"name":"wordpress"}]
--- PASS: TestAwsEcsContainerDefinitionsAreEquivalent_negative (0.00s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws

@ryndaniels ryndaniels requested review from aeschright and a team September 11, 2019 12:00
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/ecs Issues and PRs that pertain to the ecs service. labels Sep 11, 2019
@bflad bflad added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. labels Sep 11, 2019
@bflad
Copy link
Contributor

bflad commented Sep 11, 2019

Can you please add a covering unit test to prevent future regressions? Thanks so much. 👍

@ghost ghost added size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/XS Managed by automation to categorize the size of a PR. labels Sep 12, 2019
@ryndaniels
Copy link
Contributor Author

Updated test output:

make testacc TESTARGS="-run=TestAwsEcsContainerDefinitionsAreEquivalent_"                      
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAwsEcsContainerDefinitionsAreEquivalent_ -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAwsEcsContainerDefinitionsAreEquivalent_basic
--- PASS: TestAwsEcsContainerDefinitionsAreEquivalent_basic (0.00s)
=== RUN   TestAwsEcsContainerDefinitionsAreEquivalent_portMappings
--- PASS: TestAwsEcsContainerDefinitionsAreEquivalent_portMappings (0.00s)
=== RUN   TestAwsEcsContainerDefinitionsAreEquivalent_portMappingsIgnoreHostPort
2019/09/12 12:53:43 [DEBUG] Canonical definitions are not equal.
First: [{"essential":true,"image":"wordpress","name":"wordpress","portMappings":[{"containerPort":80,"hostPort":80}]}]
Second: [{"essential":true,"image":"wordpress","name":"wordpress","portMappings":[{"containerPort":80}]}]
--- PASS: TestAwsEcsContainerDefinitionsAreEquivalent_portMappingsIgnoreHostPort (0.00s)
=== RUN   TestAwsEcsContainerDefinitionsAreEquivalent_arrays
--- PASS: TestAwsEcsContainerDefinitionsAreEquivalent_arrays (0.00s)
=== RUN   TestAwsEcsContainerDefinitionsAreEquivalent_negative
2019/09/12 12:53:43 [DEBUG] Canonical definitions are not equal.
First: [{"cpu":10,"environment":[{"name":"EXAMPLE_NAME","value":"foobar"}],"essential":true,"image":"wordpress","memory":500,"name":"wordpress"}]
Second: [{"cpu":10,"essential":true,"image":"wordpress","memory":500,"name":"wordpress"}]
--- PASS: TestAwsEcsContainerDefinitionsAreEquivalent_negative (0.00s)
=== RUN   TestAwsEcsContainerDefinitionsAreEquivalent_missingEnvironmentName
--- PASS: TestAwsEcsContainerDefinitionsAreEquivalent_missingEnvironmentName (0.00s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       1.087s

Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

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

LGTM 👍 👍

--- PASS: TestAwsEcsContainerDefinitionsAreEquivalent_missingEnvironmentName

@ryndaniels ryndaniels merged commit ca35b5a into master Sep 17, 2019
@ryndaniels ryndaniels deleted the rfd-10065 branch September 17, 2019 08:23
@ryndaniels ryndaniels added this to the v2.29.0 milestone Sep 17, 2019
@ghost
Copy link

ghost commented Sep 20, 2019

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

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

bflad added a commit that referenced this pull request Sep 23, 2019
@ghost
Copy link

ghost commented Nov 1, 2019

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 Nov 1, 2019
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/ecs Issues and PRs that pertain to the ecs service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

err: rpc error: code = Unavailable desc = transport is closing
3 participants