Skip to content

Instantly share code, notes, and snippets.

@vancluever
vancluever / genselfsignedcrt.sh
Created February 7, 2018 21:42
OpenSSL self-signed cert one-liner
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -keyout server.key -out server.crt
@vancluever
vancluever / asciinema.bashrc
Created January 4, 2018 05:37
Add a recording signal to your bash prompt if you are using asciinema
if [ -n "${ASCIINEMA_REC}" ]; then
PS1='[\[\e[31m\]•REC\[\e[0m\] \W]\$ '
else
PS1='[\u@\h \W]\$ '
fi
@vancluever
vancluever / ssh-agent.service
Created January 4, 2018 05:19
SSH agent systemd service
[Unit]
Description=OpenSSH Agent
[Service]
Type=simple
Environment=SSH_AUTH_SOCK="%t/ssh-agent.socket"
ExecStart=/usr/bin/ssh-agent -D -t 14400 -a "${SSH_AUTH_SOCK}"
[Install]
WantedBy=default.target
@vancluever
vancluever / vecty_hello.go
Created June 7, 2017 15:19
A small-ish example on how to use vecty
package plan
import (
"log"
"github.com/davecgh/go-spew/spew"
"github.com/gopherjs/vecty"
"github.com/gopherjs/vecty/elem"
"github.com/gopherjs/vecty/event"
"github.com/gopherjs/vecty/prop"
@vancluever
vancluever / resource_aws_security_group_attachment.go
Created June 6, 2017 15:40
Start of a security group attachment resource (attach a SG to a single instance or ENI)
package aws
import (
"fmt"
"github.com/hashicorp/terraform/helper/schema"
)
func resourceAwsSecurityGroupAttachment() *schema.Resource {
return &schema.Resource{
@vancluever
vancluever / nomaddiff.log
Last active June 3, 2017 02:25
Nomad diff
2017/06/02 19:18:33 [INFO] Terraform version: 0.9.6 dev f84310e15c4f307fda900cc543894591bf98ea16+CHANGES
2017/06/02 19:18:33 [INFO] Go runtime version: go1.8.3
2017/06/02 19:18:33 [INFO] CLI args: []string{"/home/chrism/Documents/code/GOPATH/bin/terraform", "plan", "-out", "terraform.tfplan"}
2017/06/02 19:18:33 [DEBUG] Detected home directory from env var: /home/chrism
2017/06/02 19:18:33 [DEBUG] Detected home directory from env var: /home/chrism
2017/06/02 19:18:33 [DEBUG] Attempting to open CLI config file: /home/chrism/.terraformrc
2017/06/02 19:18:33 [INFO] CLI command args: []string{"plan", "-out", "terraform.tfplan"}
2017/06/02 19:18:33 [DEBUG] Detected home directory from env var: /home/chrism
2017/06/02 19:18:33 [DEBUG] command: loading backend config file: /home/chrism/src/tf_examples/nomad_job_custom_diff_test
2017/06/02 19:18:33 [DEBUG] command: no data state file found for backend config
@vancluever
vancluever / DIFFNOTES.md
Created May 24, 2017 17:59
Terraform ResourceDiff notes

Why we don't want to use diff in ResourceDiff

  • scheamMap.diff needs d (and a bunch of other stuff)
  • writers don't generally need this stuff
  • relationship should be
  • scheaMap -> resource helper -> reader/writer

Challenges

  • Storing computed values in a pseudo-diff correctly
  • newValueWriter - A map[string]struct{Value interface{} Computed bool}
  • OR
@vancluever
vancluever / acme-new-config.tf
Last active May 18, 2017 20:00
Brainstorming config for work to get terraform-provider-acme upstream
variable "cert_domains" {
type = "list"
default = [
"www.example.com",
"www.example.org",
]
}
provider "acme" {
@vancluever
vancluever / new-names-module-usage.tf
Last active April 15, 2017 17:56
Using the new-form names module (Terraform v0.9.x and higher)
module "names" {
source = "./names"
endpoint_name = "frontend"
}
output "endpoint_name" {
value = "${module.names.endpoint_name}"
}
@vancluever
vancluever / names-module-tf-v0.9.x.tf
Created April 15, 2017 17:23
Names module (Terraform v0.9.x and higher)
variable "endpoint_name" {
type = "string"
}
variable "domains" {
type = "map"
default = {
"production" = "foobar.local"
"staging" = "dev.foobar.local"