This example shows how to use !env to load an environment variable into an
API field during declarative planning and apply.
The configuration uses the env-example namespace so it stays isolated from
other declarative resources in the same Konnect organization.
api.yaml- declares a single API and reads itsdescriptionfield from theAPI_DESCRIPTIONenvironment variable
Preview the change with an inline environment variable:
API_DESCRIPTION="API description loaded from env" \
kongctl diff -f api.yamlApply the configuration:
API_DESCRIPTION="API description loaded from env" \
kongctl apply -f api.yaml --auto-approveCheck the created API:
kongctl get api env-example-api -o yamlHuman-readable diff output redacts !env values by design. Use get after
apply to confirm the resolved description value.
Delete the example resource when you are done:
API_DESCRIPTION="API description loaded from env" \
kongctl delete -f api.yaml --auto-approve