Terraform Bridge
The Terraform Bridge gives you access to all 3,000+ Terraform providers directly from Kite. You write standard Kite syntax and the bridge handles translation, naming conventions, and state management behind the scenes.
Quick Start
Add a Terraform provider to your Kitefile:
# Kitefile.yml
dependencies:
- name: tf/aws
version: "~> 5.0"import Instance from "tf/aws"
resource Instance web {
ami = "ami-0123456789"
instanceType = "t3.micro"
}kite install && kite apply -e devNaming Conventions
The bridge automatically converts Terraform naming to Kite conventions:
| Terraform | Kite | Rule |
|---|---|---|
aws_instance | Instance | Strip provider prefix, PascalCase |
aws_security_group | SecurityGroup | Multi-word PascalCase |
instance_type | instanceType | camelCase properties |
vpc_security_group_ids | vpcSecurityGroupIds | camelCase properties |
Imports
All Types
import * from "tf/aws"Specific Types
import Instance, Vpc from "tf/aws"Domain-Specific
import * from "tf/aws/compute"
import * from "tf/aws/networking"
import * from "tf/aws/storage"Resources
Basic Resource
import SecurityGroup, Instance from "tf/aws"
resource SecurityGroup web {
name = "web-sg"
description = "Allow HTTP traffic"
ingress = [{
fromPort = 80,
toPort = 80,
protocol = "tcp",
cidrBlocks = ["0.0.0.0/0"]
}]
}
resource Instance web {
ami = "ami-0123456789"
instanceType = "t3.micro"
vpcSecurityGroupIds = [web.id]
}Referencing @cloud Properties
import Vpc, Subnet, Instance from "tf/aws"
resource Vpc main {
cidrBlock = "10.0.0.0/16"
}
resource Subnet public {
vpcId = main.id
cidrBlock = "10.0.1.0/24"
}
resource Instance web {
ami = "ami-0123456789"
instanceType = "t3.micro"
subnetId = public.id
}Multiple Providers
import Instance from "tf/aws"
import ComputeInstance from "tf/google"
import VirtualMachine from "tf/azurerm"
resource Instance awsWeb {
ami = "ami-0123456789"
instanceType = "t3.micro"
}
resource ComputeInstance gcpWeb {
name = "web-server"
machineType = "e2-micro"
zone = "us-central1-a"
}
resource VirtualMachine azureWeb {
name = "web-server"
location = "East US"
size = "Standard_B1s"
}Data Sources
Use @existing without arguments to query infrastructure instead of creating it. Properties act as filters:
import Ami, Instance from "tf/aws"
@existing
resource Ami latest {
mostRecent = true
filter = [
{ name: "name", values: ["amzn2-ami-hvm-*-x86_64-gp2"] },
{ name: "owner-id", values: ["137112412989"] }
]
}
resource Instance web {
ami = latest.id
instanceType = "t3.micro"
}Version Constraints
Specify provider versions in your Kitefile.yml:
dependencies:
- name: tf/aws
version: "~> 5.0" # >= 5.0, < 6.0
- name: tf/google
version: ">= 5.0, < 6.0" # Compound constraint
- name: tf/azurerm
version: "3.85.0" # Exact version
- name: tf/datadog # No version = latest| Syntax | Meaning |
|---|---|
~> 5.0 | Pessimistic: >= 5.0, < 6.0 |
>= 5.0, < 6.0 | Compound range |
5.82.0 | Exact version |
| (omitted) | Latest available |
Terminology Translation
| Terraform | Kite | Notes |
|---|---|---|
resource "aws_instance" | resource Instance | Strip prefix, PascalCase |
data "aws_ami" | @existing resource Ami | Query-based data source |
| argument (user input) | property | Regular property |
| attribute (computed) | @cloud property | Set by provider after apply |
count | @count(N) | Loop decorator |
depends_on | @dependsOn(resource) | Explicit dependency |
provider "aws" { } | Kitefile credentials | Provider configuration |
terraform init | kite install | Download providers |
terraform plan | kite plan | Preview changes |
terraform apply | kite apply | Execute changes |
Using with Native Providers
Terraform providers (tf/) and native Kite providers coexist in the same file. Native providers offer higher-level abstractions; Terraform providers give you full access to every resource:
// Native Kite provider (Server maps to Ec2Instance under the hood)
import Server from "aws"
// Terraform provider (direct access to all 1000+ AWS resources)
import CloudwatchLogGroup from "tf/aws"
resource Server web {
cpu = 2
memory = 4
}
resource CloudwatchLogGroup logs {
name = "/app/web"
retentionInDays = 14
}Use native providers when they cover your use case. Fall back to tf/ for resources that do not have a native Kite provider yet.
Supported Providers
Any provider published to the Terraform Registry works with the bridge. Popular providers include:
| Provider | Import |
|---|---|
| AWS | tf/aws |
| Google Cloud | tf/google |
| Azure | tf/azurerm |
| Kubernetes | tf/kubernetes |
| Datadog | tf/datadog |
| Cloudflare | tf/cloudflare |
| GitHub | tf/github |
| PagerDuty | tf/pagerduty |
| Helm | tf/helm |
| Vault | tf/vault |
See also: Imports for the full import system, Decorators for @existing and @cloud.