-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Feature/apigateway authorization scopes #4533
Feature/apigateway authorization scopes #4533
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the below and let us know if you have any questions!
@@ -51,6 +51,12 @@ func resourceAwsApiGatewayMethod() *schema.Resource { | |||
Optional: true, | |||
}, | |||
|
|||
"authorization_scopes": &schema.Schema{ | |||
Type: schema.TypeList, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the ordering matter for this attribute? If not, we can use schema.TypeSet
which has some nice helpers for doing set differences. See also: https://www.terraform.io/docs/extend/schemas/schema-types.html#typeset
@@ -165,6 +175,7 @@ func resourceAwsApiGatewayMethodRead(d *schema.ResourceData, meta interface{}) e | |||
d.Set("api_key_required", out.ApiKeyRequired) | |||
d.Set("authorization", out.AuthorizationType) | |||
d.Set("authorizer_id", out.AuthorizerId) | |||
d.Set("authorization_scopes", out.AuthorizationScopes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When setting non-scalar attributes, we should perform error checking:
if err := d.Set("authorization_scopes", out.AUthorizationScopes); err != nil {
return fmt.Errorf("error setting authorization_scopes: %s", err)
}
old := o.([]interface{}) | ||
new := n.([]interface{}) | ||
|
||
// Remove every authorization scope. Simpler to remove and add new ones, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note here: If we switch this to schema.TypeSet
, there are some set difference functions available: https://godoc.org/github.com/hashicorp/terraform/helper/schema#Set.Difference
It seems like we should try to reduce any downtime associated with updating these if possible.
@tomjanne did you see the feedback above or have any questions? |
@bflad sorry for the delay. i am currently working on a new version. Maybe i can update the pull-request today/tomorrow. |
Output from Acceptance-Test:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, @tomjanne! 🚀
make testacc TEST=./aws TESTARGS='-run=TestAccAWSAPIGatewayMethod'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSAPIGatewayMethod -timeout 120m
=== RUN TestAccAWSAPIGatewayMethodResponse_basic
--- PASS: TestAccAWSAPIGatewayMethodResponse_basic (26.95s)
=== RUN TestAccAWSAPIGatewayMethodSettings_basic
--- PASS: TestAccAWSAPIGatewayMethodSettings_basic (39.75s)
=== RUN TestAccAWSAPIGatewayMethod_basic
--- PASS: TestAccAWSAPIGatewayMethod_basic (23.99s)
=== RUN TestAccAWSAPIGatewayMethod_customauthorizer
--- PASS: TestAccAWSAPIGatewayMethod_customauthorizer (35.65s)
=== RUN TestAccAWSAPIGatewayMethod_cognitoauthorizer
--- PASS: TestAccAWSAPIGatewayMethod_cognitoauthorizer (26.38s)
=== RUN TestAccAWSAPIGatewayMethod_customrequestvalidator
--- PASS: TestAccAWSAPIGatewayMethod_customrequestvalidator (37.80s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 190.575s
This has been released in version 1.22.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
…y-method Fix documentaion on API Gateway method introduced by #4533
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! |
Fixes #4532