Skip to content

bnferguson/terraform-provider-punk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-provider-punk

A Terraform provider for mild chaos. Make punk band names. Trash a system (briefly).

Works like random_pet. Inspired by this Bluesky thread.

Resources

punk_band

Makes a random punk band name. Drop it in where you use random_pet.

resource "punk_band" "my_band" {}
# => "systematically-experimental-quarantine"

resource "punk_band" "the_band" {
  prefix = "the"
  length = 2
}
# => "the-sunken-gallows"
Attribute Type Default What it does
length number 3 How many words in the name.
separator string "-" What goes between words.
prefix string Added to the front of the name.
keepers map Change a value here to get a new name.
id string (output) The band name.

The word lists mix formal and mean words. One word gives you a noun. Two words give you an adjective and a noun. Three or more add adverbs.

punk_trash

Burns CPU and grabs memory when you create it. Trash the system. Trash the patriarchy. Trash what needs trashing.

resource "punk_trash" "the_system" {}
# Burns 5s of CPU + grabs 64 MiB

resource "punk_trash" "the_patriarchy" {
  cpu_seconds = 3155760000
  memory_mb   = 512
}
Attribute Type Default What it does
cpu_seconds number 5 Seconds to burn CPU on all cores.
memory_mb number 64 MiB of memory to grab and hold.
keepers map Change a value here to thrash again.
id string (output) ID for this thrash run.

Caution

This will pin every CPU core and hold memory for the full time. Hell yeah.

Ctrl-C stops it. The resource checks for cancel signals.

Install

Build from source

git clone https://github.com/bnferguson/terraform-provider-punk.git
cd terraform-provider-punk
make build

Put the binary in your local plugin folder:

mkdir -p ~/.terraform.d/plugins/registry.terraform.io/bnferguson/punk/0.1.0/$(go env GOOS)_$(go env GOARCH)
cp terraform-provider-punk ~/.terraform.d/plugins/registry.terraform.io/bnferguson/punk/0.1.0/$(go env GOOS)_$(go env GOARCH)/

Then point your config at it:

terraform {
  required_providers {
    punk = {
      source = "registry.terraform.io/bnferguson/punk"
    }
  }
}

Development

You need Go 1.23+ and Terraform. Tool versions are managed with mise.

make build    # compile
make test     # unit tests
make testacc  # acceptance tests (needs terraform)
make fmt      # format code
make lint     # run golangci-lint

Project layout

├── main.go                         # Entry point
├── internal/
│   ├── provider/                   # Terraform resources
│   ├── punkname/                   # Name generator + word lists
│   └── planmodifiers/              # Keepers plan modifier
├── examples/resources/             # Example configs
├── Makefile                        # Build targets
└── .tool-versions                  # Tool versions

Contributing

Open an issue or send a pull request.

About

A Terraform provider for when random pet names aren't cutting it (with a side of mild chaos)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors