Skip to content

Latest commit

 

History

History
82 lines (61 loc) · 1.9 KB

README.md

File metadata and controls

82 lines (61 loc) · 1.9 KB

terraform-provider-util

GoDoc Workflow Downloads Sponsors Mastodon

terraform-provider-util provides some low-level utility functions.

Usage

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

provider "util" {}

terraform {
  required_providers {
    ct = {
      source  = "poseidon/util"
      version = "0.3.0"
    }
  }
}

Perform a set of replacements on content with replace.

data "util_replace" "example" {
  content      = "hello world"
  replacements = {
    "/(h|H)ello/": "Hallo",
    "world": "Welt",
  }
}

# Hallo Welt
output "example" {
  value = data.ct_replace.example.replaced
}

Store a content value that persists in state until changed to a non-empty value.

resource "util_register" "example" {
  content = "a1b2c3"
}

Later, the register's content may be updated, but empty values (null or "") are ignored.

resource "util_register" "example" {
  content = null
}

output "sha" {
  value = util_register.example.value  # "a1b2c3"
}

Run terraform init to ensure plugin version requirements are met.

$ terraform init

Requirements

Development

Binary

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

make