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

BadRequestException: Invalid OpenAPI input #20

Open
busla opened this issue Aug 4, 2022 · 3 comments
Open

BadRequestException: Invalid OpenAPI input #20

busla opened this issue Aug 4, 2022 · 3 comments
Labels
bug 🐛 An issue with the system

Comments

@busla
Copy link

busla commented Aug 4, 2022

Describe the Bug

Terraform apply fails with the following error

╷
│ Error: error creating API Gateway specification: BadRequestException: Invalid OpenAPI input.
│ 
│   with aws_api_gateway_rest_api.this[0],
│   on main.tf line 9, in resource "aws_api_gateway_rest_api" "this":
│    9: resource "aws_api_gateway_rest_api" "this" {
│ 
╵

Expected Behavior

The OpenApi attribute is not set so it should use the default, empty object {}.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Run '....'
  3. Enter '....'
  4. See error

Screenshots

If applicable, add screenshots or logs to help explain your problem.

Environment (please complete the following information):

Anything that will help us triage the bug will help. Here are some ideas:

  • OS: Fedora
  • Version 3.6
  • Terraform apigw module version: 0.3.1

Additional Context

I am using terragrunt and I am not sure if you are willing to consider this bug report but I will include my config below regardless.

The account-settings module applies fine and returns the role_arn output.

dependency "apigw_account_settings" {
  config_path = "${get_terragrunt_dir()}/../apigw-account-settings"
  mock_outputs_allowed_terraform_commands = ["plan", "validate"]
  mock_outputs = {
    role_arn = "fake-role-arn"
  }
}

inputs = {
  stage = "test"
  stage_name =  "test"
  name = "apigw"
  tags = {
    ManagedBy    = "Terraform"
    Owner = "<masked>"
  }

  role_arn = dependency.apigw_account_settings.outputs.role_arn
  metrics_enabled = true
  xray_tracing_enabled = true
}
@busla busla added the bug 🐛 An issue with the system label Aug 4, 2022
@busla
Copy link
Author

busla commented Aug 4, 2022

Update:

If I use the OpenApi example config I am able to apply.

@drewagentsync
Copy link

We started out trying to use this module along with the tf resources to define methods and integrations. The hard requirement to provide the open api spec prevents us from doing that.

The details of how to configure the APIGW with the openapi spec in different scenarios are very poorly documented if the goal is to replicate something defined without a template (Chalice is what we're trying to replace with TF). This bug is forcing me to write my own module to get away from the OpenAPI spec file or figure out the exact format spec file needed to replicate.

It would be great if we could get an update to make supplying the template optional.

@grdw
Copy link

grdw commented Feb 27, 2024

I also struggled with this problem for a while. The key thing is to keep that openapi version attribute in the JSON (or YAML or whatever you have) to 3.0.1 and not anything else. It will raise a BadRequestException: Invalid OpenAPI input. and even if you add a Terraform trace, it will give you nothing useful debugging wise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

No branches or pull requests

3 participants