This script will pull down an S3 remote configuration before running any terraform actions. Assumes the following structure:
main.tf
terraform.cfg
env/dev/vars
env/staging/vars
env/whatever/vars
env/whatever/somefile.tf
| Jenkins.instance.queue.items.findAll { !it.task.name.contains("Extenda") }.each { | |
| println "Cancel ${it.task.name}" | |
| Jenkins.instance.queue.cancel(it.task) | |
| } | |
| Jenkins.instance.items.each { | |
| stopJobs(it) | |
| } | |
| def stopJobs(job) { | |
| if (job in jenkins.branch.OrganizationFolder) { | |
| // Git behaves well so no need to traverse it. |
| #!/usr/bin/env bash | |
| set -e | |
| # Formats any *.tf files according to the hashicorp convention | |
| files=$(git diff --cached --name-only) | |
| for f in $files | |
| do | |
| if [ -e "$f" ] && [[ $f == *.tf ]]; then | |
| #terraform validate `dirname $f` | |
| terraform fmt $f |
| /** | |
| * Required Variables. | |
| */ | |
| variable "name" {} | |
| variable "port" {} | |
| variable "elb_security_group" {} | |
| variable "elb_subnets" {} |
| /** | |
| * Load balancer. | |
| */ | |
| resource "aws_elb" "main" { | |
| name = "${var.name}" | |
| internal = true | |
| cross_zone_load_balancing = true |
This script will pull down an S3 remote configuration before running any terraform actions. Assumes the following structure:
main.tf
terraform.cfg
env/dev/vars
env/staging/vars
env/whatever/vars
env/whatever/somefile.tf
| from csv import DictWriter | |
| from glob import glob | |
| from ofxparse import OfxParser | |
| DATE_FORMAT = "%m/%d/%Y" | |
| def write_csv(statement, out_file): | |
| print "Writing: " + out_file | |
| fields = ['date', 'payee', 'debit', 'credit', 'balance'] | |
| with open(out_file, 'w') as f: |
| cd into /tmp/kitchen. | |
| /opt/chef/embedded/bin/gem install chef-zero | |
| /opt/chef/embedded/bin/chef-zero -d | |
| knife cookbook upload -a -c client.rb | |
| chef-shell -z -c client.rb -o '<YOUR RECIPE>' |
REGEX remove blank lines:
FROM: http://www.ultraedit.com/support/tutorials_power_tips/ultraedit/remove_blank_lines.html
FIND:
^(?:[\t ]*(?:\r?\n|\r))+
| # knife cheat | |
| ## Search Examples | |
| knife search "name:ip*" | |
| knife search "platform:ubuntu*" | |
| knife search "platform:*" -a macaddress | |
| knife search "platform:ubuntu*" -a uptime | |
| knife search "platform:ubuntu*" -a virtualization.system | |
| knife search "platform:ubuntu*" -a network.default_gateway |
| wget http://stedolan.github.io/jq/download/linux64/jq | |
| aws ec2 describe-instances --filters "Name=tag:Name,Values=$NAME" \ | |
| "Name=instance-state-name,Values=running" \ | |
| | jq -r \ | |
| ".Reservations[] | .Instances[] | .InstanceId" \ | |
| aws ec2 describe-volumes --filters \ | |
| "Name=status,Values=available" \ | |
| | jq -r ".Volumes[] | .VolumeId" \ |