Skip to content

xcsh_api_definition (Resource)

Manages API Definition in F5 Distributed Cloud.

~> Note: For more information, see the API Definition API documentation.

# APIDefinition Resource Example
# Manages API Definition in F5 Distributed Cloud.
terraform {
required_version = ">= 1.0"
required_providers {
xcsh = {
source = "f5-sales-demo/xcsh"
version = ">= 0.1.0"
}
}
}
# Basic APIDefinition configuration
resource "xcsh_api_definition" "example" {
name = "example-api-definition"
namespace = "staging"
}

-> Syntax Rule: This provider uses OneOf groups for mutually exclusive options. Fields documented as “Optional Block” use block syntax field_name { ... }. Empty OneOf object attributes use field_name = {}; conditional selection uses condition ? {} : null. Boolean attributes (such as add_hsts and http_redirect) use = true or = false.

🔶 High Risk Operations — Some operations on this resource have high danger level. Destructive operations may require confirmation.

Required fields:

  • name
  • namespace

Example (API format):

apiVersion: v1
kind: api_definition
metadata:
name: example-api
namespace: demo-app
spec: {}

• name - Required String
Name of the API Definition. Must be unique within the namespace

• namespace - Required String
Namespace where the API Definition is created

• annotations - Optional Map
Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata

• description - Optional String
Human readable description for the object

• disable - Optional Bool
A value of true administratively disables the object

• labels - Optional Map
Labels is a user defined key value map that can be attached to resources for organization and filtering

• api_inventory_exclusion_list - Optional Block Defaults to []
List of API Endpoints excluded from the API Inventory. Server applies default when omitted
See API Inventory Exclusion List below for details.

• api_inventory_inclusion_list - Optional Block Defaults to []
List of API Endpoints included in the API Inventory. Typically, discovered API endpoints are added to the API Inventory using this list. Server applies default when omitted
See API Inventory Inclusion List below for details.

-> One of the following: • mixed_schema_origin - Optional Object
Configuration parameter for mixed schema origin

• strict_schema_origin - Optional Object Defaults to map[]
Configuration parameter for strict schema origin. Server applies default when omitted

• non_api_endpoints - Optional Block Defaults to []
API Discovery Exclusion List. List of Non-API Endpoints. Server applies default when omitted
See Non API Endpoints below for details.

• swagger_specs - Optional List Defaults to []
URLs of versioned OpenAPI files uploaded through Web App & API Protection > Files > Swagger Files. The 512-byte item limit is a URL-length limit; inline string:/// OpenAPI content is rejected and does not create an API-definition object. Server applies default when omitted

• timeouts - Optional Block
See Timeouts below for details.

In addition to all arguments above, the following attributes are exported:

• id - Optional String
Unique identifier for the resource


An api_inventory_exclusion_list block supports the following:

• method - Optional String Defaults to ANY
See HTTP Methods
Specifies the HTTP method used to access a resource. Any HTTP Method

• path - Optional String Specified in OpenAPI, including parameters
Endpoint path, as The path should comply with RFC 3986 and may have parameters according to OpenAPI specification

An api_inventory_inclusion_list block supports the following:

• method - Optional String Defaults to ANY
See HTTP Methods
Specifies the HTTP method used to access a resource. Any HTTP Method

• path - Optional String Specified in OpenAPI, including parameters
Endpoint path, as The path should comply with RFC 3986 and may have parameters according to OpenAPI specification

A mixed_schema_origin block supports the following:

A non_api_endpoints block supports the following:

• method - Optional String Defaults to ANY
See HTTP Methods
Specifies the HTTP method used to access a resource. Any HTTP Method

• path - Optional String Specified in OpenAPI, including parameters
Endpoint path, as The path should comply with RFC 3986 and may have parameters according to OpenAPI specification

A strict_schema_origin block supports the following:

A timeouts block supports the following:

• create - Optional String (Defaults to 10 minutes)
Used when creating the resource

• delete - Optional String (Defaults to 10 minutes)
Used when deleting the resource

• read - Optional String (Defaults to 5 minutes)
Used when retrieving the resource

• update - Optional String (Defaults to 10 minutes)
Used when updating the resource


The following type definitions are used throughout this resource. See the full definition here rather than repeated inline.

Object Reference {#common-object-reference}

Section titled “Object Reference {#common-object-reference}”

Object references establish a direct reference from one configuration object to another in F5 Distributed Cloud. References use the format tenant/namespace/name.

FieldTypeDescription
nameStringName of the referenced object
namespaceStringNamespace containing the referenced object
tenantStringTenant of the referenced object (system-managed)

Transformers apply transformations to input values before matching. Multiple transformers can be applied in order.

ValueDescription
LOWER_CASEConvert to lowercase
UPPER_CASEConvert to uppercase
BASE64_DECODEDecodebase64 content
NORMALIZE_PATHNormalize URL path
REMOVE_WHITESPACERemove whitespace characters
URL_DECODEDecode URL-encoded characters
TRIM_LEFTTrim leading whitespace
TRIM_RIGHTTrim trailing whitespace
TRIMTrim both leading and trailing whitespace

HTTP methods used for request matching.

ValueDescription
ANYMatch any HTTP method
GETHTTP GET request
HEADHTTP HEAD request
POSTHTTP POST request
PUTHTTP PUT request
DELETEHTTP DELETE request
CONNECTHTTP CONNECT request
OPTIONSHTTP OPTIONS request
TRACEHTTP TRACE request
PATCHHTTP PATCH request
COPYHTTP COPY request (WebDAV)

TLS Fingerprints {#common-tls-fingerprints}

Section titled “TLS Fingerprints {#common-tls-fingerprints}”

TLS fingerprint categories for malicious client detection.

ValueDescription
TLS_FINGERPRINT_NONENo fingerprint matching
ANY_MALICIOUS_FINGERPRINTMatch any known malicious fingerprint
ADWAREAdware-associated fingerprints
DRIDEXDridex malware fingerprints
GOOTKITGootkit malware fingerprints
RANSOMWARERansomware-associated fingerprints
TRICKBOTTrickbot malware fingerprints

IP Threat Categories {#common-ip-threat-categories}

Section titled “IP Threat Categories {#common-ip-threat-categories}”

IP address threat categories for security filtering.

ValueDescription
SPAM_SOURCESKnown spam sources
WINDOWS_EXPLOITSWindows exploit sources
WEB_ATTACKSWeb attack sources
BOTNETSKnown botnet IPs
SCANNERSNetwork scanner IPs
REPUTATIONPoor reputation IPs
PHISHINGPhishing-related IPs
PROXYAnonymous proxy IPs
MOBILE_THREATSMobile threat sources
TOR_PROXYTor exit nodes
DENIAL_OF_SERVICEDoS attack sources
NETWORKKnown bad network ranges

Import is supported using the following syntax:

Terminal window
# Import using namespace/name format
terraform import xcsh_api_definition.example system/example