Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Marchesi vancluever

View GitHub Profile
@vancluever
vancluever / mixed_indent_hcl.go
Created Apr 26, 2018
HCL + Go mixed indentation example (vim-airline)
View mixed_indent_hcl.go
package main
import "fmt"
const fooBar = `
resource "foo" "bar" {
a = "b"
}
`
@vancluever
vancluever / genselfsignedcrt.sh
Created Feb 7, 2018
OpenSSL self-signed cert one-liner
View genselfsignedcrt.sh
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -keyout server.key -out server.crt
@vancluever
vancluever / asciinema.bashrc
Created Jan 4, 2018
Add a recording signal to your bash prompt if you are using asciinema
View asciinema.bashrc
if [ -n "${ASCIINEMA_REC}" ]; then
PS1='[\[\e[31m\]•REC\[\e[0m\] \W]\$ '
else
PS1='[\u@\h \W]\$ '
fi
@vancluever
vancluever / ssh-agent.service
Created Jan 4, 2018
SSH agent systemd service
View ssh-agent.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 Jun 7, 2017
A small-ish example on how to use vecty
View vecty_hello.go
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 Jun 6, 2017
Start of a security group attachment resource (attach a SG to a single instance or ENI)
View resource_aws_security_group_attachment.go
package aws
import (
"fmt"
"github.com/hashicorp/terraform/helper/schema"
)
func resourceAwsSecurityGroupAttachment() *schema.Resource {
return &schema.Resource{
View nomaddiff.log
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
Terraform ResourceDiff notes
View DIFFNOTES.md

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
Brainstorming config for work to get terraform-provider-acme upstream
View acme-new-config.tf
variable "cert_domains" {
type = "list"
default = [
"www.example.com",
"www.example.org",
]
}
provider "acme" {
@vancluever
vancluever / new-names-module-usage.tf
Last active Apr 15, 2017
Using the new-form names module (Terraform v0.9.x and higher)
View new-names-module-usage.tf
module "names" {
source = "./names"
endpoint_name = "frontend"
}
output "endpoint_name" {
value = "${module.names.endpoint_name}"
}
You can’t perform that action at this time.