summaryrefslogtreecommitdiff
path: root/example/Makefile
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2021-02-03 16:35:48 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2021-02-03 16:35:48 +0100
commitbafe762ac01d16904c18404283027e426e19bc73 (patch)
treec22688ad186f5ce635f525704c5035f91b983b68 /example/Makefile
parent91abd0b04320a9c9d932df195aca38c1cacfcc5a (diff)
downloadrules-sandbox-bafe762ac01d16904c18404283027e426e19bc73.tar.gz
rules-sandbox-bafe762ac01d16904c18404283027e426e19bc73.tar.bz2
rules-sandbox-bafe762ac01d16904c18404283027e426e19bc73.tar.xz
rules-sandbox-bafe762ac01d16904c18404283027e426e19bc73.zip
Code reorganization.
Moving main code to src, keeping modules in modules/
Diffstat (limited to 'example/Makefile')
-rw-r--r--example/Makefile41
1 files changed, 41 insertions, 0 deletions
diff --git a/example/Makefile b/example/Makefile
new file mode 100644
index 0000000..39d54a6
--- /dev/null
+++ b/example/Makefile
@@ -0,0 +1,41 @@
+terraform_version=0.14.4
+terraform_url=https://releases.hashicorp.com/terraform/$(terraform_version)/terraform_$(terraform_version)_linux_amd64.zip
+terraform_unzip=.terraform/unzip/$(terraform_version)/
+terraform_zip=.terraform/zip/terraform_$(terraform_version)_linux_amd64.zip
+terraform_bin=.terraform/bin/terraform
+
+ansiblevault_version=2.0.1
+ansiblevault_url=https://github.com/MeilleursAgents/terraform-provider-ansiblevault/releases/download/v$(ansiblevault_version)/terraform-provider-ansiblevault_linux_amd64_v$(ansiblevault_version)
+ansiblevault_path=terraform.d/plugins/linux_amd64/terraform-provider-ansiblevault_v$(ansiblevault_version)_x4
+
+all: $(terraform_bin) $(ansiblevault_path) setup
+
+$(terraform_bin): $(terraform_zip)
+ rm -rf $(dir $(terraform_unzip))
+ mkdir -p $(terraform_unzip)
+ mkdir -p $(dir $(terraform_bin))
+ unzip $(terraform_zip) -d $(terraform_unzip)
+ ln -sf $(PWD)/$(terraform_unzip)/terraform $(terraform_bin)
+ touch $(PWD)/$(terraform_unzip)/terraform
+
+$(terraform_zip):
+ mkdir -p $(dir $@)
+ curl -L -o "$@" $(terraform_url)
+
+$(ansiblevault_path): terraform.d
+ mkdir -p $(dir $@)
+ curl -L -o "$@" $(ansiblevault_url)
+ chmod +x $(@)
+
+terraform.d:
+ mkdir $@
+
+MAIN=$(patsubst %/main.tf,%,$(wildcard */main.tf))
+setup: $(patsubst %,%/terraform.d,$(MAIN))
+.PHONY: setup
+
+%/terraform.d: terraform.d
+ ln -s ../terraform.d $@
+
+.terraform/plugins/linux_amd64:
+ mkdir -p $@