Terraform for Konnect
Goal
Author and maintain Konnect resources in HCL using the official Terraform
provider while preserving the repository's existing module, state, and CI
conventions.
Use this skill for Terraform-managed Konnect work. Do not turn a kongctl or
decK repository into Terraform unless the user asks for that migration. Do
not treat this skill as the owner for generic backend, state-locking, or
provider-install issues unless they directly block Konnect resource work.
Tool Positioning
- Use the shared
kong-konnect MCP server first for live Konnect inspection
when the requested change depends on current state and MCP is available.
- Use this skill when the repository already uses Terraform for Konnect or the
user explicitly asks for HCL, Terraform Cloud, plan/apply, or provider-based
management.
- Preserve existing Terraform layout, backend configuration, module structure,
and variable conventions.
- Prefer the official
kong/konnect provider by default and treat
kong/konnect-beta as an explicit exception for missing coverage.
- Hand off to
deck-gateway when the user wants file-based Gateway GitOps or
decK export/diff workflows.
- Hand off to
kongctl-declarative when the repository already uses kongctl
YAML instead of HCL.
- Hand off to the relevant Konnect domain skill when the main problem is access,
publication, runtime health, or another product diagnosis rather than HCL
ownership.
References To Load
Load only the reference file that matches the active branch:
references/provider-selection.md
- Load when deciding whether the official
kong/konnect provider is enough
or whether the user explicitly needs kong/konnect-beta.
references/import-moved-and-adoption.md
- Load when existing Konnect resources must be normalized into Terraform
state rather than recreated.
references/module-boundaries.md
- Load when the main question is where a new Konnect resource belongs in an
existing Terraform layout.
references/gateway-entities-inside-konnect.md
- Load when the task mixes Konnect platform resources with Gateway entities
inside a Konnect control plane.
references/provider-schema-debugging.md
- Load when nested resource shape is unclear, validation reports
object-vs-string or similar type mismatches, or provider behavior does not
line up cleanly with docs or example HCL.
Validation Contract
Preflight
Before writing HCL or proposing a plan:
- Confirm Terraform is installed and runnable:
terraform version
- Confirm the repo's backend and workspace expectations before editing files
- Confirm Konnect auth is already supplied through secure variables, not
checked-in literals
- Inspect existing provider blocks, modules, and variable names before writing
new HCL
- Confirm which module, workspace, and resource addresses own the target
Konnect slice
- Confirm whether existing live resources must be imported before planning
- Use
terraform providers schema -json as the default source of truth when
nested resource shape is unclear before guessing from docs or examples
Preview
Use Terraform's native preview surface before apply:
- run
terraform fmt -check only when the repository uses that convention for
validation
- run
terraform validate
- run
terraform plan
- import first when live resources already exist in scope and should be brought
under state instead of recreated
- check the exact addresses, module boundaries, and create-update-destroy shape
before considering apply
Execute
- Describe the intended effect before any mutating command.
- Run
terraform apply only when the user explicitly asked for live mutation.
- Apply the same workspace, variable set, and module boundary already previewed
in
plan.
Prove
After a requested apply:
- confirm the planned addresses match the intended ownership boundary
- use Terraform-native proof such as
terraform state list,
terraform state show <address>, relevant outputs, or a follow-up
terraform plan that shows no remaining intended changes
- prove the exact resources touched rather than treating apply success as proof
Operating Rules
- Preserve the repo's existing Terraform style: root-module layout, child
modules, variable files, naming, and output shape.
- Keep Konnect credentials in the repo's existing secret path such as
KONNECT_TOKEN, KONNECT_SPAT, or workspace-managed variables; never add
committed literals to .tf files.
- Use
terraform providers schema -json as the default source of truth for
unknown nested resource shape before guessing HCL from docs or examples.
- Prefer
terraform plan before terraform apply unless the user explicitly
requests direct execution.
- If
terraform providers schema -json, provider startup, terraform validate,
or terraform plan fails in a way that suggests sandbox interference,
retry outside the sandbox with approval before treating it as a provider,
auth, or schema problem.
- Treat Terraform state as authoritative for what it manages. Do not recreate
resources that should be imported or adopted.
- Keep Gateway entities and surrounding Konnect platform resources in the same
Terraform approach only when the repository already does so or the user wants
that composition.
- When the repository already manages only part of Konnect in Terraform, follow
that boundary instead of broadening scope casually.
- Preserve imports,
moved blocks, and module addresses when refactoring.
- Avoid mixing one-off UI edits with Terraform-managed resources without
calling out drift.
- Do not treat a successful
terraform apply as proof by itself; follow with
state or plan-based verification of the touched addresses.
Workflow
1. Inspect the Terraform shape
Identify:
- root modules and child modules
- provider aliases and version constraints
- backend configuration and workspace selection
- variable conventions and secrets handling
- whether Konnect resources are already organized by environment, team, or
control plane
Match the existing shape before adding resources.
2. Confirm the Konnect scope
Pin down:
- which Konnect product surface is in scope
- whether the task concerns platform resources, Gateway entities inside a
Konnect control plane, or both
- whether the request is create, update, import, or drift correction
- whether the repo already manages this Konnect slice in Terraform or the user
is explicitly choosing Terraform as the implementation path
Do not assume every requested resource belongs in the same module.
Load references/module-boundaries.md if ownership between modules,
environments, or product slices is unclear.
Load references/provider-schema-debugging.md when resource shape is the main
uncertainty.
3. Preview the intended change
Default paths:
- new managed resource: author HCL in the existing module layout
- existing unmanaged resource: prefer import or adoption over recreation
- repo migration from live Gateway entities: use
deck file kong2tf as the
default starting point when Gateway config already exists in decK or live
Gateway state
- beta-only feature: use
kong/konnect-beta only when explicitly required
Use references/provider-selection.md for provider choice and
references/import-moved-and-adoption.md for state-normalization work.
When HCL shape is unclear, inspect terraform providers schema -json before
guessing block or attribute structure.
Preview expectations:
- use
terraform fmt -check only when the repo expects it
- run
terraform validate
- run
terraform plan
- inspect whether the plan touches only the intended module and addresses
- import first if the plan would recreate something that already exists live
4. Author HCL with stable ownership boundaries
When writing HCL:
- keep related resources grouped by the repository's current convention
- reuse variables and locals rather than duplicating environment-specific
literals
- preserve stable names and identifiers where the repo already has them
- add outputs only when downstream modules or CI actually need them
Load references/gateway-entities-inside-konnect.md when Gateway entities and
platform resources might belong in different parts of the repo.
5. Execute only when requested
- Describe the intended live effect before presenting or running
terraform apply.
- Use the same workspace, variable set, and directory that produced the
reviewed plan.
- Run
terraform apply only when the user explicitly asked to mutate live
Konnect state.
6. Prove the result with Terraform-native checks
After any requested terraform apply:
- confirm the touched resource addresses now appear in
terraform state list
- inspect key addresses with
terraform state show <address> or the repo's
normal output surface
- when practical, run a follow-up
terraform plan and expect no remaining
intended changes for the touched slice
- call out any drift or ownership mismatch instead of hiding it behind apply
success
7. Report both config and state impact
State:
- which files or modules changed
- which Konnect resources are managed or updated
- whether import is required
- whether the next step is
plan, apply, or a separate verification step
Kong-Specific Gotchas
kong/konnect is the default supported provider; beta coverage should be an
explicit exception, not the baseline.
- Recreating an existing Konnect resource in Terraform instead of importing it
can cause avoidable churn and broken references.
- A repository may manage Gateway entities in Terraform while still inspecting
live state through MCP or
kongctl; those are complementary, not conflicting.
- Generated
kong2tf output is a starting point, not a guarantee that the HCL
matches repo style or ownership boundaries.
- If the repo already standardizes on
kongctl YAML or decK, forcing HCL is
usually the wrong move unless migration is the task.
Validation Checklist
Before answering, verify that you can state:
- why Terraform is the right tool for this repository or request
- whether
kong/konnect or kong/konnect-beta is actually needed
- which module or file owns the target resources
- whether import or adoption is required
- which preview commands prove the intended change before mutation
- whether provider schema inspection is needed before guessing nested HCL shape
- whether the change should stop at HCL authoring or continue to
plan/apply
- how the exact resource addresses will be proved after apply
- whether another tool skill should own the implementation instead
Handoffs
- Use
deck-gateway when the user wants Gateway-entity GitOps through decK
rather than Terraform state.
- Use
kongctl-declarative when the repository already uses kongctl YAML for
Konnect changes.
- Use
konnect-access-scope, konnect-api-publish, konnect-gateway-triage,
or other domain skills when the user first needs diagnosis of the Konnect
problem rather than HCL authoring.
Source: johnharris85/kong-skills — distributed by TomeVault.
1---2name: terraform-konnect3description: Use when a repo already manages Konnect in Terraform or the user explicitly wants HCL, Terraform import, or plan/apply for Konnect resources; not for `decK`/`kongctl` repos, generic Terraform-only troubleshooting, or domain-first Konnect diagnosis.4---56# Terraform for Konnect78## Goal910Author and maintain Konnect resources in HCL using the official Terraform11provider while preserving the repository's existing module, state, and CI12conventions.1314Use this skill for Terraform-managed Konnect work. Do not turn a `kongctl` or15`decK` repository into Terraform unless the user asks for that migration. Do16not treat this skill as the owner for generic backend, state-locking, or17provider-install issues unless they directly block Konnect resource work.1819## Tool Positioning2021- Use the shared `kong-konnect` MCP server first for live Konnect inspection22 when the requested change depends on current state and MCP is available.23- Use this skill when the repository already uses Terraform for Konnect or the24 user explicitly asks for HCL, Terraform Cloud, plan/apply, or provider-based25 management.26- Preserve existing Terraform layout, backend configuration, module structure,27 and variable conventions.28- Prefer the official `kong/konnect` provider by default and treat29 `kong/konnect-beta` as an explicit exception for missing coverage.30- Hand off to `deck-gateway` when the user wants file-based Gateway GitOps or31 `decK` export/diff workflows.32- Hand off to `kongctl-declarative` when the repository already uses `kongctl`33 YAML instead of HCL.34- Hand off to the relevant Konnect domain skill when the main problem is access,35 publication, runtime health, or another product diagnosis rather than HCL36 ownership.3738## References To Load3940Load only the reference file that matches the active branch:4142- `references/provider-selection.md`43 - Load when deciding whether the official `kong/konnect` provider is enough44 or whether the user explicitly needs `kong/konnect-beta`.45- `references/import-moved-and-adoption.md`46 - Load when existing Konnect resources must be normalized into Terraform47 state rather than recreated.48- `references/module-boundaries.md`49 - Load when the main question is where a new Konnect resource belongs in an50 existing Terraform layout.51- `references/gateway-entities-inside-konnect.md`52 - Load when the task mixes Konnect platform resources with Gateway entities53 inside a Konnect control plane.54- `references/provider-schema-debugging.md`55 - Load when nested resource shape is unclear, validation reports56 object-vs-string or similar type mismatches, or provider behavior does not57 line up cleanly with docs or example HCL.5859## Validation Contract6061### Preflight6263Before writing HCL or proposing a plan:6465- Confirm Terraform is installed and runnable: `terraform version`66- Confirm the repo's backend and workspace expectations before editing files67- Confirm Konnect auth is already supplied through secure variables, not68 checked-in literals69- Inspect existing provider blocks, modules, and variable names before writing70 new HCL71- Confirm which module, workspace, and resource addresses own the target72 Konnect slice73- Confirm whether existing live resources must be imported before planning74- Use `terraform providers schema -json` as the default source of truth when75 nested resource shape is unclear before guessing from docs or examples7677### Preview7879Use Terraform's native preview surface before apply:8081- run `terraform fmt -check` only when the repository uses that convention for82 validation83- run `terraform validate`84- run `terraform plan`85- import first when live resources already exist in scope and should be brought86 under state instead of recreated87- check the exact addresses, module boundaries, and create-update-destroy shape88 before considering apply8990### Execute9192- Describe the intended effect before any mutating command.93- Run `terraform apply` only when the user explicitly asked for live mutation.94- Apply the same workspace, variable set, and module boundary already previewed95 in `plan`.9697### Prove9899After a requested apply:100101- confirm the planned addresses match the intended ownership boundary102- use Terraform-native proof such as `terraform state list`,103 `terraform state show <address>`, relevant outputs, or a follow-up104 `terraform plan` that shows no remaining intended changes105- prove the exact resources touched rather than treating apply success as proof106107## Operating Rules108109- Preserve the repo's existing Terraform style: root-module layout, child110 modules, variable files, naming, and output shape.111- Keep Konnect credentials in the repo's existing secret path such as112 `KONNECT_TOKEN`, `KONNECT_SPAT`, or workspace-managed variables; never add113 committed literals to `.tf` files.114- Use `terraform providers schema -json` as the default source of truth for115 unknown nested resource shape before guessing HCL from docs or examples.116- Prefer `terraform plan` before `terraform apply` unless the user explicitly117 requests direct execution.118- If `terraform providers schema -json`, provider startup, `terraform validate`,119 or `terraform plan` fails in a way that suggests sandbox interference,120 retry outside the sandbox with approval before treating it as a provider,121 auth, or schema problem.122- Treat Terraform state as authoritative for what it manages. Do not recreate123 resources that should be imported or adopted.124- Keep Gateway entities and surrounding Konnect platform resources in the same125 Terraform approach only when the repository already does so or the user wants126 that composition.127- When the repository already manages only part of Konnect in Terraform, follow128 that boundary instead of broadening scope casually.129- Preserve imports, `moved` blocks, and module addresses when refactoring.130- Avoid mixing one-off UI edits with Terraform-managed resources without131 calling out drift.132- Do not treat a successful `terraform apply` as proof by itself; follow with133 state or plan-based verification of the touched addresses.134135## Workflow136137### 1. Inspect the Terraform shape138139Identify:140141- root modules and child modules142- provider aliases and version constraints143- backend configuration and workspace selection144- variable conventions and secrets handling145- whether Konnect resources are already organized by environment, team, or146 control plane147148Match the existing shape before adding resources.149150### 2. Confirm the Konnect scope151152Pin down:153154- which Konnect product surface is in scope155- whether the task concerns platform resources, Gateway entities inside a156 Konnect control plane, or both157- whether the request is create, update, import, or drift correction158- whether the repo already manages this Konnect slice in Terraform or the user159 is explicitly choosing Terraform as the implementation path160161Do not assume every requested resource belongs in the same module.162163Load `references/module-boundaries.md` if ownership between modules,164environments, or product slices is unclear.165Load `references/provider-schema-debugging.md` when resource shape is the main166uncertainty.167168### 3. Preview the intended change169170Default paths:171172- new managed resource: author HCL in the existing module layout173- existing unmanaged resource: prefer import or adoption over recreation174- repo migration from live Gateway entities: use `deck file kong2tf` as the175 default starting point when Gateway config already exists in `decK` or live176 Gateway state177- beta-only feature: use `kong/konnect-beta` only when explicitly required178179Use `references/provider-selection.md` for provider choice and180`references/import-moved-and-adoption.md` for state-normalization work.181When HCL shape is unclear, inspect `terraform providers schema -json` before182guessing block or attribute structure.183184Preview expectations:185186- use `terraform fmt -check` only when the repo expects it187- run `terraform validate`188- run `terraform plan`189- inspect whether the plan touches only the intended module and addresses190- import first if the plan would recreate something that already exists live191192### 4. Author HCL with stable ownership boundaries193194When writing HCL:195196- keep related resources grouped by the repository's current convention197- reuse variables and locals rather than duplicating environment-specific198 literals199- preserve stable names and identifiers where the repo already has them200- add outputs only when downstream modules or CI actually need them201202Load `references/gateway-entities-inside-konnect.md` when Gateway entities and203platform resources might belong in different parts of the repo.204205### 5. Execute only when requested206207- Describe the intended live effect before presenting or running208 `terraform apply`.209- Use the same workspace, variable set, and directory that produced the210 reviewed plan.211- Run `terraform apply` only when the user explicitly asked to mutate live212 Konnect state.213214### 6. Prove the result with Terraform-native checks215216After any requested `terraform apply`:217218- confirm the touched resource addresses now appear in `terraform state list`219- inspect key addresses with `terraform state show <address>` or the repo's220 normal output surface221- when practical, run a follow-up `terraform plan` and expect no remaining222 intended changes for the touched slice223- call out any drift or ownership mismatch instead of hiding it behind apply224 success225226### 7. Report both config and state impact227228State:229230- which files or modules changed231- which Konnect resources are managed or updated232- whether import is required233- whether the next step is `plan`, `apply`, or a separate verification step234235## Kong-Specific Gotchas236237- `kong/konnect` is the default supported provider; beta coverage should be an238 explicit exception, not the baseline.239- Recreating an existing Konnect resource in Terraform instead of importing it240 can cause avoidable churn and broken references.241- A repository may manage Gateway entities in Terraform while still inspecting242 live state through MCP or `kongctl`; those are complementary, not conflicting.243- Generated `kong2tf` output is a starting point, not a guarantee that the HCL244 matches repo style or ownership boundaries.245- If the repo already standardizes on `kongctl` YAML or `decK`, forcing HCL is246 usually the wrong move unless migration is the task.247248## Validation Checklist249250Before answering, verify that you can state:251252- why Terraform is the right tool for this repository or request253- whether `kong/konnect` or `kong/konnect-beta` is actually needed254- which module or file owns the target resources255- whether import or adoption is required256- which preview commands prove the intended change before mutation257- whether provider schema inspection is needed before guessing nested HCL shape258- whether the change should stop at HCL authoring or continue to `plan/apply`259- how the exact resource addresses will be proved after apply260- whether another tool skill should own the implementation instead261262## Handoffs263264- Use `deck-gateway` when the user wants Gateway-entity GitOps through `decK`265 rather than Terraform state.266- Use `kongctl-declarative` when the repository already uses `kongctl` YAML for267 Konnect changes.268- Use `konnect-access-scope`, `konnect-api-publish`, `konnect-gateway-triage`,269 or other domain skills when the user first needs diagnosis of the Konnect270 problem rather than HCL authoring.271272---273> Source: [johnharris85/kong-skills](https://github.com/johnharris85/kong-skills) — distributed by [TomeVault](https://tomevault.io).274<!-- tomevault:4.0:skill_md:2026-05-22 -->