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

r/aws_apigatewayv2_stage: Perpetual diff when 'auto_deploy = true' #13633

Closed
ewbankkit opened this issue Jun 5, 2020 · 5 comments · Fixed by #13644
Closed

r/aws_apigatewayv2_stage: Perpetual diff when 'auto_deploy = true' #13633

ewbankkit opened this issue Jun 5, 2020 · 5 comments · Fixed by #13644
Assignees
Labels
service/apigatewayv2 Issues and PRs that pertain to the apigatewayv2 service.
Milestone

Comments

@ewbankkit
Copy link
Contributor

ewbankkit commented Jun 5, 2020

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

AWS Provider v2.65.0.

Affected Resource(s)

  • aws_apigatewayv2_stage

Terraform Configuration Files

From #13625:

resource "aws_apigatewayv2_api" "sc_api" {
  name          = "lambda-sc-kicker-api"
  protocol_type = "HTTP"
}

# TODO: There is something weird about this integration.
# After this resource is deployed, detach it and then re-attach it in the console and it works fine.
# Must be some kind of missing property.
resource "aws_apigatewayv2_integration" "sc_api_integration" {
  api_id           = aws_apigatewayv2_api.sc_api.id
  integration_type = "AWS_PROXY"

  description            = "Lambda SC Kicker"
  integration_method     = "POST"
  integration_uri        = module.lambda_sc_kicker.lambda_sc_kicker_invoke_arn
  payload_format_version = "2.0"
}

resource "aws_apigatewayv2_route" "sc_api_create_route" {
  api_id    = aws_apigatewayv2_api.sc_api.id
  route_key = "POST /create"
  target    = "integrations/${aws_apigatewayv2_integration.sc_api_integration.id}"
}

resource "aws_apigatewayv2_stage" "sc_api_default_stage" {
  api_id      = aws_apigatewayv2_api.sc_api.id
  name        = "$default"
  auto_deploy = true
}

Expected Behavior

After successful terraform apply, terraform plan should show no diffs.

Actual Behavior

Perpetual diff:

  # aws_apigatewayv2_stage.sc_api_default_stage will be updated in-place
  ~ resource "aws_apigatewayv2_stage" "sc_api_default_stage" {
        api_id          = "ekmqhtlds3"
        arn             = "arn:aws:apigateway:us-west-2::/apis/ekmqhtlds3/stages/$default"
        auto_deploy     = true
      - deployment_id   = "y2dz0a" -> null
        id              = "$default"
        invoke_url      = "https://ekmqhtlds3.execute-api.us-west-2.amazonaws.com/"
        name            = "$default"
        stage_variables = {}
        tags            = {}

        default_route_settings {
            data_trace_enabled       = false
            detailed_metrics_enabled = false
            throttling_burst_limit   = 0
            throttling_rate_limit    = 0
        }
    }

Important Factoids

The problem is not handling a computed deployment_id when auto_deploy = true.

@ghost ghost added the service/apigatewayv2 Issues and PRs that pertain to the apigatewayv2 service. label Jun 5, 2020
@ewbankkit ewbankkit self-assigned this Jun 5, 2020
@bvaradinov-c
Copy link

We see the same behavior.

@lxg
Copy link

lxg commented Jun 23, 2020

But is this really a bug? AWS itself does assign a new ID on each deployment. If you make a new deployment, you get a new ID for the current deployment, and your state is updated.

@ewbankkit
Copy link
Contributor Author

@lxg You are correct that in the case of auto_deploy stages the deployment is not managed by Terraform. We do not need the stage to try and update the deployment ID in these cases and so want to mark the deployment_id as Computed.

@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 22, 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 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/apigatewayv2 Issues and PRs that pertain to the apigatewayv2 service.
Projects
None yet
4 participants