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_api_gateway_rest_api: Allowed for binary media types update #1600

Merged
merged 2 commits into from
Sep 8, 2017

Conversation

Ninir
Copy link
Contributor

@Ninir Ninir commented Sep 6, 2017

Fixes #1594

Tests

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSAPIGatewayRestApi_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSAPIGatewayRestApi_ -timeout 120m
=== RUN   TestAccAWSAPIGatewayRestApi_basic
--- PASS: TestAccAWSAPIGatewayRestApi_basic (22.78s)
=== RUN   TestAccAWSAPIGatewayRestApi_openapi
--- PASS: TestAccAWSAPIGatewayRestApi_openapi (35.56s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	58.385s

@Ninir Ninir added the enhancement Requests to existing resources that expand the functionality or scope. label Sep 6, 2017
@Ninir Ninir force-pushed the f-apigw-binarymediatype-update branch from 95551a0 to ee02249 Compare September 6, 2017 19:04
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, I just left you a few comments of low importance there.

// Remove every binary media types. Simpler to remove and add new ones,
// since there are no replacings.
for _, v := range old {
m := v.(string)
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick, but I'd call this variable mt (assuming it means "media type").

m := v.(string)
operations = append(operations, &apigateway.PatchOperation{
Op: aws.String("remove"),
Path: aws.String(fmt.Sprintf("/%s/%s", prefix, strings.Replace(m, "/", "~1", -1))),
Copy link
Member

Choose a reason for hiding this comment

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

Do you think it's worth decoupling the escaping logic into a separate function, e.g. to structures.go? I did something very similar in the K8S provider:
hashicorp/terraform-provider-kubernetes@c2d73ca

})
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Computing the difference, instead of removing all old ones & adding all new ones would be a bit more efficient, but the user probably won't ever have too long list of types, so it probably doesn't matter too much - so feel free to ignore me.

thinking out laud 🤔

@Ninir
Copy link
Contributor Author

Ninir commented Sep 8, 2017

Just pushed changes:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSAPIGatewayRestApi_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSAPIGatewayRestApi_ -timeout 120m
=== RUN   TestAccAWSAPIGatewayRestApi_basic
--- PASS: TestAccAWSAPIGatewayRestApi_basic (104.55s)
=== RUN   TestAccAWSAPIGatewayRestApi_openapi
--- PASS: TestAccAWSAPIGatewayRestApi_openapi (95.03s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	199.619s

If it's ok for you, feel free to merge, or comment and I'll do 😄

Thanks Radek!

@radeksimko radeksimko merged commit 47c0ab7 into hashicorp:master Sep 8, 2017
nbaztec pushed a commit to nbaztec/terraform-provider-aws that referenced this pull request Sep 26, 2017
…update

resource/aws_api_gateway_rest_api: Allowed for binary media types update
@ghost
Copy link

ghost commented Apr 11, 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 11, 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding Binary Resource on API Gateway forces new resource
2 participants