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

Api gateway authorizer authorizer_result_ttl_in_seconds is not set to 0 on first run #12633

Closed
kevinkuszyk opened this issue Apr 2, 2020 · 4 comments · Fixed by #12643
Closed
Labels
bug Addresses a defect in current functionality. service/apigateway Issues and PRs that pertain to the apigateway service.
Milestone

Comments

@kevinkuszyk
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.12.24
+ provider.aws v2.55.0

Affected Resource(s)

  • aws_api_gateway_authorizer.api_authorizer

Terraform Configuration Files

resource "aws_api_gateway_authorizer" "api_authorizer" {
  name                             = "authorizer"
  rest_api_id                      = aws_api_gateway_rest_api.api.id
  authorizer_uri                   = aws_lambda_function.authorizer.invoke_arn
  authorizer_credentials           = aws_iam_role.api_authorizer.arn
  type                             = "REQUEST"
  authorizer_result_ttl_in_seconds = 0
}

There is a repo here with the full source:
https:/kevinkuszyk/terraform-aws-apigateway-authorizer-cache

Expected Behavior

I was expecting the authorizer to be created with the authorizer_result_ttl_in_seconds set to zero.

Actual Behavior

It doesn't seem to be set. It shows like this in the aws console:

Screenshot 2020-04-02 at 15 56 40

And a terraform plan after applying the config gives this (300 is the default value):

  # aws_api_gateway_authorizer.api_authorizer will be updated in-place
  ~ resource "aws_api_gateway_authorizer" "api_authorizer" {
        authorizer_credentials           = "arn:aws:iam::************:role/api-authorizer"
      ~ authorizer_result_ttl_in_seconds = 300 -> 0
        authorizer_uri                   = "arn:aws:apigateway:eu-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-2:************::function:authorizer/invocations"
        id                               = "7q1ebw"
        identity_source                  = "method.request.header.Authorization"
        name                             = "authorizer"
        provider_arns                    = []
        rest_api_id                      = "gdrd3ai27a"
        type                             = "REQUEST"
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Running terraform apply again will make the change, so it appears to be an issue with creating new resources.

Steps to Reproduce

  1. Clone my example repo
  2. Run terraform apply
  3. Run terraform plan

References

Other notes

I would attempt a fix, but I can't see anything wrong in the code. If someone can provide some guidance I will do what I can.

@ghost ghost added the service/apigateway Issues and PRs that pertain to the apigateway service. label Apr 2, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Apr 2, 2020
@kevinkuszyk
Copy link
Author

I've done some testing with the aws cli this morning and i can recreate this issue in the aws console by not setting the authorizerResultTtlInSeconds property in my cli command.

/cc @DrFaust92

@anGie44 anGie44 added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 24, 2020
@anGie44 anGie44 added this to the v3.0.0 milestone Jul 27, 2020
@anGie44
Copy link
Contributor

anGie44 commented Jul 27, 2020

Fix has been merged and will release with upcoming v3.0.0 of the AWS Terraform Provider

@ghost
Copy link

ghost commented Jul 31, 2020

This has been released in version 3.0.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!

@ghost
Copy link

ghost commented Aug 26, 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 Aug 26, 2020
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. service/apigateway Issues and PRs that pertain to the apigateway service.
Projects
None yet
2 participants