Skip to main content
Documentation

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 dev

Naming Conventions

The bridge automatically converts Terraform naming to Kite conventions:

TerraformKiteRule
aws_instanceInstanceStrip provider prefix, PascalCase
aws_security_groupSecurityGroupMulti-word PascalCase
instance_typeinstanceTypecamelCase properties
vpc_security_group_idsvpcSecurityGroupIdscamelCase 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
SyntaxMeaning
~> 5.0Pessimistic: >= 5.0, < 6.0
>= 5.0, < 6.0Compound range
5.82.0Exact version
(omitted)Latest available

Terminology Translation

TerraformKiteNotes
resource "aws_instance"resource InstanceStrip prefix, PascalCase
data "aws_ami"@existing resource AmiQuery-based data source
argument (user input)propertyRegular property
attribute (computed)@cloud propertySet by provider after apply
count@count(N)Loop decorator
depends_on@dependsOn(resource)Explicit dependency
provider "aws" { }Kitefile credentialsProvider configuration
terraform initkite installDownload providers
terraform plankite planPreview changes
terraform applykite applyExecute 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:

ProviderImport
AWStf/aws
Google Cloudtf/google
Azuretf/azurerm
Kubernetestf/kubernetes
Datadogtf/datadog
Cloudflaretf/cloudflare
GitHubtf/github
PagerDutytf/pagerduty
Helmtf/helm
Vaulttf/vault

See also: Imports for the full import system, Decorators for @existing and @cloud.