Skip to content

Instantly share code, notes, and snippets.

View nitrocode's full-sized avatar
🚀
Thinking and typing

RB nitrocode

🚀
Thinking and typing
View GitHub Profile
@nitrocode
nitrocode / template-terraform-provider-for-darwin-arm.md
Last active September 17, 2024 12:16
Template terraform provider for darwin arm

Template terraform provider for darwin arm

Provider registry.terraform.io/hashicorp/template v2.2.0 does not have a package available for your current platform, darwin_arm64

why

The templatefile function only works with files. If you're working with files then switch to templatefile.

The hashicorp/template provider's template_file data source works with template strings and files (converted to strings) but was archived/deprecated before creating an arm release forcing people to look into other options if using Apple M1 (based on ARM).

@nitrocode
nitrocode / move-to-password-manager.md
Created January 15, 2022 19:50
Move to password manager

Move to password manager

Why

Prerequisites

  • choose manager
    • bitwarden vs 1password
  • choose a strong master password
  • only length matters

List Datadog Orgs

Set env vars (preferably using direnv)

export DD_CLIENT_API_KEY=
export DD_CLIENT_APP_KEY=

Then run script

@nitrocode
nitrocode / aws_phd_event_codes.md
Last active September 15, 2021 19:08
AWS PHD event codes

AWS PHD Event Codes

Commands to dump it out

aws health describe-events | jq -r '.eventTypes[].code' > aws_phd_event_codes.txt
@nitrocode
nitrocode / find-region-of-instance-id.sh
Created April 20, 2021 16:38
Find the aws region of an instance id
#!/bin/bash
# Usage:
# ./find-region-of-instance-id.sh i-snip
aws ec2 describe-regions --query 'Regions[].RegionName' --output text | tr '\t' '\n' | tac | while read region; do
output=`aws --region $region ec2 describe-instances --instance-ids $@ --query 'Reservations[].Instances[].InstanceId' --output text 2>/dev/null || true`
if [ "$output" = "$@" ]; then
echo $region
break
fi
@nitrocode
nitrocode / terraform_version_from_tfstate.md
Last active September 27, 2022 14:01
Get terraform version from tfstate

Get terraform version from tfstate

This returns the tfstate version from the tf state

Only useful if a pre-0.14 version of terraform is required to apply and it's too difficult to upgrade to the latest.

No workspace

Format: s3://{bucket}/{key}

@nitrocode
nitrocode / README.md
Last active March 25, 2021 16:27
Find all applications that are not universal on the m1 mac

README

Find non arm based apps running on your m1 using system_profiler. This helps find out if an intel based app is running instead of a universal app.

Using this technique, I found out that IT had accidentally installed x86 slack and x86 chrome. I replaced those with the universal ones for better performance.

Sample output of the attached shell script

$ wget https://gist.githubusercontent.com/nitrocode/7ab3e9229a6bce66b73d59fc1970eec8/raw/m1_applications_not_universal.sh
@nitrocode
nitrocode / upgrade-terraform-versions.md
Last active February 20, 2024 23:31
Upgrade terraform versions from 0.12.x and higher

Upgrade Terraform

  • If using an arm instance, versions before 1.0.2 may cause intermittent issues so some commands will have to be repeated if they fail.
  • Before each upgrade, the required_version may need to be updated
  • After each upgrade, a terraform refresh may be needed

Prereqs

  • Start with terraform that does not have any changes
  • tfenv - brew install tfenv
@nitrocode
nitrocode / table-WithRequired.md
Last active March 2, 2021 13:28
Test markdown anchor for terraform-docs

Usage:

Example of 'foo_bar' module in foo_bar.tf.

  • list item 1
  • list item 2

Even inline formatting in here is possible.
and some link