The ct
provider provides a ct_config
data source that parses a Container Linux Config, validates the content, and renders Ignition. The rendered strings can be used as input to other Terraform resources (e.g. user-data for instances).
Ignition schema output
Each minor version of terraform-provider-ct
is tightly coupled with a minor version of the Ignition schema. Ignition transparently handles old Ignition schema versions, so this isn't normally an issue.
However, it is not safe to upgrade between minor versions on existing managed clusters. Minor version upgrades of this plugin will re-provision your cluster because the Ignition config output has changed.
terraform-provider-ct |
Ignition schema version |
0.2.x |
2.0 |
0.3.x |
2.2 |
Requirements
Installation
Add the terraform-provider-ct
plugin binary on your filesystem.
# dev
go get -u github.com/coreos/terraform-provider-ct
Register the plugin in ~/.terraformrc
.
providers {
ct = "/$GOPATH/bin/terraform-provider-ct"
}
Usage
data "ct_config" "worker" {
content = "${file("worker.yaml")}"
platform = "ec2"
pretty_print = false
snippets = [
"${file("units.yaml")}",
"${file("storage.yaml")}",
]
}
resource "aws_instance" "worker" {
user_data = "${data.ct_config.worker.rendered}"
}
The optional platform can be "azure", "ec2", "gce", or others to perform platform-specific susbstitutions. By default, platform is "" (none, for bare-metal).
The snippets
field is an optional list of Container Linux Config snippets that are appended to the main config specified in content
before being rendered into an Ignition config.
Development
To develop the provider plugin locally, set up Go 1.8+ and a valid GOPATH. Build the plugin locally.
make
Optionally, install the plugin to $(GOPATH)/bin
.
make install
Vendor
Add or update dependencies in glide.yaml and vendor. The glide and glide-vc tools vendor and prune dependencies.
make vendor