Skip to content

Instantly share code, notes, and snippets.

unique_count = 0
last_value = ""
for x in some_list:
if x != last_value:
unique_count += 1
last_value = x
@grimm26
grimm26 / main.tf
Created November 11, 2022 20:55
handle presets and custom v2
variable "object_lifecycle_preset" {
description = <<-EOL
Choose a pre-configured set of object lifecycle rules for your bucket.
- empty_bucket: Delete all objects from the bucket. Use this in preparation to destroy the bucket. This is non-recoverable.
EOL
type = string
default = "default"
validation {
condition = contains(["empty_bucket", "default"], var.object_lifecycle_preset)
error_message = "You must select from one of the available presets: empty_bucket, default."
2022-11-10T16:14:24.687-0600 [INFO] Terraform version: 1.3.4
2022-11-10T16:14:24.688-0600 [DEBUG] using github.com/hashicorp/go-tfe v1.9.0
2022-11-10T16:14:24.688-0600 [DEBUG] using github.com/hashicorp/hcl/v2 v2.14.1
2022-11-10T16:14:24.688-0600 [DEBUG] using github.com/hashicorp/terraform-config-inspect v0.0.0-20210209133302-4fd17a0faac2
2022-11-10T16:14:24.688-0600 [DEBUG] using github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734
2022-11-10T16:14:24.688-0600 [DEBUG] using github.com/zclconf/go-cty v1.12.0
2022-11-10T16:14:24.688-0600 [INFO] Go runtime version: go1.19.3
2022-11-10T16:14:24.688-0600 [INFO] CLI args: []string{"/home/mkeisler/.local/bin/terraform", "version"}
2022-11-10T16:14:24.688-0600 [TRACE] Stdout is not a terminal
2022-11-10T16:14:24.688-0600 [TRACE] Stderr is not a terminal
@grimm26
grimm26 / main.tf
Created November 10, 2022 21:25
handle presets and custom
variable "object_lifecycle_preset" {
description = <<-EOL
Choose a pre-configured set of object lifecycle rules for your bucket.
- empty_bucket: Delete all objects from the bucket. Use this in preparation to destroy the bucket. This is non-recoverable.
EOL
type = string
default = "default"
validation {
condition = contains(["empty_bucket", "default"], var.object_lifecycle_preset)
error_message = "You must select from one of the available presets: empty_bucket."
@grimm26
grimm26 / terraform.log
Created September 30, 2022 16:11
output of terraform plan
2022-09-30T11:09:25.488-0500 [INFO] Terraform version: 1.3.1
2022-09-30T11:09:25.488-0500 [DEBUG] using github.com/hashicorp/go-tfe v1.9.0
2022-09-30T11:09:25.488-0500 [DEBUG] using github.com/hashicorp/hcl/v2 v2.14.1
2022-09-30T11:09:25.488-0500 [DEBUG] using github.com/hashicorp/terraform-config-inspect v0.0.0-20210209133302-4fd17a0faac2
2022-09-30T11:09:25.488-0500 [DEBUG] using github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734
2022-09-30T11:09:25.488-0500 [DEBUG] using github.com/zclconf/go-cty v1.11.0
2022-09-30T11:09:25.488-0500 [INFO] Go runtime version: go1.19.1
2022-09-30T11:09:25.488-0500 [INFO] CLI args: []string{"/home/mkeisler/.local/bin/terraform", "version"}
2022-09-30T11:09:25.488-0500 [TRACE] Stdout is not a terminal
2022-09-30T11:09:25.488-0500 [TRACE] Stderr is not a terminal
This file has been truncated, but you can view the full file.
2022-04-07T09:13:46.290-0500 [INFO] provider: configuring client automatic mTLS
2022-04-07T09:13:46.300-0500 [DEBUG] provider: starting plugin: path=.terraform/providers/enova.com/custom/site24x7/0.0.3/darwin_amd64/terraform-provider-site24x7 args=[.terraform/providers/enova.com/custom/site24x7/0.0.3/darwin_amd64/terraform-provider-site24x7]
2022-04-07T09:13:46.303-0500 [DEBUG] provider: plugin started: path=.terraform/providers/enova.com/custom/site24x7/0.0.3/darwin_amd64/terraform-provider-site24x7 pid=95357
2022-04-07T09:13:46.304-0500 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/enova.com/custom/site24x7/0.0.3/darwin_amd64/terraform-provider-site24x7
2022-04-07T09:13:46.392-0500 [INFO] provider.terraform-provider-site24x7: configuring server automatic mTLS: timestamp=2022-04-07T09:13:46.391-0500
2022-04-07T09:13:46.421-0500 [DEBUG] provider.terraform-provider-site24x7: plugin address: address=/var/folders/c3/r9ymngv5161cjgm06m91f59c0000gp/T/plugin307341672 network=unix timestamp=
@grimm26
grimm26 / tflog
Created February 24, 2022 03:52
tflog
2022-02-23T21:46:16.650-0600 [INFO] Terraform version: 1.1.6
2022-02-23T21:46:16.650-0600 [INFO] Go runtime version: go1.17.2
2022-02-23T21:46:16.650-0600 [INFO] CLI args: []string{"terraform", "apply", "-auto-approve"}
2022-02-23T21:46:16.650-0600 [TRACE] Stdout is a terminal of width 318
2022-02-23T21:46:16.650-0600 [TRACE] Stderr is a terminal of width 318
2022-02-23T21:46:16.650-0600 [TRACE] Stdin is a terminal
2022-02-23T21:46:16.650-0600 [DEBUG] Attempting to open CLI config file: /Users/gobblty/.terraformrc
2022-02-23T21:46:16.651-0600 [INFO] Loading CLI configuration from /Users/gobblty/.terraformrc
2022-02-23T21:46:16.651-0600 [DEBUG] checking for credentials in "/Users/gobblty/.terraform.d/plugins"
2022-02-23T21:46:16.651-0600 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2020/06/02 20:12:38+0000 [EROR] command_runner.go:516 terraforms/production_643927032162#3412: Unable to hide old comments: minimize comment MDEyOklzc3VlQ29tbWVudDcyODky: non-200 OK status code: 422 Unprocessable Entity body: "<!DOCTYPE html>\n<html>\n <head>\n <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\">\n <meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; base-uri 'self'; connect-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self'; style-src 'unsafe-inline'\">\n <meta content=\"origin\" name=\"referrer\">\n <title>Oh no &middot; GitHub</title>\n <meta name=\"viewport\" content=\"width=device-width\">\n <style type=\"text/css\" media=\"screen\">\n body {\n background-color: #f6f8fa;\n color: #24292e;\n font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;\n font-size: 14px;\n line-height: 1.5;\n m
@grimm26
grimm26 / terraform_stuff
Created February 28, 2020 15:09
making a policy
09:05:34 ❯ tf apply
data.aws_iam_policy_document.dms: Refreshing state...
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# aws_iam_policy.dms_policy will be created
@grimm26
grimm26 / main.tf
Last active January 11, 2020 22:48
bucket_create_one
provider "aws" {
region = "us-east-2"
}
module "bucket" {
source = "./s3_bucket"
name = "testbucketkjhqer98iuh"
}