Skip to main content
The extend block overrides specific attributes of an existing block for a target environment. Non-overridden attributes are inherited from base. No Terraform equivalent.

Syntax

# For unit, deploy, sync (three labels):
extend "unit" "resource_type" "name" {
  attribute = override_value
}

# For component (two labels — no type):
extend "component" "name" {
  attribute = override_value
}

Example

# main.iac — base definitions
unit "aws_rds_instance" "db" {
  engine            = "postgres"
  instance_class    = "db.t3.micro"   # staging default
  allocated_storage = 20
  multi_az          = false
  username          = "admin"
  password          = secret("aws_secrets_manager", "staging/db/password")
  skip_final_snapshot = true
}

# envs/prod/overrides.iac — prod overrides
extend "unit" "aws_rds_instance" "db" {
  instance_class    = "db.r6g.xlarge"
  allocated_storage = 100
  multi_az          = true
  password          = secret("aws_secrets_manager", "prod/db/password")
}
ubx apply              # staging — db.t3.micro, single-az
ubx apply --env prod   # prod    — db.r6g.xlarge, multi-az

File Layout

project/
  main.iac
  envs/
    prod/
      overrides.iac
    staging/
      overrides.iac

Supported Block Types

BlockSyntax
unitextend "unit" "resource_type" "name" { ... }
deployextend "deploy" "type" "name" { ... }
syncextend "sync" "type" "name" { ... }
componentextend "component" "name" { ... }
input, output, local, and extend blocks cannot be extended.

Validation

  • Target block must exist in the base files
  • Unknown attributes pass through without schema check