Skip to content

Instantly share code, notes, and snippets.

View greyhoundforty's full-sized avatar
🏠
Working from home

Ryan Tiffany greyhoundforty

🏠
Working from home
View GitHub Profile
@greyhoundforty
greyhoundforty / main.tf
Created May 19, 2023 16:28
Storage Groups for Classic Bare Metal
variable "deployment" {
description = "Deployment options to use based on var.os. This also determines the Datacenter and VLANs."
type = map(object({
os_reference_code = string
name = string
user_metadata = string
}))
default = {
windows = {
os_reference_code = "OS_WINDOWS_2022_FULL_STD_64_BIT"
@greyhoundforty
greyhoundforty / tf-output.json
Created May 17, 2023 10:12
Terraform Debug Output
This file has been truncated, but you can view the full file.
{"@level":"info","@message":"Terraform version: 1.4.5","@timestamp":"2023-05-17T05:11:16.743661-05:00"}
{"@level":"debug","@message":"using github.com/hashicorp/go-tfe v1.18.0","@timestamp":"2023-05-17T05:11:16.743794-05:00"}
{"@level":"debug","@message":"using github.com/hashicorp/hcl/v2 v2.16.2","@timestamp":"2023-05-17T05:11:16.743800-05:00"}
{"@level":"debug","@message":"using github.com/hashicorp/terraform-config-inspect v0.0.0-20210209133302-4fd17a0faac2","@timestamp":"2023-05-17T05:11:16.743804-05:00"}
{"@level":"debug","@message":"using github.com/hashicorp/terraform-svchost v0.1.0","@timestamp":"2023-05-17T05:11:16.743808-05:00"}
{"@level":"debug","@message":"using github.com/zclconf/go-cty v1.12.1","@timestamp":"2023-05-17T05:11:16.743811-05:00"}
{"@level":"info","@message":"Go runtime version: go1.19.6","@timestamp":"2023-05-17T05:11:16.743814-05:00"}
{"@level":"info","@message":"CLI args: []string{\"terraform\", \"apply\", \"default.tfplan\"}","@timestamp":"2023-05-17T05:11:16.743825-05:00"}
{"@le
@greyhoundforty
greyhoundforty / sensitive-tf-testing.md
Created May 12, 2023 21:07
Terraform Sensitive value testing

Versions:

$ terraform version
Terraform v1.4.5
on darwin_arm64
+ provider registry.terraform.io/hashicorp/random v3.5.1
+ provider registry.terraform.io/ibm-cloud/ibm v1.53.0-beta0
+ provider registry.terraform.io/logdna/logdna v1.14.2
@greyhoundforty
greyhoundforty / generate.tf
Created May 11, 2023 17:19
Terraform TLS
module "pki" {
source = "particuleio/pki/tls"
version = "2.0.0"
ca = {
algorithm = "RSA"
ecdsa_curve = "secp384r1"
subject = {
common_name = "${var.basename} CA"
organization = "Org"
@greyhoundforty
greyhoundforty / tf-sensitive.md
Last active May 11, 2023 11:29
Terraform data template_file vs templatefile

Does not work

Using the data template_file option leads to the secret being shown during the plan command. I used uuidgen to generate a random secret key.

export TF_VAR_secret_key=$(uuidgen)
data "template_file" "init" {
@greyhoundforty
greyhoundforty / main.tf
Created April 27, 2023 15:08
Juniper vSRX Classic Terraform
resource "ibm_network_gateway" "gateway" {
name = "rt-test-gw"
members {
hostname = "gw1"
domain = "rst.com"
datacenter = "dal13"
network_speed = 10000
private_network_only = false
tcp_monitoring = true
@greyhoundforty
greyhoundforty / gptprompt.md
Created April 18, 2023 19:21
chatGPT prompt

The current system is a containerized app. Tech stack: docker, python, ibm cloud schematics python SDK, ibm cloud core python SDK

High level: Use python to interact with the IBM Cloud schematics API. The code should allow for running destroy, plan, apply, and status check functions

Schematics workspaces can have the following status codes:

  1. INACTIVE = no resources are provisioned, need to run a workspace plan
  2. ACTIVE = workspace plan was applied and resources were deployed
@greyhoundforty
greyhoundforty / v2.py
Created April 18, 2023 15:57
ce-schematics-pyton-v2
import os
import logging
import time
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from ibm_cloud_sdk_core import ApiException
from ibm_schematics.schematics_v1 import SchematicsV1
from datetime import datetime
from logdna import LogDNAHandler
from dotenv import load_dotenv
@greyhoundforty
greyhoundforty / ce-sch-etcd.py
Created March 16, 2023 16:21
Schematics + Code Engine + Python
import sys
import json
import base64
import os
import etcd3
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from ibm_cloud_sdk_core import ApiException
from ibm_schematics.schematics_v1 import SchematicsV1
import time
@greyhoundforty
greyhoundforty / python-schematics-etcd.md
Created March 9, 2023 11:44
Python + Schematics + Etcd
import os
import sys
import json
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from ibm_cloud_sdk_core import ApiException
from ibm_schematics.schematics_v1 import SchematicsV1
import base64
import etcd3