Skip to content

Instantly share code, notes, and snippets.

View rifelpet's full-sized avatar
👋

Peter Rifel rifelpet

👋
View GitHub Profile
@rifelpet
rifelpet / gist:f30959d868a1c580d73f8492ae4b84d6
Created April 25, 2023 17:45
terraform-provider-google instance template unique ID (v4.59.0)
TF_LOG=debug ./terraform apply
2023-04-25T17:40:40.576Z [INFO] Terraform version: 1.4.5
2023-04-25T17:40:40.576Z [DEBUG] using github.com/hashicorp/go-tfe v1.18.0
2023-04-25T17:40:40.576Z [DEBUG] using github.com/hashicorp/hcl/v2 v2.16.2
2023-04-25T17:40:40.576Z [DEBUG] using github.com/hashicorp/terraform-config-inspect v0.0.0-20210209133302-4fd17a0faac2
2023-04-25T17:40:40.576Z [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.0
2023-04-25T17:40:40.576Z [DEBUG] using github.com/zclconf/go-cty v1.12.1
2023-04-25T17:40:40.577Z [INFO] Go runtime version: go1.19.6
2023-04-25T17:40:40.577Z [INFO] CLI args: []string{"./terraform", "apply"}
2023-04-25T17:40:40.577Z [DEBUG] Attempting to open CLI config file: /home/user/.terraformrc
@rifelpet
rifelpet / gist:993436c77c6b3e11df4a3373e6e50515
Last active April 25, 2023 16:27
terraform-provider-google instance template unique ID
$ TF_LOG=debug ./terraform init
2023-04-25T16:12:36.346Z [INFO] Terraform version: 1.4.5
2023-04-25T16:12:36.346Z [DEBUG] using github.com/hashicorp/go-tfe v1.18.0
2023-04-25T16:12:36.346Z [DEBUG] using github.com/hashicorp/hcl/v2 v2.16.2
2023-04-25T16:12:36.346Z [DEBUG] using github.com/hashicorp/terraform-config-inspect v0.0.0-20210209133302-4fd17a0faac2
2023-04-25T16:12:36.346Z [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.0
2023-04-25T16:12:36.346Z [DEBUG] using github.com/zclconf/go-cty v1.12.1
2023-04-25T16:12:36.346Z [INFO] Go runtime version: go1.19.6
2023-04-25T16:12:36.346Z [INFO] CLI args: []string{"./terraform", "init"}
2023-04-25T16:12:36.346Z [DEBUG] Attempting to open CLI config file: /home/user/.terraformrc
@rifelpet
rifelpet / main.go
Last active February 11, 2023 00:28
hcl2 - hclwrite printing maps over multiple lines
package main
import (
"fmt"
"sort"
"github.com/hashicorp/hcl/v2/hclsyntax"
"github.com/hashicorp/hcl/v2/hclwrite"
"github.com/zclconf/go-cty/cty"
@rifelpet
rifelpet / failed-pod.yaml
Created February 12, 2020 23:21
Failed Pod
apiVersion: v1
kind: Pod
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{},"name":"termination-demo","namespace":"default"},"spec":{"containers":[{"args":["-c","sleep 10 \u0026\u0026 echo Sleep expired \u003e /dev/termination-log \u0026\u0026 exit 1"],"command":["/bin/sh"],"image":"debian","name":"termination-demo-container"}],"restartPolicy":"Never"}}
creationTimestamp: "2020-02-12T23:20:07Z"
name: termination-demo
namespace: default
resourceVersion: "3520883"
@rifelpet
rifelpet / TF_LOG=trace terraform0.12 0.12upgrade
Last active April 12, 2019 17:02
Terraform 0.12.0-beta1 dropping inline comments during 0.12upgrade
2019/04/12 09:58:07 [INFO] Terraform version: 0.12.0 beta1
2019/04/12 09:58:07 [INFO] Go runtime version: go1.11.5
2019/04/12 09:58:07 [INFO] CLI args: []string{"/path/to/terraform", "0.12upgrade"}
2019/04/12 09:58:07 [DEBUG] Attempting to open CLI config file: /Users/user/.terraformrc
2019/04/12 09:58:07 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/04/12 09:58:07 [INFO] CLI command args: []string{"0.12upgrade"}
2019/04/12 09:58:07 [DEBUG] command: asking for input: "Would you like to upgrade the module in the current directory?"
This command will rewrite the configuration files in the given directory so
that they use the new syntax features from Terraform v0.12, and will identify
@rifelpet
rifelpet / cleanup.py
Created March 27, 2019 17:08
Unused AWS Security Group cleanup
#!/usr/bin/env python3
import boto3
dryrun = True
regions = boto3.client('ec2').describe_regions()['Regions']
for region in regions:
print('\n\n{}\n\n'.format(region['RegionName']))
ec2 = boto3.client('ec2', region_name=region['RegionName'])
@rifelpet
rifelpet / terraform-plan.log
Created July 9, 2018 22:38
Planning a terraform state with DNS provider v2.0.0 and a dummy secret_key set
2018/07/09 22:36:00 [INFO] Terraform version: 0.11.7 41e50bd32a8825a84535e353c3674af8ce799161
2018/07/09 22:36:00 [INFO] Go runtime version: go1.10.1
2018/07/09 22:36:00 [INFO] CLI args: []string{"/bin/terraform", "plan"}
2018/07/09 22:36:00 [DEBUG] Attempting to open CLI config file: /root/.terraformrc
2018/07/09 22:36:00 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2018/07/09 22:36:00 [INFO] CLI command args: []string{"plan"}
2018/07/09 22:36:00 [INFO] command: empty terraform config, returning nil
2018/07/09 22:36:00 [DEBUG] command: no data state file found for backend config
2018/07/09 22:36:00 [DEBUG] New state was assigned lineage "9f320145-4cc1-2039-c9c8-6804bcc44faf"
2018/07/09 22:36:00 [INFO] command: backend initialized: <nil>