Skip to content

poseidon/terraform-provider-util

Folders and files

NameName
Last commit message
Last commit date
Jun 22, 2024
Jun 22, 2024
Jun 23, 2024
Jun 22, 2024
Sep 26, 2021
Jun 22, 2024
Sep 26, 2021
Sep 26, 2021
Jun 22, 2024
Jun 22, 2024
Apr 1, 2025
Feb 20, 2025
Jun 22, 2024

Repository files navigation

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