An open API service indexing awesome lists of open source software.

https://github.com/poseidon/terraform-provider-util

Terraform provider for special utilities
https://github.com/poseidon/terraform-provider-util

terraform terraform-provider

Last synced: 25 days ago
JSON representation

Terraform provider for special utilities

Awesome Lists containing this project

README

          

# terraform-provider-util
[![GoDoc](https://pkg.go.dev/badge/github.com/poseidon/terraform-provider-util.svg)](https://pkg.go.dev/github.com/poseidon/terraform-provider-util)
[![Workflow](https://github.com/poseidon/terraform-provider-util/actions/workflows/test.yaml/badge.svg)](https://github.com/poseidon/terraform-provider-util/actions/workflows/test.yaml?query=branch%3Amain)
![Downloads](https://img.shields.io/github/downloads/poseidon/terraform-provider-util/total)
[![Sponsors](https://img.shields.io/github/sponsors/poseidon?logo=github)](https://github.com/sponsors/poseidon)
[![Mastodon](https://img.shields.io/badge/follow-news-6364ff?logo=mastodon)](https://fosstodon.org/@poseidon)

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

## Usage

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

```hcl
provider "util" {}

terraform {
required_providers {
util = {
source = "poseidon/util"
version = "0.4.0"
}
}
}
```

Perform a set of replacements on content with `replace`.

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

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

Convert a Kubernetes Service Account public key into a JWKS document for OIDC discovery.

```hcl
data "util_jwks" "cluster" {
public_key = module.cluster.service_account_public_key
}

output "jwks" {
value = data.util_jwks.cluster.jwks
}
```

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

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

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

```tf
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

* Terraform v0.13+ [installed](https://www.terraform.io/downloads.html)

## Development

### Binary

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

```
make
```