Skip to content

Instantly share code, notes, and snippets.

@rot26
Last active May 14, 2020 03:52
Show Gist options
  • Save rot26/fcdf3fb9a64227a453c186c72a7d03dd to your computer and use it in GitHub Desktop.
Save rot26/fcdf3fb9a64227a453c186c72a7d03dd to your computer and use it in GitHub Desktop.
mutli-region refactor
# Checkout
git pull
git ck -b region-forwarder
# Setup Directories
mkdir -p terraform/cwe
mkdir -p terraform/sqs_lambda
# Make outputs for cwe
cat <<- EOF > terraform/cwe/output.tf
output "id" {
description = "Event Rule ID"
value = module.cwe.id
}
output "arn" {
description = "Event Rule Arn"
value = module.cwe.arn
}
EOF
# Move variables file
mv variables.tf terraform/sqs_lambda/variables.tf
# Append cloudwatch rules to variables file
cat <<- EOF >> terraform/sqs_lambda/variables.tf
variable "cloudwatch_event_rule_id" {
description = "Easy name of CWE"
type = string
}
variable "cloudwatch_event_rule_arn" {
description = "Full arn of CWE"
type = string
}
EOF
# Put most of the text in
mv *.tf terraform/cwe/main.tf
cp terraform/cwe/main.tf terraform/sqs_lambda/sqs_lambda.tf
# "GO FIX THE MODULE LABELS"
echo "GO FIX THE MODULE LABELS"
echo "terraform/cwe/main.tf"
echo "wrap source, rule_name, rule_description, event_pattern in:"
echo 'module "cwe" {'
echo '...'
echo '}'
echo "terraform/sqs_lambda/sqs_lambda.tf"
echo "wrap function_name .... to EOF in module"
echo 'module "sqs_lambda" {'
echo '...'
echo '}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment