Skip to content

Commit

Permalink
Added consistent Makefile and .env file
Browse files Browse the repository at this point in the history
In order to make the engineer's experience more consistent between
projects the new standard Makefile has been added.
  • Loading branch information
Stephen James committed Sep 28, 2023
1 parent 65d748e commit a686f84
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export AWS_PROFILE=mojo-shared-services-cli
export AWS_VAULT_PROFILE=mojo-shared-services-cli

### ci ###
export ENV=ci
58 changes: 56 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,57 @@
#!make
include .env
export

fmt:
aws-vault exec $$AWS_VAULT_PROFILE -- terraform fmt --recursive

init:
aws-vault exec $$AWS_VAULT_PROFILE -- terraform init

workspace-list:
aws-vault exec $$AWS_VAULT_PROFILE -- terraform workspace list

workspace-select:
aws-vault exec $$AWS_VAULT_PROFILE -- terraform workspace select $$ENV || \
aws-vault exec $$AWS_VAULT_PROFILE -- terraform workspace new $$ENV

validate:
aws-vault exec $$AWS_VAULT_PROFILE -- terraform validate

plan-out:
aws-vault exec $$AWS_VAULT_PROFILE -- terraform plan -no-color > $$ENV.tfplan

plan:
aws-vault exec $$AWS_VAULT_PROFILE -- terraform plan

refresh:
aws-vault exec $$AWS_VAULT_PROFILE -- terraform refresh

output:
aws-vault exec $$AWS_VAULT_PROFILE -- terraform output -json

apply:
terraform apply
./scripts/ensure_cloudwatch_log_retention_policies.sh
aws-vault exec $$AWS_VAULT_PROFILE -- terraform apply
./scripts/ensure_cloudwatch_log_retention_policies.sh

state-list:
aws-vault exec $$AWS_VAULT_PROFILE -- terraform state list

show:
aws-vault exec $$AWS_VAULT_PROFILE -- terraform show -no-color

# destroy:
# aws-vault exec $$AWS_VAULT_PROFILE -- terraform destroy

clean:
rm -rf .terraform/ terraform.tfstate*

get-secrets:
aws-vault exec $$AWS_VAULT_PROFILE -- sh ./scripts/get_secrets.sh

s3-audit:
aws-vault exec $$AWS_VAULT_PROFILE -- sh ./scripts/s3_versioning_audit.sh

.PHONY:
fmt init workspace-list workspace-select validate plan-out plan \
refresh output apply state-list show destroy clean get-secrets s3-audit

0 comments on commit a686f84

Please sign in to comment.