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 / 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
@greyhoundforty
greyhoundforty / ws-run.py
Created March 1, 2023 17:42
Python Schematics SDK Test
import os
import sys
import json
from pprint import pprint
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from ibm_cloud_sdk_core import ApiException
from ibm_schematics.schematics_v1 import SchematicsV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
import time
@greyhoundforty
greyhoundforty / schematics-python.md
Last active February 28, 2023 18:57
Schematics Python Example
import os
import sys
import json 
from pprint import pprint
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from ibm_cloud_sdk_core import ApiException
from ibm_schematics.schematics_v1 import SchematicsV1

# Set up IAM authenticator
@greyhoundforty
greyhoundforty / vpc-gpu.md
Created February 20, 2023 23:03
VPC GPU with Terraform

data.tf

data "ibm_is_ssh_key" "sshkey" {
  name = var.existing_ssh_key
}

# Pull in the zones in the region
data "ibm_is_zones" "regional" {
  region = var.region
@greyhoundforty
greyhoundforty / sg-variables.tf
Created January 25, 2023 18:19
Security Group Rules for Terraform for loop
variable "security_group_rules" {
description = "A list of security group rules to be added to the default vpc security group"
type = list(
object({
name = string
direction = string
remote = string
tcp = optional(
object({
port_max = optional(number)
@greyhoundforty
greyhoundforty / ibmcloud-vpc.md
Last active January 19, 2023 20:27
Sample IBM Cloud VPC with Terraform

providers.tf

Check the IBM Provider page for the latest version available.

terraform {
  required_providers {
    ibm = {
      source  = "IBM-Cloud/ibm"
      version = "1.49.0"
@greyhoundforty
greyhoundforty / icd.tf
Created January 19, 2023 15:47
ICD Terraform Example with Connection Information
data "ibm_resource_group" "group" {
name = var.resource_group
}
resource "random_string" "admin_password" {
length = 16
special = false
}