A machine-readable index of this documentation for AI agents is available at https://kubevela.io/llms.txt. Markdown versions of documentation pages are available by appending .md to their URLs.
Skip to main content
Version: Terraform Controller Next

Introduction

terraform-controller runs Terraform from inside Kubernetes. You give it Terraform (inline HCL, or a module in a git repository) as a Configuration object, and it runs terraform init and terraform apply in a Job, keeps the state in the cluster by default (or in S3 with backendType: s3), and, if you set writeConnectionSecretToRef, writes the Terraform outputs into a Secret your workloads can read. Delete the Configuration and it runs terraform destroy, unless deleteResource is false.

It is how KubeVela provisions cloud resources: an RDS database, an OSS or S3 bucket, a VPC, a DNS zone. The resource sits in the same Application as the workload that uses it, and the connection details reach that workload as a Secret, with no hand-off between teams.

Who it is for​

You areYou use
An application team on KubeVelaCloud resource component types (alibaba-rds, aws-s3, ...) in an Application, and the Secret they write. Start with Provision Cloud Resources.
A platform engineerThe terraform addon, a provider addon per cloud, and your own component types built from Terraform modules: Extend Cloud Resources.
Running Terraform on Kubernetes without KubeVelaThe controller's Helm chart and the Configuration and Provider objects directly. The Quick Start does exactly that.

How it relates to KubeVela​

Application ──▶ vela-core ──▶ Configuration ──▶ terraform-controller ──▶ Job: terraform init / apply
(component renders the (terraform.core. watches it │
type alibaba- component oam.dev/v1beta2) ▼
rds, ...) Provider ◀── credentials cloud API
Secret ◀── outputs (writeConnectionSecretToRef)
  • A component type whose definition has a schematic.terraform block is rendered by vela-core as a Configuration, with the component's properties as Terraform variables. See How It Works.
  • The terraform addon installs the controller. Each provider addon (terraform-alibaba, terraform-aws, ...) adds that cloud's component types and a config template for its credentials.
  • vela-core is built against the controller's Go API types, so each KubeVela release pins a controller version: the Versions page has the table.

This section follows terraform-controller as it is now (v0.9.1, which KubeVela 1.12 pins), and is not versioned with KubeVela.

Where to next​