mirror of
https://github.com/outbackdingo/terraform-provider-ct.git
synced 2026-01-27 18:20:35 +00:00
1.4 KiB
1.4 KiB
config-transpiler Provider
terraform-provider-ct allows Terraform to validate a Butane config and transpile to an Ignition config for machine consumption.
Usage
Configure the config transpiler provider (e.g. providers.tf).
provider "ct" {}
terraform {
required_providers {
ct = {
source = "poseidon/ct"
version = "0.14.0"
}
}
}
Define a Butane config for Fedora CoreOS or Flatcar Linux:
variant: fcos
version: 1.5.0
passwd:
users:
- name: core
ssh_authorized_keys:
- ssh-key foo
variant: flatcar
version: 1.1.0
passwd:
users:
- name: core
ssh_authorized_keys:
- ssh-key foo
Define a ct_config data source with strict validation.
data "ct_config" "worker" {
content = file("worker.yaml")
strict = true
pretty_print = false
snippets = [
file("units.yaml"),
file("storage.yaml"),
]
}
Optionally, template the content.
data "ct_config" "worker" {
content = templatefile("worker.yaml", {
ssh_authorized_key = "ssh-ed25519 AAAA...",
})
strict = true
}
Render the ct_config as Ignition for use by machine instances.
resource "aws_instance" "worker" {
user_data = data.ct_config.worker.rendered
}
Run terraform init to ensure plugin version requirements are met.
$ terraform init