Skip to content

Instantly share code, notes, and snippets.

Avatar
☁️

Anton Babenko antonbabenko

☁️
View GitHub Profile
View gist:06ef9e96867e790e1a17ca958d2da95c
# Copy image from GHCR into private ECR
aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 835367859851.dkr.ecr.eu-west-1.amazonaws.com
docker pull ghcr.io/cloudquery/cloudquery:0.13.4
docker tag ghcr.io/cloudquery/cloudquery:0.13.4 835367859851.dkr.ecr.eu-west-1.amazonaws.com/cloudquery:0.13.4
docker push 835367859851.dkr.ecr.eu-west-1.amazonaws.com/cloudquery:0.13.4
# Run Postgres locally
View generate-terraform-wrappers.sh
#!/usr/bin/env bash
set -e
readonly CONTENT_MAIN_TF='module "wrapper" {}'
readonly CONTENT_VARIABLES_TF='variable "items" {
description = "Maps of items to create a wrapper from. Values are passed through to the module."
type = any
default = {}
}'
@antonbabenko
antonbabenko / setup.sh
Created Sep 17, 2020
Show GitHub sponsors as markdown using apex-up
View setup.sh
git clone git@github.com:tj/sponsors-api.git
cd sponsors-api
# Install up ( https://github.com/apex/up )
curl -sf https://up.apex.sh/install | sh
# Build the binary
GOOS=linux GOARCH=amd64 go build -o server cmd/sponsors-api/main.go
# Create config for up
@antonbabenko
antonbabenko / README.md
Created Sep 1, 2020
aws_ecs_service - The new ARN and resource ID format must be enabled to propagate tags.
View README.md

Error:

aws_ecs_service.atlantis: Creating...

Error: InvalidParameterException: The new ARN and resource ID format must be enabled to add tags to the service. Opt in to the new format and try again. "atlantis"

Solution - enable new features in AWS account:

@antonbabenko
antonbabenko / terraform-cost-estimation.rego
Created May 19, 2020
Terraform Cost Estimation + Open Policy Agent
View terraform-cost-estimation.rego
# Terraform Cost Estimation + Open Policy Agent
#
# This code snippet supports terraform state for now.
#
# Get the whole response:
# opa eval --data terraform-cost-estimation.rego --input terraform.tfstate --format pretty data.terraform_cost_estimation
#
# Get boolean response. Return false if state (per hour) is too expensive:
# opa eval --data terraform-cost-estimation.rego --input terraform.tfstate --format pretty data.terraform_cost_estimation.response.allowed
@antonbabenko
antonbabenko / gist:8eca477d28340d5116a2cd776bfd5e65
Last active May 7, 2020
AWS Cloudfront wishlist (due 19.5.2020)
View gist:8eca477d28340d5116a2cd776bfd5e65
1. Faster cache invalidation (eg, like stackpath has, for example). Maybe add flag to disable blocking which is helpful when using in automation? - Denis S.
2. Add brotli compression - Anton K.
3. Why different POPs have different distribution settings? Canada and Dallas sometimes have gzip disabled. - Anton K.
4. Allow to specify "latest" as version of AWS Lambda functions. - Uriah S.
@antonbabenko
antonbabenko / .bash_profile
Last active May 22, 2021
Make your terragrunt output useful
View .bash_profile
# Put this function in your ~/.bash_profile or similar and use `terragrunt` as before.
terragrunt () {
local action=$1
shift 1
command terragrunt $action "$@" 2>&1 | sed -E "s|$(dirname $(pwd))/||g;s|^\[terragrunt\]( [0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2})* ||g;s|(\[.*\]) [0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}|\1|g"
}
@antonbabenko
antonbabenko / ecs-codedeploy
Last active Mar 12, 2021
This script performs deployment of ECS Service using AWS CodeDeploy
View ecs-codedeploy
#!/usr/bin/env bash
#######################################################################
# This script performs deployment of ECS Service using AWS CodeDeploy
#
# Heavily inspired by https://github.com/silinternational/ecs-deploy ,
# which unfortunately can't be used to deploy ECS service when `deployment_option=ECS`
#
# Author: Anton Babenko
# URL: https://github.com/antonbabenko
View crash.log
2018/01/17 12:16:50 [INFO] Terraform version: 0.11.2 a6008b8a48a749c7c167453b9cf55ffd572b9a5d
2018/01/17 12:16:50 [INFO] Go runtime version: go1.9.1
2018/01/17 12:16:50 [INFO] CLI args: []string{"/usr/local/Cellar/tfenv/0.6.0/versions/0.11.2/terraform", "init"}
2018/01/17 12:16:50 [DEBUG] Attempting to open CLI config file: /Users/Bob/.terraformrc
2018/01/17 12:16:50 Loading CLI configuration from /Users/Bob/.terraformrc
2018/01/17 12:16:50 [INFO] CLI command args: []string{"init"}
2018/01/17 12:16:50 [DEBUG] command: loading backend config file: /Users/Bob/Sites/terracing-test-repo/terraform
2018/01/17 12:16:50 [TRACE] module source: "terraform-aws-modules/security-group/aws//modules/http-80"
2018/01/17 12:16:50 [TRACE] "terraform-aws-modules/security-group/aws//modules/http-80" is a registry module
2018/01/17 12:16:50 [INFO] no matching version for "terraform-aws-modules/security-group/aws//modules/http-80"<>, no versions found
@antonbabenko
antonbabenko / gist:fc8b73b2086f488014b1a8b4de842863
Last active Nov 21, 2017
Upcoming HashiCorp User Group Oslo meetups
View gist:fc8b73b2086f488014b1a8b4de842863
https://www.meetup.com/Oslo-HashiCorp-User-Group
20.11.2017 - Terraform Q&A - https://www.meetup.com/Oslo-HashiCorp-User-Group/events/243890303
* Anton Babenko, https://twitter.com/antonbabenko
Beginning/middle of January - Packer:
* Anders Bruvik, https://twitter.com/bruvik
* Marek Piątek, https://twitter.com/piontas
* Anton Babenko, https://twitter.com/antonbabenko