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/opsworks_layers: Removed deprecated normalizeJson function #3081

Merged
merged 1 commit into from
Jan 22, 2018

Conversation

Ninir
Copy link
Contributor

@Ninir Ninir commented Jan 21, 2018

Description

This is the continuation of #2935.

It removes the deprecated normalizeJson function usage in opsworks_layers.go, removing the function definition in resource_aws_s3_bucket.go.

This also fixes the following failing test:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSOpsworksCustomLayer'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSOpsworksCustomLayer -timeout 120m
=== RUN   TestAccAWSOpsworksCustomLayerImportBasic
--- PASS: TestAccAWSOpsworksCustomLayerImportBasic (65.37s)
=== RUN   TestAccAWSOpsworksCustomLayer
--- FAIL: TestAccAWSOpsworksCustomLayer (45.36s)
	testing.go:513: Step 1 error: Error applying: 1 error(s) occurred:
		
		* aws_security_group.tf-ops-acc-layer3: 1 error(s) occurred:
		
		* aws_security_group.tf-ops-acc-layer3: Error creating Security Group: InvalidGroup.Duplicate: The security group 'tf-ops-acc-layer3' already exists for VPC 'vpc-b50ad8d2'
			status code: 400, request id: d1c98b44-a8ea-4538-9a00-56327293155e
FAIL
exit status 1
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	110.776s
make: *** [testacc] Error 1

Tests

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSOpsworksCustomLayer'                                       
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSOpsworksCustomLayer -timeout 120m
=== RUN   TestAccAWSOpsworksCustomLayerImportBasic
--- PASS: TestAccAWSOpsworksCustomLayerImportBasic (62.47s)
=== RUN   TestAccAWSOpsworksCustomLayer
--- PASS: TestAccAWSOpsworksCustomLayer (62.50s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws-clone/aws	125.046s

@Ninir Ninir added enhancement Requests to existing resources that expand the functionality or scope. service/opsworks Issues and PRs that pertain to the opsworks service. labels Jan 21, 2018
@Ninir Ninir added this to the v1.8.0 milestone Jan 21, 2018
@Ninir Ninir force-pushed the f-clean-deprecated-function branch from 49093d6 to 5f70fc8 Compare January 21, 2018 17:41
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the cleanup.

Just two nitpicks, nothing major.

} else {
policy, err := structure.NormalizeJsonString(*v)
if err != nil {
return errwrap.Wrapf("policy contains an invalid JSON: {{err}}", err)
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: As this error is going to be raised straight to the user I don't see the point in using errwrap here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, thanks for the explanation btw!

if v == nil {
d.Set("custom_json", "")
} else {
policy, err := structure.NormalizeJsonString(*v)
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: The short variable name v was ok-ish when it was in the previously short context, but I think we should now just reference layer.CustomJson in all 3 places for clarity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing

@Ninir Ninir force-pushed the f-clean-deprecated-function branch from 5f70fc8 to 1dbd8c5 Compare January 22, 2018 10:16
@Ninir Ninir force-pushed the f-clean-deprecated-function branch from 1dbd8c5 to d576f3c Compare January 22, 2018 10:20
@Ninir Ninir merged commit e221786 into hashicorp:master Jan 22, 2018
@Ninir Ninir deleted the f-clean-deprecated-function branch January 22, 2018 10:24
@ghost
Copy link

ghost commented Apr 8, 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 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/opsworks Issues and PRs that pertain to the opsworks service.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants