📘

Hello. Just a note to let you know the underlying API on which this resource 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 resource works like you need and expect.

Register your API endpoint.

  • Use the akamai_apidefinitions_openapi data source to reformat your OpenAPI schema to Akamai JSON.
  • Construct Akamai JSON yourself and provide a pointer to the schema file. See the Akamai JSON schema for formatting.
resource "akamai_apidefinitions_api" "my_api" {
  api         = data.akamai_apidefinitions_openapi.my_api.api
  contract_id = "C-0N7RAC7"
  group_id    = 12345
}
components:
  schemas:
    Definition:
      type: object
      additionalProperties: false // This object cannot be extended with additional properties.
      properties:
        id: // Your API's ID. Known on creation. Send empty on create. Provide a value for update.
          type: integer
        basePath: // The base path for your resources.
          type: string
        constraints: // A list of request and response constraint types and their enablement statuses.
          $ref: "#/components/schemas/Constraints"
        contractId: // Your contract ID.
          type: string
        groupId: // Your group ID.
          type: integer
        description: // A human-readable statement about your API.
          type: string
        enableApiGateway: // Enables the API Gateway product. Default is true.
          type: boolean
        hostnames: // A list of hostnames for your API.
          type: array
          items:
            type: string
        graphQl: // Is the API GraphQL.
          type: boolean
        matchCaseSensitive: // Values sent have to match the case you provide.
          type: boolean
        matchPathSegmentParameter: // Include path segment parameters in match criteria. Defaults is true.
          type: boolean
        name: // The name of your API.
          type: string
        resources: // Your endpoints' details.
          "$ref": "#/components/schemas/Resources"
        securitySchemes: // The key with which users access the endpoint.
          type: object
          additionalProperties: false // This object cannot be extended with additional properties.
          properties:
            apiKey: // Details about the API key.
              type: object
              properties:
                in: //
                  type: string
                  enum:
                    - cookie
                    - header
                    - query
                name: // The name of the header, query parameter, or cookie for the API key.
                  type: string
        tags: // A list of tags used by the OpenAPI Description with additional metadata.
          type: array
          items:
            type: string
        version: // Your API's version.
          type: integer
        versioning: // Details about your API's version.
          type: object
          additionalProperties: false // This object cannot be extended with additional properties.
          properties:
            in:
              type: string
              enum:
                - header
                - path
                - query
            name: // The name of the header or query parameter that includes the API version value.
              type: string
            value: // The expected API version value in an incoming request.
              type: string
    Constraints:
      type: object
      additionalProperties: false // This object cannot be extended with additional properties.
      properties:
        enforceOn: // Enables API constraints.
          additionalProperties: false // This object cannot be extended with additional properties.
          type: object
          properties:
            request: // Apply constraints to your API requests.
              type: boolean
            response: // Apply constraints to your API responses.
              type: boolean
            undefinedMethods:
              type: object
              additionalProperties: false // This object cannot be extended with additional properties.
              properties: // The API's methods.
                get:
                  type: boolean
                post:
                  type: boolean
                put:
                  type: boolean
                head:
                  type: boolean
                options:
                  type: boolean
                delete:
                  type: boolean
                patch:
                  type: boolean
            undefinedParameters: // Allow undefined parameters in a given location.
              type: object
              additionalProperties: false // This object cannot be extended with additional properties.
              properties:
                requestCookie:
                  type: boolean
                requestHeader:
                  type: boolean
                requestQuery:
                  type: boolean
                requestBody:
                  type: boolean
                responseHeader:
                  type: boolean
                responseBody:
                  type: boolean
        requestBody:
          type: object
          additionalProperties: false // This object cannot be extended with additional properties.
          properties:
            consumeType: // The content type the endpoint exchanges, either json, xml, urlencoded, or any for any other type of exchange.
              type: array
              items:
                type: string
                enum:
                  - json
                  - xml
                  - urlencoded
                  - any
            maxContentLength: // The upper bound for content length.
              type: integer
            maxNestingDepth: // The number of nested levels. Max allowable using Terraform is 10.
              type: integer
            properties:
              type: object
              properties:
                maxStringLength: // The upper bounds for a string value.
                  type: integer
                maxIntegerValue: // The upper bounds for an integer value.
                  type: integer
                maxCount: // The total number of allowed XML elements, JSON object keys, or array items allowed in a request body.
                  type: integer
                maxNameLength: The maximum length of an XML element name or JSON object key name allowed in a request body.
                  type: integer
    MethodConstraints: // The constraints on your API's methods.
      type: object
      additionalProperties: false // This object cannot be extended with additional properties.
      properties:
        enforceOn: // Enables method constraints.
          additionalProperties: false // This object cannot be extended with additional properties.
          type: object
          properties:
            undefinedParameters: Allow undefined parameters in a given location.
              type: object
              additionalProperties: false // This object cannot be extended with additional properties.
              properties:
                requestCookie:
                  type: boolean
                requestHeader:
                  type: boolean
                requestQuery:
                  type: boolean
                requestBody:
                  type: boolean
                responseHeader:
                  type: boolean
                responseBody:
                  type: boolean
    Resources: // The data or objects accessed through the URI.
      type: object
      additionalProperties: // The object's extended properties.
        "$ref": "#/components/schemas/Resource"
    Resource: // Endpoint details.
      type: object
      additionalProperties: false // This object cannot be extended with additional properties.
      properties: // Details about the resource.
        name: // The name of an endpoint.
          type: string
        description: // The endpoint's description.
          type: string
        parameters: // A list of the resource's parameters.
          type: array
          items:
            "$ref": "#/components/schemas/Parameter"
        get:
          "$ref": "#/components/schemas/Method"
        put:
          "$ref": "#/components/schemas/Method"
        post:
          "$ref": "#/components/schemas/Method"
        delete:
          "$ref": "#/components/schemas/Method"
        options:
          "$ref": "#/components/schemas/Method"
        head:
          "$ref": "#/components/schemas/Method"
        patch:
          "$ref": "#/components/schemas/Method"
    Method:
      type: object
      additionalProperties: false // This object cannot be extended with additional properties.
      properties: // Details about the endpoint.
        parameters: // A list of the endpoint's parameters.
          type: array
          items:
            "$ref": "#/components/schemas/Parameter"
        requestBody: // Settings for the endpoint's request.
          type: object
          properties: // The request's exchange type and details.
            json:
              "$ref": "#/components/schemas/Property"
            json/xml:
              "$ref": "#/components/schemas/Property"
            xml:
              "$ref": "#/components/schemas/Property"
            urlencoded:
              "$ref": "#/components/schemas/Property"
        constraints: // A list of any endpoint constraints.
          "$ref": "#/components/schemas/MethodConstraints"
        responses: // Details about possible responses to the request.
          type: object
          additionalProperties: false // This object cannot be extended with additional properties.
          properties: // Details about the response.
            headers: // Which headers to return.
              type: array
              items:
                "$ref": "#/components/schemas/Parameter"
            contents: // The contents of the response.
              type: array
              items:
                type: object
                properties: The exchange type for information in the response.
                  json:
                    "$ref": "#/components/schemas/Property"
                  json/xml:
                    "$ref": "#/components/schemas/Property"
                  xml:
                    "$ref": "#/components/schemas/Property"
                  urlencoded:
                    "$ref": "#/components/schemas/Property"
                  none:
                    "$ref": "#/components/schemas/Property"
                  any:
                    "$ref": "#/components/schemas/Property"
                  statusCodes: // The HTTP status codes relative to the endpoint.
                    type: array
                    items:
                      type: integer

    Parameter:
      type: object
      additionalProperties: false // This object cannot be extended with additional properties.
      properties: // Details about an operation's parameters.
        description: // A human-readable description about the parameter that helps a user understand what it's for or does.
          type: string
        in: // Where the parameter is located.
          type: string
          enum:
            - query
            - header
            - cookie
            - path
        maxLength: // The maximum length of the value.
          type: integer
        maximum: // The double precision (64bit) floating point maximum value.
          type: number
          format: double
        minLength: // The minimum length of the value.
          type: integer
        minimum: // The double precision (64bit) floating point minimum value.
          type: number
          format: double
        name: // The parameter's name.
          type: string
        required: // Requirement status of the parameter.
          type: boolean
        type: // The parameter's type.
          type: string
          enum:
            - string
            - number
            - integer
            - boolean
    Property:
      type: object
      additionalProperties: false // This object cannot be extended with additional properties.
      properties:
        description:
          type: string
        items:
          "$ref": "#/components/schemas/Property"
        maxBodySize: // The maximum allowable size of a request or response body.
          type: string
          enum:
            - 6KB
            - 8KB
            - 12KB
            - 16KB
        maxItems: // The maximum number of items allowed in a request or response body.
          type: integer
        maxLength: // The maximum length of string values.
          type: integer
        maximum: The double precision (64bit) floating point maximum value.
          type: number
          format: double
        minItems: The minimum number of items required in a request or response body.
          type: integer
        minLength:
          type: integer
        minimum: The double precision (64bit) floating point minimum value.
          type: number
          format: double
        name: // A property's name.
          type: string
        properties: // A list of body properties.
          type: array
          items:
            "$ref": "#/components/schemas/Property"
        required: // Requirement status.
          type: boolean
        type: // A property's type.
          type: string
          enum:
            - string
            - number
            - integer
            - boolean
            - array
            - object
// local
api_id = data.akamai_apidefinitions_api.myapi.id

Arguments

Provide your contract and group IDs and create a local variable to the API Definitions data source.

ArgumentRequiredDescription
api✔️Either a local variable pointing to the api attribute of the akamai_apidefinitions_openapi data source or a pointer to your Akamai JSON formatted API schema.

To format your API yourself, see the Akamai JSON schema sample tab.
contract_id✔️Your contract ID.
group_id✔️Your group ID.

Attributes

There is no standard output for this resource. Changes are reflected in your state file.

AttributeDescription
apiThe JSON-formatted conversion of your OpenAPI schema returned from the API Definitions data source. Contains:
  • name. Your API's name.
  • hostnames. Your API's root path.
  • matchCaseSensitive. Values sent have to match the case you provide.
  • enableApiGateway. Enablement status of the API Gateway product. Default is true.
  • resources. Information about each of your resources.
  • basePath. The base path for your resources.
  • tags. A list of tags used by the OpenAPI Description with additional metadata.
  • description. A human-readable statement about your API.
  • matchPathSegmentParameter. Path segment parameters included in match criteria. Defaults is true.
  • graphQl. If the API uses GraphQL to provide data.
  • securitySchemes. Details about the key with which users access the endpoint.
  • constraints. A list of constraints on the API.
  • versioning. Information about your API's version.
contract_idYour contract ID.
group_idYour group ID.
idYour API's ID
latest_versionThe version number for the latest created version of your API. This version may or may not be active.
production_versionThe version number for the activated API version in the production environment.
staging_versionThe version number for the activated API version in the staging environment.