Skip to content

Instantly share code, notes, and snippets.

import boto3
from datetime import datetime
import sys
def get_acm_certificates(region):
"""
Query ACM certificates and report their domain name, in-use status, and certificate status.
"""
# Initialize ACM client
acm_client = boto3.client('acm', region_name=region)
#!/usr/bin/env python3
import os
import sys
import json
from datetime import datetime, timedelta
import requests
import boto3
import boto3
import sys
def has_ecs_create_permissions(policy_document):
"""
Check if the policy document contains permissions to create ECS resources.
"""
for statement in policy_document.get("Statement", []):
# move_blocks.py
# This script is used to generate move blocks
# as we move to the new module
# usage: python move_blocks.py <workspace_file> <variable_name> <module_name>
# The file name, the local variable map name and the module name that loops over
# workspaces, unfortunately vary
# typical example to create a moved.tf:
# account_name = account_name.replace("-","_")
# python move_blocks.py main.tf <account_name>_workspaces <account_name> >> moved.tf
import sys
import boto3
import sys
def has_ecs_create_permissions(policy_document):
"""
Check if the policy document contains permissions to create ECS resources.
"""
for statement in policy_document.get("Statement", []):
@bneutra
bneutra / terraform_check_examples.tf
Created July 28, 2023 20:45
terraform_check_examples.tf
# precondition vs check
# precondition:
# - raises
# - stop you at plan
# check:
# - warns
# - to be used with TFC "Continuous Validation"
# - i.e. alert when check warnings emerge
# Uses for precondition and check
#!/usr/bin/env python
import concurrent.futures
import logging
import os
import sys
import time
from collections import deque
import click
from dictdiffer import diff
# This is a quick/dirty script to pull as much collector and source
# data from sumo as possible but some massaging of the terraform
# it generates is requires.
# It also produces a shell script to import the resources
import json
import os
import pprint
import requests
pprinter=pprint.PrettyPrinter(indent=4)
require 'ruby-jmeter'
# flush stdout immediately
$stdout.sync = true
# default to Dockerfile jmeter location
jmeter_path = ENV['JMETER_BIN'] ? ENV['JMETER_BIN'] : '/opt/jmeter/bin/'
json_path = File.dirname(__FILE__) + '/claim.json'
gui = false # only true for non docker testing
claim_url = ARGV[0] # e.g. https://your/api
#!/bin/bash
# docker entrypoint for running ruby jmeter in docker
set -e
freeMem=`awk '/MemFree/ { print int($2/1024) }' /proc/meminfo`
s=$(($freeMem/10*8))
x=$(($freeMem/10*8))
n=$(($freeMem/10*2))
export JVM_ARGS="-Xmn${n}m -Xms${s}m -Xmx${x}m"
mkdir -p /mnt/output