Skip to content

Instantly share code, notes, and snippets.

View Laxman-SM's full-sized avatar

Laxman Singh Laxman-SM

  • Ex-Phenome, Ex-Intertrust, Ex-Wipro
  • US, Hyderabad (india)
View GitHub Profile
@Laxman-SM
Laxman-SM / credentials
Created December 7, 2021 00:25 — forked from bertrandmartel/credentials
Assume role with MFA for terraform/terragrunt (https://stackoverflow.com/a/66878739/2614364)
[prod]
aws_secret_access_key = redacted
aws_access_key_id = redacted
[tf_temp]
[tf]
credential_process = sh -c 'mfa.sh arn:aws:iam::{account_id}:role/{role} arn:aws:iam::{account_id}:mfa/{mfa_entry} prod 2> $(tty)'
def COLOR_MAP = [
'SUCCESS': 'good',
'FAILURE': 'danger',
]
properties([pipelineTriggers([githubPush()])])
pipeline {
agent any
environment {
//put your environment variables
@Laxman-SM
Laxman-SM / tfonly
Created August 15, 2020 05:39 — forked from immanuelpotter/tfonly
If you only want to perform actions on resources in one terraform file, this will do that for you
#!/bin/bash
COMMAND="$1"
TF_FILE="$2"
usage(){
echo "Usage: $0 (plan|apply|destroy) [tf-filename]"
}
@Laxman-SM
Laxman-SM / cluster.tf
Created August 7, 2020 17:46 — forked from cwoolum/cluster.tf
AKS Cluster with Managed Identity and an ACR
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West US 2"
}
data "azurerm_client_config" "current" {
}
resource "azurerm_kubernetes_cluster" "example" {
name = "example-aks1"
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"route53:ListHostedZones",
"route53:GetChange"
],
"Resource": [
@Laxman-SM
Laxman-SM / get_spot_price.py
Created July 15, 2020 18:41 — forked from brunodasilvalenga/get_spot_price.py
Script python to get spot price with last 4 hours.
import boto3
import datetime
client = boto3.client('ec2', region_name='us-west-2')
regions = [x["RegionName"] for x in client.describe_regions()["Regions"]]
print(regions)
INSTANCE = "t3.xlarge"
print("Instance: %s" % INSTANCE)
results = []
for region in regions:
client = boto3.client('ec2', region_name=region)
@Laxman-SM
Laxman-SM / get-all-the-k8s-things-yaml.sh
Created March 5, 2020 15:24
Get all the kubernetes objects YAML from your cluster
for n in $(kubectl get -o=name namespaces | cut -f 2 -d "/"); do
for o in $(kubectl get -o=name pvc,configmap,serviceaccount,secret,ingress,service,deployment,statefulset,hpa,job,cronjob --namespace $n); do
mkdir -p $(dirname $o)
kubectl get -o=yaml --export $o --namespace $n >$o.yaml
done
done
@Laxman-SM
Laxman-SM / print_kubernetes_resource.sh
Created March 4, 2020 09:26
print kubernetes resources
#/!bin/bash
print_kubernetes_resource() {
printf "\n\nGlobal\n======"
resource_count=$(expr $(kubectl api-resources --namespaced=false | wc -l) - 1)
resources=$(kubectl api-resources --namespaced=false | tail -n $resource_count | awk '{print $1}')
for resource in $resources; do
printf "\n\nChecking $resource...\n"
kubectl get $resource
done
@Laxman-SM
Laxman-SM / envs
Created March 2, 2020 09:33 — forked from tsaito-cyber/envs
kubernetes-fluentd-deamonset.sh
LOG_GROUP_NAME=xxxxxxxxxxx
AWS_ACCESS_KEY_ID=xxxxxxxxxxx
AWS_SECRET_ACCESS_KEY=xxxxxxxxxxx
AWS_REGION=ap-northeast-1