Skip to content

Instantly share code, notes, and snippets.

View jnahelou's full-sized avatar

jnahelou

View GitHub Profile
var.app_security_audit_passed
Enter a value: true
null_resource.ips_whitelist: Refreshing state... (ID: 4995369097748485300)
null_resource.ips_whitelist_infos: Refreshing state... (ID: 5103843319032705965)
aws_security_group.sg.0: Refreshing state... (ID: sg-99cb4be1)
aws_security_group.sg.1: Refreshing state... (ID: sg-0bcb4b73)
aws_elb.elb: Refreshing state... (ID: test)
aws_security_group_rule.allow_from_internet_http.0: Refreshing state... (ID: sgrule-1238533004)
aws_security_group_rule.allow_from_internet_http.1: Refreshing state... (ID: sgrule-530970083)
@jnahelou
jnahelou / getTerraformProviders.sh
Last active November 10, 2017 10:21
Download latest providers from Terraform repository
#!/bin/bash
while IFS= read -r provider
do
VERSION=`curl -s https://releases.hashicorp.com/${provider}/ | egrep -oh 'terraform-provider-[a-z0-9]+/[0-9\.]+' | sort | uniq | tail -n1`
FILENAME=`echo $VERSION | sed 's;/;_;g'`
echo "https://releases.hashicorp.com/${VERSION}/${FILENAME}_linux_amd64.zip"
wget -O "/usr/local/terraform/toolbox/providers/${FILENAME}_linux_amd64.zip" "https://releases.hashicorp.com/${VERSION}/${FILENAME}_linux_amd64.zip"
done < <(curl -s https://releases.hashicorp.com/ | egrep -oh 'terraform-provider-[a-z0-9]+' | sort | uniq)
find /usr/local/terraform/toolbox/providers/ -name '*.zip' -exec unzip -o -d /usr/local/terraform/toolbox/providers/ {} \;
find /usr/local/terraform/toolbox/providers/ -name '*.zip' -exec rm -f {} \;
@jnahelou
jnahelou / main.go
Created December 29, 2017 16:45
Draft anti-affinity
package main
import (
"context"
"fmt"
"log"
"net/url"
"github.com/vmware/govmomi"
"github.com/vmware/govmomi/find"
@jnahelou
jnahelou / hcl
Created August 7, 2018 08:43
helm provider example
provider "helm" {
kubernetes {
host = "https://ww.xx.yy.zz"
username = "root-retail"
password = "mouahahaa"
}
}
provider "kubernetes" {
host = "https://ww.xx.yy.zz"
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: nfs-web
spec:
host: nfs-web-svc
trafficPolicy:
loadBalancer:
simple: RANDOM
---
@jnahelou
jnahelou / f5-vip.tf
Created August 20, 2018 15:13
VIP for F5
provider "bigip" {}
resource "bigip_ltm_node" "node" {
name = "/Common/10.2.0.2"
address = "10.2.0.2"
}
resource "bigip_ltm_pool" "pool" {
name = "/Common/my-pool"
monitors = ["/Common/http"]
@jnahelou
jnahelou / dump-vault-kv.pl
Created September 27, 2018 10:37
Dump all Vault KV
#!/usr/bin/perl -w
use strict;
use JSON -support_by_pp;
use Data::Dumper;
# Don't forget to login to vault first
sub rec {
my ($path) = @_;
my $json = JSON->new->pretty;
@jnahelou
jnahelou / inspec-iggy-tf0.12.patch
Last active October 18, 2019 09:50
Patch to use inspec-iggy with terraform 0.12
--- gems/2.5.0/gems/inspec-iggy-0.6.0/lib/inspec-iggy/terraform/generate.rb 2019-08-08 13:27:19.494150516 +0200
+++ gems/2.5.0/gems/inspec-iggy-0.6.0/lib/inspec-iggy/terraform/generate.rb 2019-10-18 11:46:58.920277083 +0200
@@ -30,31 +30,31 @@
def self.parse_resources(tfstate, resource_path, _platform)
# iterate over the resources
resources = {}
- tfstate['modules'].each do |m|
- tf_resources = m['resources']
- tf_resources.keys.each do |tf_res|
- resource_type = tf_resources[tf_res]['type']
@jnahelou
jnahelou / mirror_auth.patch
Last active October 16, 2020 20:55
Terraform patch to add authentication headers during provider download
diff --git a/command/providers_mirror.go b/command/providers_mirror.go
index 029b08630..db0760d95 100644
--- a/command/providers_mirror.go
+++ b/command/providers_mirror.go
@@ -4,6 +4,8 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
+ "log"
+ "net/http"
@jnahelou
jnahelou / main.tf
Created October 16, 2020 22:11
hello provider
terraform {
required_providers {
hello = {
source = "registry1.jnahelou.net/jnahelou/hello"
}
}
}
provider "hello" {
nickname = "jnahelou"