Profile
Back to NewsBack
GitHub Trending 3 min
Reader Mode
poseidon/terraform-provider-butane: Terraform provider for converting Butane Configs to Ignition

poseidon/terraform-provider-butane: Terraform provider for converting Butane Configs to Ignition

23 hours ago

terraform-provider-butane

GoDoc</a> Workflow</a> !Downloads Sponsors</a> Mastodon</a>

terraform-provider-butane allows Terraform to validate a Butane config and transpile to an Ignition config for machine consumption.

Usage

Configure the Butane provider (e.g. providers.tf).

provider "butane" {}

terraform { required_providers { butane = { source = "poseidon/butane" version = "0.15.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 butane_config data source with strict validation.

data "butane_config" "worker" {
  content      = file("worker.yaml")
  strict       = true
  pretty_print = false

snippets = [ file("units.yaml"), file("storage.yaml"), ] }

Optionally, template the content.

data "butane_config" "worker" {
  content = templatefile("worker.yaml", {
    ssh_authorized_key = "ssh-ed25519 AAAA...",
  })
  strict       = true
}

Render the butane_config as Ignition for use by machine instances.

resource "aws_instance" "worker" {
  user_data = data.butane_config.worker.rendered
}

Run terraform init to ensure plugin version requirements are met.

$ terraform init

Migration

Starting with v0.15.0, the provider is named poseidon/butane. Update your provider configuration:

terraform {
  required_providers {
    butane = {
      source  = "poseidon/butane"
      version = "~> 0.15.0"
    }
  }
}

Rename any provider "ct" blocks to provider "butane", and replace ct_config with butane_config in data source declarations and references:

data "butane_config" "worker" {
  content = file("worker.yaml")
  strict  = true
}

resource "aws_instance" "worker" { user_data = data.butane_config.worker.rendered }

Run terraform init -upgrade, then review terraform plan before applying.

Requirements

Versions

The version history below describes releases of the original poseidon/ct provider.

Butane configs are converted to the current (according to this provider) stable Ignition config and merged together. For example, poseidon/ct v0.12.0 would convert a Butane Config with variant: fcos and version: 1.2.0 to an Ignition config with version v3.3.0. This relies on Ignition's forward compatibility.

| poseidon/ct | Butane variant | Butane version | Ignition verison | |-----------------------|----------------|----------------|------------------| | 0.14.x | fcos | 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0 | 3.4.0 | | 0.14.x | flatcar | 1.0.0, 1.1.0 | 3.4.0 | | 0.13.x | fcos | 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0 | 3.4.0 | | 0.13.x | flatcar | 1.0.0, 1.1.0 | 3.4.0 | | 0.12.x | fcos | 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0 | 3.3.0 | | 0.12.x | flatcar | 1.0.0 | 3.3.0 |

Before poseidon/ct v0.12.0, ct_config content could be a Butane Config or a Container Linux Config (CLC). Before poseidon/ct v0.10.0, Butane configs contained a version that was associated with an Ignition format version. For example, a Butane config with version: 1.0.0 would produce an Ignition config with version 3.0.0.

| terraform-provider-ct | CLC to Ignition | Butane to Ignition | |-----------------------|---------------------|--------------------| | 0.11.x | Renders 2.3.0 | Butane (1.0, 1.1, 1.2, 1.3, 1.4) -> Ignition 3.3 | | 0.10.x | Renders 2.3.0 | Butane (1.0, 1.1, 1.2, 1.3, 1.4) -> Ignition 3.3 | | 0.9.x | Renders 2.3.0 | Butane (1.0, 1.1, 1.2, 1.3, 1.4) -> Ignition (3.0, 3.1, 3.2, 3.2, 3.3) | 0.8.x | Renders 2.3.0 | Butane (1.0, 1.1, 1.2, 1.3) -> Ignition (3.0, 3.1, 3.2, 3.2) | 0.7.x | Renders 2.3.0 | Butane (1.0, 1.1, 1.2) -> Ignition (3.0, 3.1, 3.2) | | 0.6.x | Renders 2.3.0 | Butane (1.0, 1.1) -> Ignition (3.0, 3.1) | | 0.5.x | Renders 2.2.0 | Butane 1.0.0 -> Ignition 3.0.0 | | 0.4.x | Renders 2.2.0 | Butane 1.0.0 -> Ignition 3.0.0 | | 0.3.x | Renders 2.2.0 | NA | | 0.2.x | Renders 2.0.0 | NA |

Development

Binary

To develop the provider plugin locally, build an executable with Go v1.18+.

make
Chat with me