Skip to content

Instantly share code, notes, and snippets.

View mhmdio's full-sized avatar
🇵🇸
Everything as a code

Mohammed Almusaddar mhmdio

🇵🇸
Everything as a code
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mhmdio on github.
  • I am mhmd (https://keybase.io/mhmd) on keybase.
  • I have a public key ASCqGWDrWbbWJ47Gf9xaAyhHJpKQZzM8ikv93ev2ZR3glgo

To claim this, I am signing this object:

@mhmdio
mhmdio / main.tf
Created March 31, 2021 19:28
terraform aws_availability_zones
data "aws_availability_zones" "available" {}
locals {
az_length = length(data.aws_availability_zones.available) > 3 ? 3 : length(data.aws_availability_zones.available)
azs = slice(data.aws_availability_zones.available.names, 0, local.az_length)
}
@mhmdio
mhmdio / yamldecode.tf
Created July 3, 2021 21:07
terraform yamldecode
locals {
raw_value = yamldecode(file("${path.module}/example.yaml"))
normalized_value = {
name = tostring(try(local.raw_value.name, null))
groups = try(local.raw_value.groups, [])
}
}
@mhmdio
mhmdio / terraform.tf
Created July 4, 2021 03:46
terraform block
terraform {
required_version = ">= 0.15.1"
backend "remote" {}
}
@mhmdio
mhmdio / usermod.sh
Last active July 6, 2021 12:09
usermod docker
sudo usermod -a -G docker USER
@mhmdio
mhmdio / tf-cfn.tf
Created July 28, 2021 13:02
terraform cloudformation stack
resource "aws_cloudformation_stack" "mq01" {
name = "${var.name}-mq01"
tags = var.tags
disable_rollback = false
template_body = file("${path.module}/cfn/mq.yaml")
parameters = {
AmazonMQBrokerName = "${var.name}-mq01"
AmazonMQHostInstanceType = "mq.t3.micro"
AmazonMQBrokerUser = "Admin"
@mhmdio
mhmdio / data.tf
Last active April 9, 2024 08:53
terraform data account_id and region
data "aws_caller_identity" "current" {} # data.aws_caller_identity.current.account_id
data "aws_region" "current" {} # data.aws_region.current.name
output "account_id" {
description = "Selected AWS Account ID"
value = data.aws_caller_identity.current.account_id
}
output "region" {
description = "Details about selected AWS region"
@mhmdio
mhmdio / tf-doc.md
Last active August 10, 2021 20:22
terraform-docs
@mhmdio
mhmdio / tf-tools.md
Last active August 23, 2021 13:59
Terraform Tools
@mhmdio
mhmdio / splunk-forwarder.md
Last active September 10, 2021 08:09
SplunkForwarder

Splunk Forwarder

cat > user-seed.conf <<EOF
[user_info]
USERNAME = csiem
PASSWORD = xxx
EOF

echo $PASS | sudo -S cp user-seed.conf $SPLUNK_HOME/etc/system/local/user-seed.conf