This repository has been archived by the owner on Nov 6, 2023. It is now read-only.
generated from dwp/dataworks-repo-template-terraform
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
51 lines (41 loc) · 1.45 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
SHELL:=bash
aws_profile=default
aws_profile_mgt_dev=dataworks-management-dev
aws_region=eu-west-2
default: help
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: bootstrap
bootstrap: ## Bootstrap local environment for first use
@make git-hooks
pip3 install --user Jinja2 PyYAML boto3
@{ \
export AWS_PROFILE=$(aws_profile); \
export AWS_REGION=$(aws_region); \
export AWS_PROFILE_MGT_DEV=$(aws_profile_mgt_dev); \
python3 bootstrap_terraform.py; \
}
terraform fmt -recursive
.PHONY: git-hooks
git-hooks: ## Set up hooks in .githooks
@git submodule update --init .githooks ; \
git config core.hooksPath .githooks \
.PHONY: terraform-init
terraform-init: ## Run `terraform init` from repo root
terraform init
.PHONY: terraform-plan
terraform-plan: ## Run `terraform plan` from repo root
terraform plan
.PHONY: terraform-apply
terraform-apply: ## Run `terraform apply` from repo root
terraform apply
.PHONY: terraform-workspace-new
terraform-workspace-new: ## Creates new Terraform workspace with Concourse remote execution. Run `terraform-workspace-new workspace=<workspace_name>`
declare -a workspace=( qa integration preprod production ) \
make bootstrap ; \
cp terraform.tf jeff.tf && \
for i in "$${workspace[@]}" ; do \
fly -t aws-concourse execute --config create-workspace.yml --input repo=. -v workspace="$$i" ; \
done
rm jeff.tf