Marc
Marc

Reputation: 704

Exporting openAPI specification with terraform + apigateway + AWS?

I'd like to export my aws gateway api as a openapi documentation.

I see there is a module for that in the terraform aws documentation:

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/apigatewayv2_export

However, I do not understand how this is actually used? The attribute references are ID and body, where the body is ID of the API..

Should there not be a output path? How do you export the openapi documentation from terraform when using api gateway?

Upvotes: 1

Views: 154

Answers (1)

Mark B
Mark B

Reputation: 200960

I think the documentation for that data source is wrong. I think id is almost certainly the "ID of the API" and body is probably the JSON or YAML output, which you would then use along with a local_file resource if you want to write that to a file.

I suggest testing that, and at least create a temporary Terraform output from the body attribute to see what is actually in there. If the body is actually the JSON or YAML output, then I would ask that you please file a ticket with HashiCorp to correct the documentation.

Upvotes: 1

Related Questions