Skip to content

Instantly share code, notes, and snippets.

View dayglojesus's full-sized avatar
:shipit:

Brian Warsing dayglojesus

:shipit:
View GitHub Profile
@dayglojesus
dayglojesus / weird.tf
Last active May 7, 2021 22:25
Not sure why this does what it does
###########################################################
# Setup
###########################################################
terraform {
required_version = ">= 0.15"
experiments = [
module_variable_optional_attrs
]
}
@dayglojesus
dayglojesus / tf_debug.log
Created December 14, 2018 21:24
TF_LOG=debug Output
2018/12/14 13:17:15 [INFO] Terraform version: 0.11.10 17850e9a55d33c43d7c31fd6ac122ba97a51d899
2018/12/14 13:17:15 [INFO] Go runtime version: go1.11.1
2018/12/14 13:17:15 [INFO] CLI args: []string{"/Users/user/bin/terraform", "plan"}
2018/12/14 13:17:15 [DEBUG] Attempting to open CLI config file: /Users/user/.terraformrc
2018/12/14 13:17:15 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/12/14 13:17:15 [INFO] CLI command args: []string{"plan"}
2018/12/14 13:17:15 [INFO] command: empty terraform config, returning nil
2018/12/14 13:17:15 [DEBUG] command: no data state file found for backend config
2018/12/14 13:17:15 [DEBUG] New state was assigned lineage "46fef3c5-9474-8e09-f50c-b170d716d722"
2018/12/14 13:17:15 [INFO] command: backend initialized: <nil>
@dayglojesus
dayglojesus / gist:96375c2daa6ecedc398b729b2a585bca
Created November 18, 2017 20:19
terraform template_file rendering issue
2017/11/18 12:14:18 [INFO] Terraform version: 0.11.0 ec9d4f1d0f90e8ec5148f94b6d634eb542a4f0ce+CHANGES
2017/11/18 12:14:18 [INFO] Go runtime version: go1.9
2017/11/18 12:14:18 [INFO] CLI args: []string{"/Users/foo/bin/terraform-0110", "apply"}
2017/11/18 12:14:18 [DEBUG] Attempting to open CLI config file: /Users/foo/.terraformrc
2017/11/18 12:14:18 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2017/11/18 12:14:18 [INFO] CLI command args: []string{"apply"}
2017/11/18 12:14:18 [INFO] command: empty terraform config, returning nil
2017/11/18 12:14:18 [DEBUG] command: no data state file found for backend config
2017/11/18 12:14:18 [DEBUG] New state was assigned lineage "fe1f49c5-fff2-478c-8afc-c7470610d0c9"
2017/11/18 12:14:18 [INFO] command: backend initialized: <nil>
@dayglojesus
dayglojesus / preflight-docker-upgrade.rb
Last active July 9, 2017 19:21
preflight script for docker upgrade from 17.03.0-ce to 17.06.0-ce
#!/usr/bin/env ruby
# pre-flight script for docker upgrade from 17.03.0-ce to 17.06.0-ce
# Issue: https://github.com/docker/for-linux/issues/49
require 'json'
module JSON
def self.load_file(path)
parse File.read(path)
end
@dayglojesus
dayglojesus / pry_session.rb
Last active October 7, 2015 17:40
Domain partial match in Foreman Nic::Interface#normalize_name
[1] pry(main)> Domain.all
=> []
[2] pry(main)> Host.all
=> []
[3] pry(main)> Host.create name: "host-00.foo.bar.com"
=> #<Host::Managed id: 1, name: "host-00.foo.bar.com", last_compile: nil, last_report: nil, updated_at: "2015-10-07 16:40:41", created_at: "2015-10-07 16:40:41", root_pass: nil, puppet_status: 0, architecture_id: nil, operatingsystem_id: nil, environment_id: nil, ptable_id: nil, medium_id: nil, build: false, comment: nil, disk: nil, installed_at: nil, model_id: nil, hostgroup_id: nil, owner_id: nil, owner_type: nil, enabled: true, puppet_ca_proxy_id: nil, managed: false, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: nil, puppet_proxy_id: nil, certname: nil, image_id: nil, organization_id: nil, location_id: nil, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: nil, grub_pass: "">
[4] pry(main)> Host.all.first.domain
=> nil
[5] pry(main)> Domain.create name: "bar.com"
=> #<Domain id: 1, name: "bar.com", fullname: nil, created_at: "2015-
@dayglojesus
dayglojesus / domain_available.rb
Created March 29, 2015 17:44
Custom Facter Fact: domain_available?
# Change the value of the `target` variable
require 'puppet'
require 'socket'
require 'timeout'
Facter.add("domain_available?") do
confine :operatingsystem => :darwin
setcode do
class Ping
@dayglojesus
dayglojesus / gist:3302a23ef641ae0d6745
Created January 26, 2015 20:08
Referencing the value of another fact
require 'puppet'
Facter.add("node_id") do
confine :operatingsystem => :darwin
setcode do
primary_mac = Facter[:macaddress].value.delete(':')
"node-#{primary_mac}"
end
end
@dayglojesus
dayglojesus / domain_available?.rb
Last active August 29, 2015 14:13
Facter: domain_available?
# Edit the target variable to point to your AD domain
# Adjust timeout (less than max_timeout) and port as appropriate.
# Could be used to test any service really...
#
# We return Strings, strange? Yes. Facter doesn't like booleans and Hiera can't interpolate
# anything other than strings.
# Everything in Strings!
require 'puppet'
require 'socket'
newproperty(:shared) do
newvalue(true, false)
def insync?(is)
puts "You will never get here."
end
munge do |value|
@resource.munge_boolean(value)
end
@dayglojesus
dayglojesus / error_dump
Created December 22, 2013 23:23
CFPropertyList: Format error! (CFFormatError)
[15:18:01] bcw$ ~/Desktop/foo.rb
/Library/Ruby/Gems/2.0.0/gems/CFPropertyList-2.2.5/lib/rbREXMLParser.rb:101:in `block in import_xml': Format error! (CFFormatError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rexml/element.rb:905:in `block in each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rexml/xpath.rb:67:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rexml/xpath.rb:67:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rexml/element.rb:905:in `each'
from /Library/Ruby/Gems/2.0.0/gems/CFPropertyList-2.2.5/lib/rbREXMLParser.rb:93:in `import_xml'
from /Library/Ruby/Gems/2.0.0/gems/CFPropertyList-2.2.5/lib/rbREXMLParser.rb:102:in `block in import_xml'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rexml/element.rb:905:in `block in each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rexml/x