Skip to content

Instantly share code, notes, and snippets.

@grantorchard
grantorchard / .import_envvars.sh
Created September 24, 2019 02:23
Bash file to import environment variables from 1Password.
#!/bin/bash
# Login to 1Password.
# Assumes you have installed the OP CLI and performed the initial configuration
# For more details see https://support.1password.com/command-line-getting-started/
eval $(op signin my)
# My setup uses a 1Password type of 'Password' and stores all records within a
# single section. The label is the key, and the value is the value.
ev=`op get item "Environment Variables"`
@grantorchard
grantorchard / blueprint.yaml
Created May 2, 2019 03:45
Working with Cloud Assembly inputs
formatVersion: 1
inputs:
image:
type: string
title: Operating System
enum:
- ubuntu 16.04
- ubuntu 18.04
default: ubuntu 16.04
count:
@grantorchard
grantorchard / blueprint.yaml
Created May 1, 2019 03:48
multi-az rds instance
formatVersion: 1
inputs: {}
resources:
RDS_Cluster_1:
type: Cloud.Service.AWS.RDS.Cluster
dependsOn:
- Cloud_Network_1
properties:
region: ap-southeast-2
account: SDDC APJ AWS
@grantorchard
grantorchard / cloud_assembly_iam_agnostic.json
Created April 2, 2019 06:30
IAM role for Cloud Assembly, for use with agnostic blueprints only
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::*"
},
{
@grantorchard
grantorchard / blueprint.yaml
Last active May 17, 2019 01:21
Agnostic Machine with Static IP
formatVersion: 1
resources:
Cloud_Machine_1:
type: Cloud.Machine
properties:
image: 'ubuntu'
flavor: 'small'
networks:
- name: '${resource.Cloud_Network_1.name}'
constraints:
@grantorchard
grantorchard / gist:20a51fc23138d38e9f818fd81158446b
Created October 23, 2017 11:40
baseurl with default value
@classmethod
def login(self, key, baseurl='https://console-stg.cloud.vmware.com/csp/gateway'):
uri = '/am/api/auth/login/accounts/access-keys'
headers = {'Content-Type':'application/json'}
payload = json.dumps({'key': key})
r = requests.post(f'{baseurl}{uri}', headers = headers, data = payload)
auth_header = r.json()['cspAuthToken']
p = r.json()
return self(key, auth_header, baseurl)

Keybase proof

I hereby claim:

  • I am grantorchard on github.
  • I am grantorchard (https://keybase.io/grantorchard) on keybase.
  • I have a public key ASDFkZjlwyxcCAegyR-9aR5iu7a-mS-2AESM4U79BPdSOAo

To claim this, I am signing this object: