<aside> <img src="/icons/reorder_gray.svg" alt="/icons/reorder_gray.svg" width="40px" />
Language Guide
</aside>
Define resources to provision using the resource keyword. Each resource declaration requires a symbolic name that can be referenced throughout your file to access the resource's values.
The resource body contains only properties - no language syntax. Resource declarations are kept clean and focused solely on configuration. All language-level functionality (loops, conditionals, metadata) must be placed outside the resource body, typically as annotations or declarations before the resource definition.
@<decorator>(<argument>)
resource <typeName> <symbolic-name> {
<resource-properties>
}
Symbolic names follow these rules:
_)We support classic conditionals to optionally provision resources. Scoping rule: Resources declared inside an if block are only accessible within that block. Attempting to reference them outside will result in an error. To avoid this, group all dependent resources inside the same conditional block.
if(<condition>) {
resource Bucket photos {
name = 'photos-$index'
}
resource BucketPolicy policy {
bucket = photos.id // ✅ Valid - same scope inside if
}
}
resource CloudFront cdn {
bucket = photos.id // ❌ Error - photos is out of scope
}
To provision multiple instances of a resource, use the for syntax. You can use the @count decorator to specify whether the instances are provisioned serially or in parallel. For more information, see Iterative loops in Kite.
@count(5)
resource Bucket logs {
name: 'bucket-$index'
}
// or for without scope - can be accessed later
[for index in 0..5]
resource Bucket logs {
name: 'bucket-$index'
}
// or for with scope - cannot be accessed outside the loop
for index in 0..5 {
resource Bucket logs {
name: 'bucket-$index'
}
}
We use the existing resource to reference existing cloud resources into code. Existing resources cannot be updated
@existing('arn:aws:ec2:us-east-1:123456789012:vpc/vpc-0e9801d129EXAMPLE')
resource VPC main {
name: 'bucket-name'
}
we are smart about resource refactorings so you can focus on more important stuff
resource Bucket main { // on apply creates the resource in the cloud provider
name: 'bucket-name'
}
// later we rename main to logs
// on apply we detect that the resource name was changed
// and we don't trigger a bucket recreation in the cloud enabling you to do easy refactorings
resource Bucket logs {
name: 'bucket-name'
}