Skip to content

Instantly share code, notes, and snippets.

Avatar
☁️

Cameron Stokes clstokes

☁️
View GitHub Profile
@clstokes
clstokes / index.ts
Created Mar 26, 2020 — forked from kevink/index.ts
Test Script for AWS infra
View index.ts
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";
import * as pulumi from "@pulumi/pulumi";
//import { VpcEndpointService } from "@pulumi/aws/ec2";
// ****************************************************************************************************************************************
// Grab some secrets from our config file
// ****************************************************************************************************************************************
@clstokes
clstokes / index.ts
Created Dec 3, 2018
Pulumi Example: Create multiple AWS IAM Roles.
View index.ts
import * as aws from "@pulumi/aws";
const assumeRolePolicyDocument = JSON.stringify({
Version: "2012-10-17",
Statement: [{
Action: "sts:AssumeRole",
Principal: {
Service: "ec2.amazonaws.com"
},
Effect: "Allow",
@clstokes
clstokes / assume-role-policy.json
Last active Dec 10, 2020
Example: Terraform IAM Role
View assume-role-policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
View iam.tf
variable "role_name" {}
variable "role_policy_file" {}
resource "aws_iam_role" "role" {
name = "${var.role_name}"
assume_role_policy = "${file("${path.module}/policies/${var.role_policy_file}")}"
}
output "role_arn" {
value = "${aws_iam_role.role.arn}"
View gist:3d157e784b1d60af283d
### Keybase proof
I hereby claim:
* I am clstokes on github.
* I am clstokes (https://keybase.io/clstokes) on keybase.
* I have a public key whose fingerprint is B970 5386 3BE3 EAE8 446A 1FA8 AAC4 B68D A32C 32D4
To claim this, I am signing this object:
@clstokes
clstokes / gist:07ad4202a3fa6c627df4
Last active Nov 13, 2015
🐛 Terraform: No ingress rules were found...
View gist:07ad4202a3fa6c627df4
clstokes-mbpro:consul-cluster clstokes$ terraform apply aws-nat-consul-cluster/terraform/
atlas_artifact.consul: Refreshing state... (ID: us-east-1:ami-fa522a90,us-west-2:ami-9b4150fa)
atlas_artifact.consul_client: Refreshing state... (ID: us-east-1:ami-0e5f2764,us-west-2:ami-35435254)
template_file.consul_update: Refreshing state... (ID: d82b4576930c7fe3d4a263ba5b15ed833c1cd9e5b984b1c9b92447dff46a2459)
aws_vpc.main: Refreshing state... (ID: vpc-36b13452)
aws_key_pair.main: Refreshing state... (ID: atlas-example)
aws_subnet.subnet_b: Refreshing state... (ID: subnet-dd7077f6)
aws_subnet.subnet_c: Refreshing state... (ID: subnet-803eccf6)
aws_security_group.admin_access: Refreshing state... (ID: sg-4d38a62b)
aws_security_group.consul: Refreshing state... (ID: sg-4c38a62a)
@clstokes
clstokes / do-ubuntu.json
Last active Nov 10, 2015
📝 Working HashiCorp Atlas and DigitalOcean example.
View do-ubuntu.json
{
"variables": {
"region": "nyc2",
"source_image": "ubuntu-14-04-x64",
"atlas_username": "{{ env `ATLAS_USERNAME` }}",
"atlas_name": "digitalocean-example"
},
"builders": [{
"type": "digitalocean",
"image": "{{user `source_image`}}",
View output
provider "aws" {
access_key = "ASDF"
secret_key = "ASDF"
region = "us-east-1"
}
resource "aws_security_group" "no_modifications_single_ingress" {
name = "no_modifications_single_ingress"
description = "this security group causes NO modifications each run"
@clstokes
clstokes / gist:5a107c30f88eac4057de
Created May 18, 2015
terraform variables and split function
View gist:5a107c30f88eac4057de
variable "subnet_cidr_blocks" {
default = "192.168.0.0/24,192.168.1.0/24,192.168.2.0/24"
}
@clstokes
clstokes / Not working
Last active Aug 29, 2015
consul-template debugging
View Not working
mac-c02nx126g5rp:consul-poc clstokes$ cat consul-template/ingest.ctmpl
{{range $key, $pairs := tree "databases" | byKey}}
{{ $key }}:{{with $url := printf "databases/%s/url" $key }}
url: {{ key $url }}
#urlPath: {{ $url }} <- for troubleshooting purposes
{{end}}{{end}}
mac-c02nx126g5rp:consul-poc clstokes$ ~/cc/other/consul-template/bin/consul-template -consul 127.0.0.1:8500 -template "consul-template/ingest.ctmpl:build/out" -dry -once -log-level debug
2015/03/09 10:11:26 [INFO] (runner) creating new runner (dry: true, once: true)
2015/03/09 10:11:26 [INFO] (runner) creating consul/api client
2015/03/09 10:11:26 [DEBUG] (runner) setting address to 127.0.0.1:8500