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

Feature/apigateway authorization scopes #4533

Merged
merged 3 commits into from
Jun 4, 2018
Merged

Feature/apigateway authorization scopes #4533

merged 3 commits into from
Jun 4, 2018

Conversation

tomjanne
Copy link
Contributor

Fixes #4532

@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label May 14, 2018
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/apigateway Issues and PRs that pertain to the apigateway service. labels May 14, 2018
Copy link
Contributor

@bflad bflad left a 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,
Copy link
Contributor

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)
Copy link
Contributor

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,
Copy link
Contributor

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.

@bflad
Copy link
Contributor

bflad commented Jun 2, 2018

@tomjanne did you see the feedback above or have any questions?

@tomjanne
Copy link
Contributor Author

tomjanne commented Jun 4, 2018

@bflad sorry for the delay. i am currently working on a new version. Maybe i can update the pull-request today/tomorrow.

@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Jun 4, 2018
@tomjanne
Copy link
Contributor Author

tomjanne commented Jun 4, 2018

Output from Acceptance-Test:

$make testacc TESTARGS='-run=TestAccAWSAPIGatewayMethod_cognitoauthorizer' ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./... -v -run=TestAccAWSAPIGatewayMethod_cognitoauthorizer -timeout 120m ? github.com/terraform-providers/terraform-provider-aws [no test files] === RUN TestAccAWSAPIGatewayMethod_cognitoauthorizer --- PASS: TestAccAWSAPIGatewayMethod_cognitoauthorizer (63.56s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 63.655s

@bflad bflad added this to the v1.22.0 milestone Jun 4, 2018
Copy link
Contributor

@bflad bflad left a 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

@bflad bflad merged commit cdbbf2e into hashicorp:master Jun 4, 2018
bflad added a commit that referenced this pull request Jun 4, 2018
@bflad
Copy link
Contributor

bflad commented Jun 5, 2018

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.

bflad added a commit that referenced this pull request Jun 6, 2018
…y-method

Fix documentaion on API Gateway method introduced by #4533
@ghost
Copy link

ghost commented Apr 5, 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 5, 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/apigateway Issues and PRs that pertain to the apigateway service. size/L Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

api_gateway_method authorization_scopes
2 participants