Skip to content

Instantly share code, notes, and snippets.

View Rabattkarte's full-sized avatar
👓

Nils Fahldieck Rabattkarte

👓
View GitHub Profile
@Rabattkarte
Rabattkarte / tf-delete-workspace.sh
Last active October 27, 2023 14:41
small Bash script to bulk (safe) delete Terraform Cloud workspaces
#!/bin/bash
CREDENTIALS_FILE="$HOME/.terraform.d/credentials.tfrc.json"
if [ -z "$TFE_TOKEN" ]; then
if [ -f "$CREDENTIALS_FILE" ]; then
echo "\$TFE_TOKEN is empty. Using \$TFE_TOKEN from $CREDENTIALS_FILE"
TFE_TOKEN=$(jq --raw-output '.credentials."app.terraform.io".token' \
"$HOME/.terraform.d/credentials.tfrc.json")
fi
@Rabattkarte
Rabattkarte / default_tags.tf
Created October 13, 2022 14:19
How to merge default tags with user provided tags in Terraform HCL
# Define a variable for user-provided tags as a map of strings.
variable "user_tags" {
type = map(string)
default = {}
description = "A user defined map of tags that should be attached to every tagable resource."
}
locals {
# Define the common tags that are added to all resources.
common_tags = {

Keybase proof

I hereby claim:

  • I am rabattkarte on github.
  • I am rabattkarte (https://keybase.io/rabattkarte) on keybase.
  • I have a public key ASCj5t7RXldXqpsmZ-KrdooRCemOT8eZ3gYjiHKyhSIN0wo

To claim this, I am signing this object:

$ cd /tmp/testdir/sites-enabled/
$ touch 12098 dlij 0921 dpo 210983uj1m foo bar abc def
$ ls
0921 12098 210983uj1m abc bar def dlij dpo foo
$ salt-call state.apply remove_files_in_dir_except_list
local:
----------
ID: file
Function: 0./tmp/testdir/sites-enabled/
Name: remove files in dir