Skip to content

poseidon/terraform-provider-util

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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