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

[Bug]: aws_apigatewayv2_api domain name: Provider produced inconsistent final plan #29805

Open
krzysztofdrys opened this issue Mar 6, 2023 · 2 comments
Labels
bug Addresses a defect in current functionality. service/apigatewayv2 Issues and PRs that pertain to the apigatewayv2 service.

Comments

@krzysztofdrys
Copy link

krzysztofdrys commented Mar 6, 2023

Terraform Core Version

v1.3.4

AWS Provider Version

v4.56.0

Affected Resource(s)

aws_apigatewayv2_domain_name

Expected Behavior

Domain name should be created

Actual Behavior

Domain name is not created

Relevant Error/Panic Output Snippet

╷
│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for aws_apigatewayv2_domain_name.this to include new values learned so far during apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for .domain_name: was
│ cty.StringVal("[REDACTED URL]"), but now cty.StringVal("Example Pet Store").
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Terraform Configuration Files

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "4.56.0"
    }
  }
}

variable "name" {}

variable "certificate_arn" {}

provider "aws" {
  region = "eu-west-1"
}

data "local_file" "openapi" {
  filename = "${path.module}/openapi.yaml"
}

# Stage and deployment
resource "aws_apigatewayv2_api" "this" {
  name          = var.name
  protocol_type = "HTTP"
  body          = data.local_file.openapi.content

  fail_on_warnings = true
}

resource "aws_apigatewayv2_domain_name" "this" {
  domain_name = aws_apigatewayv2_api.this.name

  domain_name_configuration {
    certificate_arn = var.certificate_arn
    endpoint_type   = "REGIONAL"
    security_policy = "TLS_1_2"
  }
}

local_file is OpenAPI 3.0 definition take from here https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-open-api.html

Steps to Reproduce

export TF_VAR_name="[REDACTED URL]"
export TF_VAR_certificate_arn="[valid arn]"

rm -rf .terraform
rm .terraform.lock.hcl
terraform init -input=false
terraform plan --out tfplan
terraform apply tfplan

Debug Output

tf_plan.log: https://gist.github.com/krzysztofdrys/93d57e83ac25f874eaaf8a8ae79df7a1
tf_apply.log: https://gist.github.com/krzysztofdrys/ed543eae5d25bc5b874d59faf1dd8e89

Panic Output

No response

Important Factoids

If you change provider version 4.46.0, terraform apply succeeds without any problems.

References

No response

Would you like to implement a fix?

Yes

@krzysztofdrys krzysztofdrys added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Mar 6, 2023
@github-actions
Copy link

github-actions bot commented Mar 6, 2023

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/apigatewayv2 Issues and PRs that pertain to the apigatewayv2 service. label Mar 6, 2023
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Mar 6, 2023
@Woody1193
Copy link

Is there any update on this? Have encountered same with provider version 5.22 and 5.52. Have also attempted to remedy by replacing triggers with depends_on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/apigatewayv2 Issues and PRs that pertain to the apigatewayv2 service.
Projects
None yet
Development

No branches or pull requests

3 participants