OpenAPI
Hello. Just a note to let you know the underlying API on which this data source is built is general release and has been vetted, but because this is a new feature for our Terraform provider, we've given it beta label.
This status just means we've paused for a bit to get your feedback to make sure this data source works like you need and expect.
Convert your JSON or YAML OpenAPI schema file to Akamai API endpoint JSON.
Run terraform plan
or terraform validate
to check the structure of your schema file and terraform apply
to get the converted schema into your state file.
Use the returned api
attribute as a local variable in the api resource to register your API.
data "akamai_apidefinitions_openapi" "my_api" {
file_path = "./my-api-schema.json"
}
output "my_api" {
value = data.akamai_apidefinitions_openapi.my_api
}
my_schema = {
api = jsonencode(
{
enableApiGateway = true
hostnames = [
"my_api_definition.com",
]
matchCaseSensitive = true
name = "Pet Store"
resources = {
"/pets" = {
description = <<-EOT
GET: List all pets
POST: Create a pet
EOT
get = {
parameters = [
{
description = "How many items to return at one time (max 100)."
in = "query"
maximum = 1000
name = "limit"
type = "integer"
},
]
}
name = "/pets"
post = {
requestBody = {
json = {
name = "Pet"
properties = [
{
name = "id"
required = true
type = "integer"
},
{
name = "name"
required = true
type = "string"
},
{
name = "tag"
type = "string"
},
]
required = true
type = "object"
}
}
}
}
}
}
)
api_file_name = null
file_path = "./my-openapi.yml"
}
// local
api = data.akamai_apidefinitions_openapi.myapi.api
Argument
Pass a full or relative path to your API collection's schema.
Argument | Required | Description |
---|---|---|
file_path | ✔️ | The full or relative path to your flattened OpenAPI schema file. Schema can be JSON or YAML. |
api_file_name | The root file name for a compressed file. | |
api | JSON-formatted information about your API configuration. |
Attributes
There is no standard output for this resource. Changes are reflected in your state file.
Attribute | Description |
---|---|
api | The JSON-formatted conversion of your OpenAPI schema returned from the API Definitions data source. Contains:
|
file_path | The path to your API file. |
api_file_name | The root file name for a compressed file. |
Updated 14 days ago