diff --git a/.config/.pre-commit-config.yaml b/.config/.pre-commit-config.yaml index 380ad8f..ad5d0ef 100644 --- a/.config/.pre-commit-config.yaml +++ b/.config/.pre-commit-config.yaml @@ -3,8 +3,13 @@ exclude: '(^.+\.log$)' default_language_version: python: python3 repos: + - repo: https://github.com/gitleaks/gitleaks + rev: v8.16.1 + hooks: + - id: gitleaks + - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 + rev: v4.6.0 hooks: - id: check-yaml - id: end-of-file-fixer @@ -25,8 +30,4 @@ repos: args: - --allow-missing-credentials - - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.74.2 - hooks: - - id: terraform_validate - - id: terraform_fmt + diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index ce62777..02f4314 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - image: [ TFEnv, TFlint, TerraformDocs ] # Specify the Docker images you want to build + image: [ TEnv, TFlint, TerraformDocs ] # Specify the Docker images you want to build steps: - name: Checkout repository diff --git a/Makefile b/Makefile index 2859009..2e92830 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,7 @@ TERRASCAN_CONFIG ?= $(DEFAULT_TERRASCAN_CONFIG) TERRAFORM_DOCS_CONFIG ?= $(DEFAULT_TERRAFORM_DOCS_CONFIG) ifdef CICD_MODE - TFENV_EXEC ?= $(shell which tfenv) + TENV_EXEC ?= $(shell which tenv) TERRAFORM_EXEC ?= $(shell which terraform) TFLINT_RUN ?= $(shell which tflint) --config $(shell pwd)/$(TFLINT_CONFIG) PRECOMMIT_RUN ?= $(shell which pre-commit) @@ -93,7 +93,7 @@ ifdef CICD_MODE TERRAFORM_DOCS ?= $(shell which terraform-docs) SCOUTSUITE_EXEC ?= $(shell which scout) else - TFENV_EXEC = $(DOCKER_COMPOSE) exec terraform + TENV_EXEC = $(DOCKER_COMPOSE) exec terraform TERRAFORM_EXEC = $(DOCKER_COMPOSE) exec terraform TFLINT_RUN = $(DOCKER_COMPOSE_DEV_TOOLS) run --rm lint --config ${DOCKER_WORKDIR}/$(TFLINT_CONFIG) PRECOMMIT_RUN = $(DOCKER_COMPOSE_DEV_TOOLS) run --rm precommit @@ -111,7 +111,7 @@ debug: ## Print debug logs debug: ifeq ($(PRINT_DEBUG),"true") printenv - echo $(TFENV_EXEC) + echo $(TENV_EXEC) echo $(TERRAFORM_EXEC) echo $(TFLINT_RUN) echo $(PRECOMMIT_RUN) @@ -142,74 +142,74 @@ endif console_commands: ifndef CICD_MODE - $(TFENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tfenv install" + $(TENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tenv ${TENV_TOOL} install" $(DOCKER_COMPOSE) exec -w ${DOCKER_WORKDIR}/${CURRENT_DIR} terraform /bin/sh endif terraform_validate: ifdef CICD_MODE - cd ${CURRENT_DIR} && tfenv install + cd ${CURRENT_DIR} && tenv install cd ${CURRENT_DIR} && terraform validate else - $(TFENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tfenv install" - $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && terraform validate" + $(TENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tenv ${TENV_TOOL} install" + $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && ${TENV_TOOL} validate" endif terraform_format: ifdef CICD_MODE - cd ${CURRENT_DIR} && $(TFENV_EXEC) install - cd ${CURRENT_DIR} && terraform fmt -recursive + cd ${CURRENT_DIR} && $(TENV_EXEC) install + cd ${CURRENT_DIR} && ${TENV_TOOL} fmt -recursive else - $(TFENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tfenv install" - $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && terraform fmt -recursive" + $(TENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tenv ${TENV_TOOL} install" + $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && ${TENV_TOOL} fmt -recursive" endif # Combination of Terraform commands to install a stack layer terraform_install_commands: ifdef CICD_MODE cd ${CURRENT_DIR} && if [ -f .python-version ]; then pyenv install -s && pyenv local; fi && python3 --version - cd ${CURRENT_DIR} && tfenv install - cd ${CURRENT_DIR} && terraform $(TERRAFORM_INIT) - cd ${CURRENT_DIR} && terraform apply ${PLAN_BINARY_FILE} + cd ${CURRENT_DIR} && tenv ${TENV_TOOL} install + cd ${CURRENT_DIR} && ${TENV_TOOL} $(TERRAFORM_INIT) + cd ${CURRENT_DIR} && ${TENV_TOOL} apply ${PLAN_BINARY_FILE} else - $(TFENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && if [ -f .python-version ]; then pyenv install -s && pyenv local; fi && python3 --version" - $(TFENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tfenv install" - $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && terraform $(TERRAFORM_INIT)" - $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && terraform apply -compact-warnings ${TERRAFORM_VAR_PARAMETERS}" + $(TENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && if [ -f .python-version ]; then pyenv install -s && pyenv local; fi && python3 --version" + $(TENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tfenv ${TENV_TOOL} install" + $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && ${TENV_TOOL} $(TERRAFORM_INIT)" + $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && ${TENV_TOOL} apply -compact-warnings ${TERRAFORM_VAR_PARAMETERS}" endif # Combination of Terraform commands to apply a stack layer terraform_apply_commands: ifdef CICD_MODE - cd ${CURRENT_DIR} && tfenv install + cd ${CURRENT_DIR} && tenv ${TENV_TOOL} install cd ${CURRENT_DIR} && if [ -f .python-version ]; then pyenv install -s && pyenv local; fi && python3 --version - cd ${CURRENT_DIR} && terraform apply ${PLAN_BINARY_FILE} + cd ${CURRENT_DIR} && ${TENV_TOOL} apply ${PLAN_BINARY_FILE} else - $(TFENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && if [ -f .python-version ]; then pyenv install -s && pyenv local; fi && python3 --version" - $(TFENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tfenv install" - $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && terraform apply -compact-warnings ${TERRAFORM_VAR_PARAMETERS}" + $(TENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && if [ -f .python-version ]; then pyenv install -s && pyenv local; fi && python3 --version" + $(TENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tenv ${TENV_TOOL} install" + $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && ${TENV_TOOL} apply -compact-warnings ${TERRAFORM_VAR_PARAMETERS}" endif # Combination of Terraform commands to init a stack layer terraform_init_commands: ifdef CICD_MODE - cd ${CURRENT_DIR} && tfenv install - cd ${CURRENT_DIR} && terraform $(TERRAFORM_INIT) + cd ${CURRENT_DIR} && tenv ${TENV_TOOL} install + cd ${CURRENT_DIR} && ${TENV_TOOL} $(TERRAFORM_INIT) else - $(TFENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tfenv install" - $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && terraform $(TERRAFORM_INIT)" + $(TENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tenv ${TENV_TOOL} install" + $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && ${TENV_TOOL} $(TERRAFORM_INIT)" endif # Combination of Terraform commands to plan a stack layer terraform_plan_commands: ifdef CICD_MODE - cd ${CURRENT_DIR} && $(TFENV_EXEC) install - cd ${CURRENT_DIR} && terraform plan ${TERRAFORM_VAR_PARAMETERS} -out ${PLAN_BINARY_FILE} - cd ${CURRENT_DIR} && terraform show -json ${PLAN_BINARY_FILE} > ${PLAN_JSON_FILE} + cd ${CURRENT_DIR} && $(TENV_EXEC) ${TENV_TOOL} install + cd ${CURRENT_DIR} && ${TENV_TOOL} plan ${TERRAFORM_VAR_PARAMETERS} -out ${PLAN_BINARY_FILE} + cd ${CURRENT_DIR} && ${TENV_TOOL} show -json ${PLAN_BINARY_FILE} > ${PLAN_JSON_FILE} else - $(TFENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tfenv install" - $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && terraform plan -compact-warnings ${TERRAFORM_VAR_PARAMETERS} -out ${PLAN_BINARY_FILE}" - $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && terraform show -json ${PLAN_BINARY_FILE} > ${PLAN_JSON_FILE}" + $(TENV_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tenv ${TENV_TOOL} install" + $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && ${TENV_TOOL} plan -compact-warnings ${TERRAFORM_VAR_PARAMETERS} -out ${PLAN_BINARY_FILE}" + $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && ${TENV_TOOL} show -json ${PLAN_BINARY_FILE} > ${PLAN_JSON_FILE}" endif terraform_lint: @@ -221,21 +221,21 @@ endif # Terraform commands to delete a stack layer terraform_destroy_commands: ifdef CICD_MODE - cd ${CURRENT_DIR} && tfenv install - cd ${CURRENT_DIR} && terraform destroy ${TERRAFORM_VAR_PARAMETERS} + cd ${CURRENT_DIR} && tenv ${TENV_TOOL} install + cd ${CURRENT_DIR} && ${TENV_TOOL} destroy ${TERRAFORM_VAR_PARAMETERS} else - $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tfenv install" - $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && terraform apply -destroy ${TERRAFORM_VAR_PARAMETERS}" + $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tenv ${TENV_TOOL} install" + $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && ${TENV_TOOL} apply -destroy ${TERRAFORM_VAR_PARAMETERS}" endif # Terraform commands to delete a stack layer from a binary plan terraform_destroyauto_commands: ifdef CICD_MODE - cd ${CURRENT_DIR} && tfenv install - cd ${CURRENT_DIR} && terraform apply -destroy ${TERRAFORM_VAR_PARAMETERS} -auto-approve + cd ${CURRENT_DIR} && tenv ${TENV_TOOL} install + cd ${CURRENT_DIR} && ${TENV_TOOL} apply -destroy ${TERRAFORM_VAR_PARAMETERS} -auto-approve else - $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tfenv install" - $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && terraform apply -destroy ${TERRAFORM_VAR_PARAMETERS} -auto-approve" + $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && tenv ${TENV_TOOL} install" + $(TERRAFORM_EXEC) /bin/sh -c "cd ${CURRENT_DIR} && ${TENV_TOOL} apply -destroy ${TERRAFORM_VAR_PARAMETERS} -auto-approve" endif # Trivy commands to scan a stack layer @@ -379,7 +379,7 @@ logout: precommit: ## Launch precommit hooks precommit: - $(PRECOMMIT_RUN) run --rm -a --config ./$(PRECOMMIT_CONFIG) + $(PRECOMMIT_RUN) run -a --config ./$(PRECOMMIT_CONFIG) dotenv_lint: ## Lint dotenv files dotenv_lint: @@ -418,39 +418,29 @@ quality-checks: dotenv_lint format_all validate_all lint_all precommit markdown_ generate_documentation: ## DEPRECATED: Generate Terraform Documentation generate_documentation: $(DOCKER_COMPOSE_DEV_TOOLS) run --rm --remove-orphans terraform_docs terraform/demo --config=./${TERRAFORM_DOCS_CONFIG} - $(DOCKER_COMPOSE_DEV_TOOLS) run --rm --remove-orphans terraform_docs terraform/demo2 --config=./${TERRAFORM_DOCS_CONFIG} - $(DOCKER_COMPOSE_DEV_TOOLS) run --rm --remove-orphans terraform_docs terraform/demo3 --config=./${TERRAFORM_DOCS_CONFIG} render_templates: ## Render all templates render_templates: terraform_terrascan: ## DEPRECATED: Terrascan Terraform terraform_terrascan: - $(TERRASCAN_RUN) scan -i terraform --verbose --config-path=./.terrascan_config.toml --iac-dir=terraform/demo --iac-dir=terraform/demo2 --iac-dir=terraform/demo3 + $(TERRASCAN_RUN) scan -i terraform --verbose --config-path=./.terrascan_config.toml --iac-dir=terraform/demo format: ## DEPREATED: Format all Terraform files using "terraform fmt" format: @$(MAKE) --no-print-directory terraform_format CURRENT_DIR="terraform/demo" - @$(MAKE) --no-print-directory terraform_format CURRENT_DIR="terraform/demo2" - @$(MAKE) --no-print-directory terraform_format CURRENT_DIR="terraform/demo3" trivy: ## DEPRECATED: Terraform Trivy trivy: $(TRIVY_RUN) config terraform/demo --config=./.config/${TRIVY_CONFIG} --skip-dirs .terraform - $(TRIVY_RUN) config terraform/demo2 --config=./.config/${TRIVY_CONFIG} --skip-dirs .terraform - $(TRIVY_RUN) config terraform/demo3 --config=./.config/${TRIVY_CONFIG} --skip-dirs .terraform validate: ## DEPRECATED: Validate all Terraform files using "terraform validate" validate: @$(MAKE) --no-print-directory terraform_validate CURRENT_DIR="terraform/demo" - @$(MAKE) --no-print-directory terraform_validate CURRENT_DIR="terraform/demo2" - @$(MAKE) --no-print-directory terraform_validate CURRENT_DIR="terraform/demo3" lint: ## DEPRECATED: Check that good naming practices are respected in Terraform files (using tflint) lint: $(TFLINT_RUN) --init @$(MAKE) --no-print-directory terraform_lint CURRENT_DIR="terraform/demo" - @$(MAKE) --no-print-directory terraform_lint CURRENT_DIR="terraform/demo2" - @$(MAKE) --no-print-directory terraform_lint CURRENT_DIR="terraform/demo3" terraform_docs_terraform_demo: ## Generate terraform/demo layer Terraform Documentation terraform_docs_terraform_demo: @@ -512,155 +502,34 @@ destroy_terraform_demo: destroyauto_terraform_demo: ## Uninstall AWS terraform/demo layer automaticaly destroyauto_terraform_demo: @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo terraform_destroyauto_commands -terraform_docs_terraform_demo2: ## Generate terraform/demo2 layer Terraform Documentation -terraform_docs_terraform_demo2: - @$(MAKE) --no-print-directory terraform_docs_commands CURRENT_DIR="terraform/demo2" TERRAFORM_DOCS_CONFIG=.config/.terraform-docs.yml -terrascan_terraform_demo2: ## Terrascan Terraform terraform/demo2 layer -terrascan_terraform_demo2: - @$(MAKE) --no-print-directory terrascan_commands CURRENT_DIR="terraform/demo2" TERRASCAN_CONFIG=.config/.terrascan_config.toml -format_terraform_demo2: ## Format terraform/demo2 layer Terraform files using "terraform fmt" -format_terraform_demo2: - @$(MAKE) --no-print-directory terraform_format CURRENT_DIR="terraform/demo2" - -trivy_terraform_demo2: ## Terraform trivy terraform/demo2 layer -trivy_terraform_demo2: - @$(MAKE) --no-print-directory trivy_commands CURRENT_DIR=terraform/demo2 TRIVY_CONFIG=.config/.trivy.yaml -validate_terraform_demo2: ## Validate AWS terraform/demo2 layer -validate_terraform_demo2: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo2 terraform_validate - -tflint_terraform_demo2: ## Terraform code goot practices check with tflint on terraform/demo2 layer -tflint_terraform_demo2: - @$(MAKE) --no-print-directory terraform_lint CURRENT_DIR=terraform/demo2 TFLINT_CONFIG=.config/.tflint.hcl -markdown_lint_terraform_demo2: ## Lint Markdown files files on terraform/demo2 layer -markdown_lint_terraform_demo2: - @$(MAKE) --no-print-directory markdown_lint_commands CURRENT_DIR=terraform/demo2 MARKDOWNLINT_CONFIG=.config/.mdl_style.rb -shell_lint_terraform_demo2: ## Lint shell files files on terraform/demo2 layer -shell_lint_terraform_demo2: - @$(MAKE) --no-print-directory shell_lint_commands CURRENT_DIR=terraform/demo2 SHELLCHECK_CONFIG=.config/.shellcheckrc -yaml_lint_terraform_demo2: ## Lint yaml files files on terraform/demo2 layer -yaml_lint_terraform_demo2: - @$(MAKE) --no-print-directory yaml_lint_commands CURRENT_DIR=terraform/demo2 YAMLLINT_CONFIG=.config/.yamllintrc -console_terraform_demo2: ## Connect terraform Docker AWS terraform/demo2 layer -console_terraform_demo2: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo2 console_commands - -tsvc_terraform_demo2: ## Check terraform module version terraform/demo2 -tsvc_terraform_demo2: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo2 terraform_check_version_commands - -init_terraform_demo2: ## Init AWS terraform/demo2 layer -init_terraform_demo2: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo2 TERRAFORM_INIT_PARAMETERS="" terraform_init_commands - -plan_terraform_demo2: ## Plan AWS terraform/demo2 layer -plan_terraform_demo2: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo2 TERRAFORM_VAR_PARAMETERS="" terraform_plan_commands - -apply_terraform_demo2: ## Apply AWS terraform/demo2 layer -apply_terraform_demo2: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo2 TERRAFORM_VAR_PARAMETERS="" terraform_apply_commands - -install_terraform_demo2: ## Install AWS terraform/demo2 layer -install_terraform_demo2: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo2 TERRAFORM_VAR_PARAMETERS="" terraform_install_commands - -destroy_terraform_demo2: ## Uninstall AWS terraform/demo2 layer -destroy_terraform_demo2: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo2 TERRAFORM_VAR_PARAMETERS="" terraform_destroy_commands - -destroyauto_terraform_demo2: ## Uninstall AWS terraform/demo2 layer automaticaly -destroyauto_terraform_demo2: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo2 TERRAFORM_VAR_PARAMETERS="" terraform_destroyauto_commands -terraform_docs_terraform_demo3: ## Generate terraform/demo3 layer Terraform Documentation -terraform_docs_terraform_demo3: - @$(MAKE) --no-print-directory terraform_docs_commands CURRENT_DIR="terraform/demo3" -terrascan_terraform_demo3: ## Terrascan Terraform terraform/demo3 layer -terrascan_terraform_demo3: - @$(MAKE) --no-print-directory terrascan_commands CURRENT_DIR="terraform/demo3" -format_terraform_demo3: ## Format terraform/demo3 layer Terraform files using "terraform fmt" -format_terraform_demo3: - @$(MAKE) --no-print-directory terraform_format CURRENT_DIR="terraform/demo3" - -trivy_terraform_demo3: ## Terraform trivy terraform/demo3 layer -trivy_terraform_demo3: - @$(MAKE) --no-print-directory trivy_commands CURRENT_DIR=terraform/demo3 -validate_terraform_demo3: ## Validate AWS terraform/demo3 layer -validate_terraform_demo3: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo3 terraform_validate - -tflint_terraform_demo3: ## Terraform code goot practices check with tflint on terraform/demo3 layer -tflint_terraform_demo3: - @$(MAKE) --no-print-directory terraform_lint CURRENT_DIR=terraform/demo3 -markdown_lint_terraform_demo3: ## Lint Markdown files files on terraform/demo3 layer -markdown_lint_terraform_demo3: - @$(MAKE) --no-print-directory markdown_lint_commands CURRENT_DIR=terraform/demo3 -shell_lint_terraform_demo3: ## Lint shell files files on terraform/demo3 layer -shell_lint_terraform_demo3: - @$(MAKE) --no-print-directory shell_lint_commands CURRENT_DIR=terraform/demo3 -yaml_lint_terraform_demo3: ## Lint yaml files files on terraform/demo3 layer -yaml_lint_terraform_demo3: - @$(MAKE) --no-print-directory yaml_lint_commands CURRENT_DIR=terraform/demo3 -console_terraform_demo3: ## Connect terraform Docker AWS terraform/demo3 layer -console_terraform_demo3: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo3 console_commands - -tsvc_terraform_demo3: ## Check terraform module version terraform/demo3 -tsvc_terraform_demo3: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo3 terraform_check_version_commands - -init_terraform_demo3: ## Init AWS terraform/demo3 layer -init_terraform_demo3: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo3 terraform_init_commands - -plan_terraform_demo3: ## Plan AWS terraform/demo3 layer -plan_terraform_demo3: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo3 ADDITIONAL_VAR_PARAMETERS="-var-file=../common.tfvars" terraform_plan_commands - -apply_terraform_demo3: ## Apply AWS terraform/demo3 layer -apply_terraform_demo3: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo3 ADDITIONAL_VAR_PARAMETERS="-var-file=../common.tfvars" terraform_apply_commands - -install_terraform_demo3: ## Install AWS terraform/demo3 layer -install_terraform_demo3: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo3 ADDITIONAL_VAR_PARAMETERS="-var-file=../common.tfvars" terraform_install_commands - -destroy_terraform_demo3: ## Uninstall AWS terraform/demo3 layer -destroy_terraform_demo3: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo3 ADDITIONAL_VAR_PARAMETERS="-var-file=../common.tfvars" terraform_destroy_commands - -destroyauto_terraform_demo3: ## Uninstall AWS terraform/demo3 layer automaticaly -destroyauto_terraform_demo3: - @$(MAKE) --no-print-directory CURRENT_DIR=terraform/demo3 ADDITIONAL_VAR_PARAMETERS="-var-file=../common.tfvars" terraform_destroyauto_commands terraform_docs_all: ## Generate Terraform Documentation for all stacks -terraform_docs_all: terraform_docs_terraform_demo terraform_docs_terraform_demo2 terraform_docs_terraform_demo3 +terraform_docs_all: terraform_docs_terraform_demo terrascan_all: ## Terrascan Terraform -terrascan_all: terrascan_terraform_demo terrascan_terraform_demo2 terrascan_terraform_demo3 +terrascan_all: terrascan_terraform_demo format_all: ## Format all Terraform files using "terraform fmt" -format_all: format_terraform_demo format_terraform_demo2 format_terraform_demo3 +format_all: format_terraform_demo trivy_all: ## Terraform Trivy -trivy_all: trivy_terraform_demo trivy_terraform_demo2 trivy_terraform_demo3 +trivy_all: trivy_terraform_demo validate_all: ## Validate all Terraform files using "terraform validate" -validate_all: validate_terraform_demo validate_terraform_demo2 validate_terraform_demo3 +validate_all: validate_terraform_demo tflint_all: ## Terraform code goot practices check with tflint on all layers -tflint_all: tflint_terraform_demo tflint_terraform_demo2 tflint_terraform_demo3 +tflint_all: tflint_terraform_demo markdown_lint_all: ## Lint Markdown files files on all layers -markdown_lint_all: markdown_lint_terraform_demo markdown_lint_terraform_demo2 markdown_lint_terraform_demo3 +markdown_lint_all: markdown_lint_terraform_demo shell_lint_all: ## Lint shell files files on all layers -shell_lint_all: shell_lint_terraform_demo shell_lint_terraform_demo2 shell_lint_terraform_demo3 +shell_lint_all: shell_lint_terraform_demo yaml_lint_all: ## Lint yaml files files on all layers -yaml_lint_all: yaml_lint_terraform_demo yaml_lint_terraform_demo2 yaml_lint_terraform_demo3 +yaml_lint_all: yaml_lint_terraform_demo tsvc_all: ## Install all AWS layers -tsvc_all: tsvc_terraform_demo tsvc_terraform_demo2 tsvc_terraform_demo3 +tsvc_all: tsvc_terraform_demo init_all: ## Init all AWS layers -init_all: init_terraform_demo init_terraform_demo2 init_terraform_demo3 +init_all: init_terraform_demo plan_all: ## Plan all AWS layers -plan_all: init_terraform_demo init_terraform_demo2 init_terraform_demo3 +plan_all: init_terraform_demo install_all: ## Install all AWS layers -install_all: plan_terraform_demo plan_terraform_demo2 plan_terraform_demo3 +install_all: plan_terraform_demo destroy_all: ## Uninstall all layers -destroy_all: destroy_terraform_demo3 destroy_terraform_demo2 destroy_terraform_demo +destroy_all: destroy_terraform_demo ### Makefile customizations - diff --git a/automation/TEnv/Dockerfile b/automation/TEnv/Dockerfile new file mode 100644 index 0000000..cfbaac1 --- /dev/null +++ b/automation/TEnv/Dockerfile @@ -0,0 +1,64 @@ +ARG ALPINE_VERSION=3.20 +FROM "alpine:${ALPINE_VERSION}" + +# Runtime dependencies +RUN apk add --no-cache --purge \ + curl \ + aws-cli \ + python3 py3-pip \ + git \ + wget \ + openssh-client \ + make \ + zip zip-doc \ + curl curl-doc \ + build-base gcc-doc \ + libffi-dev zlib-dev linux-headers \ + openssl \ + jq \ + ; + +RUN apk --update --no-cache --allow-untrusted --repository http://dl-cdn.alpinelinux.org/alpine/edge/community add \ + corkscrew \ + && rm -rf /var/cache/apk/* \ + /tmp/* \ + /var/tmp/* + +ARG TENV_VERSION=3.2.4 + +VOLUME /var/tenv + +RUN wget -O /tmp/tenv.apk "https://github.com/tofuutils/tenv/releases/download/v${TENV_VERSION}/tenv_v${TENV_VERSION}_386.apk" \ + && apk add --allow-untrusted /tmp/tenv.apk \ + && mkdir -p /var/tenv \ + && chmod -R 777 /var/tenv \ + && rm /tmp/tenv.apk + +RUN apk add --no-cache --purge \ + git \ + bash \ + build-base \ + libffi-dev \ + openssl-dev \ + bzip2-dev \ + zlib-dev \ + xz-dev \ + readline-dev \ + sqlite-dev \ + tk-dev \ + linux-headers \ + vim \ + ; + +# install pyenv pyenv-doctor pyenv-installer pyenv-update pyenv-virtualenv pyenv-which-ext +RUN curl https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash +RUN mv /root/.pyenv /pyenv +# these need to go into your .bashrc +# ENV PYENV_ROOT "/pyenv" +# ENV PATH "$PYENV_ROOT/bin:$PATH" +# RUN eval "$(pyenv init -)" +# RUN eval "$(pyenv virtualenv-init -)" +# RUN pyenv install 3.8 3.9 3.10 3.11 3.12 +# ENV PATH "$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH" + +ENTRYPOINT ["/usr/bin/tenv"] diff --git a/automation/TFEnv/Dockerfile b/automation/TFEnv/Dockerfile deleted file mode 100644 index 8d83b58..0000000 --- a/automation/TFEnv/Dockerfile +++ /dev/null @@ -1,81 +0,0 @@ -ARG BASH_VERSION=5 -FROM "docker.io/bash:${BASH_VERSION}" - -# Runtime dependencies -RUN apk add --no-cache --purge \ - curl \ - aws-cli \ - python3 py3-pip \ - git \ - wget \ - openssh-client \ - make \ - zip zip-doc \ - curl curl-doc \ - build-base gcc-doc \ - libffi-dev zlib-dev linux-headers \ - openssl \ - jq \ - ; - -RUN apk --update --no-cache --allow-untrusted --repository http://dl-cdn.alpinelinux.org/alpine/edge/community add \ - corkscrew \ - && rm -rf /var/cache/apk/* \ - /tmp/* \ - /var/tmp/* - -ARG TFENV_VERSION=3.0.0 - -RUN wget -O /tmp/tfenv.tar.gz "https://github.com/tfutils/tfenv/archive/refs/tags/v${TFENV_VERSION}.tar.gz" \ - && tar -C /tmp -xf /tmp/tfenv.tar.gz \ - && mv "/tmp/tfenv-${TFENV_VERSION}/bin"/* /usr/local/bin/ \ - && mkdir -p /usr/local/lib/tfenv \ - && mv "/tmp/tfenv-${TFENV_VERSION}/lib" /usr/local/lib/tfenv/ \ - && mv "/tmp/tfenv-${TFENV_VERSION}/libexec" /usr/local/lib/tfenv/ \ - && mkdir -p /usr/local/share/licenses \ - && mv "/tmp/tfenv-${TFENV_VERSION}/LICENSE" /usr/local/share/licenses/tfenv \ - && rm -rf /tmp/tfenv* \ - && mkdir /var/tfenv \ - && touch /var/tfenv/version \ - && echo "latest" > /var/tfenv/version \ - && chmod 777 -R /var/tfenv \ - ; -ENV TFENV_ROOT /usr/local/lib/tfenv - -ENV TFENV_CONFIG_DIR /var/tfenv - -ENV TFENV_TERRAFORM_VERSION "" - -VOLUME /var/tfenv - -RUN apk add --no-cache --purge \ - git \ - bash \ - build-base \ - libffi-dev \ - openssl-dev \ - bzip2-dev \ - zlib-dev \ - xz-dev \ - readline-dev \ - sqlite-dev \ - tk-dev \ - linux-headers \ - vim \ - ; - -RUN apk add --no-cache cosign \ - tenv --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \ - ; -# install pyenv pyenv-doctor pyenv-installer pyenv-update pyenv-virtualenv pyenv-which-ext -RUN curl https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash -RUN mv /root/.pyenv /pyenv -# these need to go into your .bashrc -ENV PYENV_ROOT "/pyenv" -ENV PATH "$PYENV_ROOT/bin:$PATH" -RUN eval "$(pyenv init -)" -RUN eval "$(pyenv virtualenv-init -)" -RUN pyenv install 3.8 3.9 3.10 3.11 3.12 -ENV PATH "$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH" - -ENTRYPOINT ["/usr/local/bin/terraform"] diff --git a/automation/jinja2/compute_deps.py b/automation/jinja2/compute_deps.py index 2a812e5..90839c1 100644 --- a/automation/jinja2/compute_deps.py +++ b/automation/jinja2/compute_deps.py @@ -5,7 +5,7 @@ default_exec_order = 0 - + def get_current_exec_order(exec_plan:list, plan_name:str): for i in range(len(exec_plan)): for item in exec_plan[i]: @@ -42,7 +42,7 @@ def build_exec_plan(plans:list): plan_exec_order = dependency_exec_order + 1 changed = True return exec_plan - + def print_exec_plan(exec_plan:list): for exec_order in range(len(exec_plan)): print(f"order[{exec_order}]: {exec_plan[exec_order]}") @@ -72,14 +72,14 @@ def main(): # Parse YAML file and create an object config_data = parse_yaml_file(args.config_file) - + # generate execution plan plans = config_data.get('plans',[]) exec_plan = build_exec_plan(plans=plans) - + # Combine environment variables and YAML data context = {**os.environ, **config_data, **{"plans_execution_plan":exec_plan}} - + # Render Jinja template rendered_content = render_template(args.template_file, context) with open(args.output_file, 'w') as output_file: @@ -88,4 +88,4 @@ def main(): print(f"Template successfully rendered and saved to {args.output_file}") if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/automation/jinja2/render.py b/automation/jinja2/render.py index fcec1bd..e273daa 100755 --- a/automation/jinja2/render.py +++ b/automation/jinja2/render.py @@ -53,7 +53,7 @@ def rend_template(self): var_data = yaml.full_load(f) # compute execution plan for idx in range(len(var_data['plans'])): - var_data['plans'][idx] = var_data['plans'][idx] if var_data['plans'][idx].startswith('name: ') else { + var_data['plans'][idx] = var_data['plans'][idx] if isinstance(var_data['plans'][idx], dict) and 'name' in var_data['plans'][idx] else { 'name': var_data['plans'][idx]} # this is for backward compatiblity exec_plan = compute_deps.build_exec_plan(plans=var_data['plans']) var_data['exec_plan'] = exec_plan diff --git a/automation/jinja2/templates/.env.dist.j2 b/automation/jinja2/templates/.env.dist.j2 index d66dbe4..d289595 100644 --- a/automation/jinja2/templates/.env.dist.j2 +++ b/automation/jinja2/templates/.env.dist.j2 @@ -40,8 +40,8 @@ GIT_DEPTH={{ GIT_DEPTH | default(20) }} ######################################################################################################################## DOCKER_REGISTRY={{ DOCKER_REGISTRY | default("", true) }} BASH_VERSION_TAG={{ BASH_VERSION_TAG | default("5", true) }} -TFENV_VERSION={{ TFENV_VERSION | default("3.0.0", true) }} -TFENV_IMAGE_TAG={{ TFENV_IMAGE_TAG | default("latest", true) }} +TENV_VERSION={{ TENV_VERSION | default("3.0.0", true) }} +TENV_IMAGE_TAG={{ TENV_IMAGE_TAG | default("latest", true) }} TERRAFORM_DOCS_IMAGE_TAG={{ TERRAFORM_DOCS_IMAGE_TAG | default("latest", true) }} PRECOMMIT_IMAGE_TAG={{ PRECOMMIT_IMAGE_TAG | default("latest", true) }} TFLINT_IMAGE_TAG={{ TFLINT_IMAGE_TAG | default("latest", true)}} @@ -56,6 +56,7 @@ TRIVY_IMAGE_TAG={{ TRIVY_IMAGE_TAG | default("latest", true) }} TERRASCAN_IMAGE_TAG={{ TERRASCAN_IMAGE_TAG | default("latest", true) }} TERRAFORM_VERSION_CHECK_IMAGE_TAG={{ TERRAFORM_VERSION_CHECK_IMAGE_TAG | default("latest", true) }} SCOUTSUITE_VERSION={{ SCOUTSUITE_VERSION | default("latest", true) }} +TENV_TOOL={{ TENV_TOOL | default("terraform", true) }} ######################################################################################################################## # Terraform Logs @@ -116,7 +117,7 @@ ACCOUNT_ID={{ ACCOUNT_ID }} {% if DEFAULT_UPGRADE is not defined or DEFAULT_UPGRADE == false %} TERRAFORM_UPGRADE_FLAG= {% endif %} -TFENV_TERRAFORM_VERSION={{ terraform_version | default("", true) }} +TENV_TERRAFORM_VERSION={{ terraform_version | default("", true) }} {% if CUSTOM_ENV is defined %} ######################################################################################################################## diff --git a/automation/jinja2/templates/.gitlab-ci.yml.j2 b/automation/jinja2/templates/.gitlab-ci.yml.j2 index af6801b..5de1f68 100644 --- a/automation/jinja2/templates/.gitlab-ci.yml.j2 +++ b/automation/jinja2/templates/.gitlab-ci.yml.j2 @@ -26,7 +26,7 @@ variables: # Docker Image Tag TFLINT_IMAGE_TAG: "{{ environ('TFLINT_IMAGE_TAG') }}" PRECOMMIT_IMAGE_TAG: "{{ environ('PRECOMMIT_IMAGE_TAG') }}" - TFENV_IMAGE_TAG: "{{ environ('TFENV_IMAGE_TAG') }}" + TENV_IMAGE_TAG: "{{ environ('TENV_IMAGE_TAG') }}" DRIFTCTL_IMAGE_TAG: "{{ environ('DRIFTCTL_IMAGE_TAG') }}" ### global variables ### @@ -38,8 +38,9 @@ variables: DEFAULT_TRIVY_CONFIG: "{{ environ('DEFAULT_TRIVY_CONFIG') }}" DEFAULT_TERRASCAN_CONFIG: "{{ environ('DEFAULT_TERRASCAN_CONFIG') }}" DEFAULT_TERRAFORM_DOCS_CONFIG: "{{ environ('DEFAULT_TERRAFORM_DOCS_CONFIG') }}" + TENV_TOOL: "{{ TENV_TOOL }}" - TFENV_TERRAFORM_VERSION: "{{ environ('TFENV_TERRAFORM_VERSION') }}" + TENV_TERRAFORM_VERSION: "{{ environ('TENV_TERRAFORM_VERSION') }}" TERRAFORM_UPGRADE_FLAG: "{{ environ('TERRAFORM_UPGRADE_FLAG') }}" # NEED TO BE CHANGED FOR EACH PROJECT @@ -154,10 +155,10 @@ stages: .terraform-base: &terraform_base image: - name: ${DOCKER_REGISTRY}tfenv:${TFENV_IMAGE_TAG} + name: ${DOCKER_REGISTRY}tenv:${TENV_IMAGE_TAG} entrypoint: - '/usr/bin/env' - - 'PATH=/pyenv/bin:/pyenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/tfenv/bin/' + - 'PATH=/pyenv/bin:/pyenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' <<: *base {% if GITLAB_JOBS["terraform-trivy"] %} @@ -169,14 +170,14 @@ stages: name: aquasec/trivy:latest entrypoint: - '/usr/bin/env' - - 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/tfenv/bin/' + - 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' <<: *base {% endif %} {% if GITLAB_JOBS["terraform-lint"] %} .terraform-lint: image: - name: ${DOCKER_REGISTRY}tfenv:${TFENV_IMAGE_TAG} + name: ${DOCKER_REGISTRY}tenv:${TENV_IMAGE_TAG} entrypoint: - '/usr/bin/env' - 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' @@ -632,4 +633,4 @@ delete_{{ plan_slug }}: - make destroyauto_{{ plan_slug }} {% endfor %} {# exec_batch #} -{% endfor %} {# delete_exec_plan #} \ No newline at end of file +{% endfor %} {# delete_exec_plan #} diff --git a/configure.yaml.dist b/configure.yaml.dist index e929c84..db81a41 100644 --- a/configure.yaml.dist +++ b/configure.yaml.dist @@ -20,11 +20,11 @@ PROJECT_DIR: # Docker Compose image tags to use ######################################################################################################################## # docker-compose.yaml terraform image -BASH_VERSION_TAG: 5 -TFENV_VERSION: 3.0.0 +ALPINE_VERSION_TAG: 3.20 +TENV_VERSION: 3.2.4 # Tools image versions DOCKER_REGISTRY: public.ecr.aws/h1a2u4u1/ -TFENV_IMAGE_TAG: STARTER_KIT_CURRENT_VERSION +TENV_IMAGE_TAG: STARTER_KIT_CURRENT_VERSION TFLINT_IMAGE_TAG: STARTER_KIT_CURRENT_VERSION TERRAFORM_DOCS_IMAGE_TAG: STARTER_KIT_CURRENT_VERSION PRECOMMIT_IMAGE_TAG: v1.89.0 @@ -40,6 +40,7 @@ TERRASCAN_IMAGE_TAG: latest TERRAFORM_VERSION_CHECK_IMAGE_TAG: latest SCOUTSUITE_VERSION: latest +TENV_TOOL: terraform ######################################################################################################################## # Docker Compose custom volumes ######################################################################################################################## diff --git a/docker-compose.yml b/docker-compose.yml index 919c7a3..29c7a2e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,19 +3,18 @@ services: terraform: container_name: ${COMPOSE_PROJECT_NAME}_terraform - image: ${DOCKER_REGISTRY}tfenv:${TFENV_IMAGE_TAG} + image: ${DOCKER_REGISTRY}tenv:${TENV_IMAGE_TAG} # build: -# dockerfile: automation/TFEnv/Dockerfile +# dockerfile: automation/TEnv/Dockerfile # args: -# - TFENV_VERSION=${TFENV_VERSION} -# - BASH_VERSION=${BASH_VERSION_TAG} -# image: tfenv:${BASH_VERSION_TAG}-${TFENV_VERSION} +# - TENV_VERSION=${TENV_VERSION} +# - ALPINE_VERSION_TAG=${ALPINE_VERSION_TAG} +# image: tenv:${ALPINE_VERSION_TAG}-${TENV_VERSION} user: ${MY_UID}:${MY_GID} environment: AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID}" AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY}" AWS_SESSION_TOKEN: "${AWS_SESSION_TOKEN}" - TFENV_TERRAFORM_VERSION: "${TFENV_TERRAFORM_VERSION}" env_file: - .env working_dir: ${DOCKER_WORKDIR} diff --git a/docs/installation.md b/docs/installation.md index 2095932..59c990c 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -38,7 +38,7 @@ To **intialize** the AWSTerraformStarterKit, follow these steps: 2. Create a **terraform** folder within your new repository and copy your Terraform plans into. A Terraform plan is a subfolder of the **terraform** directory. -3. You can create a **common.tfvars** file at the root level of **terraform** directory that will contain the common parameters of your Teraform plans. +3. You can create a **common.tfvars** file at the root level of **terraform** directory that will contain the common parameters of your Teraform plans. 4. Download `get-starter-kit.sh` shell script and make it executable @@ -86,21 +86,21 @@ Project Root Directory: ### Step 2 -1. Locate the `.gitignore.dist` then copy it as `.gitignore`. +1. Locate the `.gitignore.dist` then copy it as `.gitignore`. ```bash cp .gitignore.dist .gitignore ``` -2. Edit `.gitignore` file in a text editor and update with your desired other files to ignore. +2. Edit `.gitignore` file in a text editor and update with your desired other files to ignore. -> `.gitignore` contains : +> `.gitignore` contains : > - the standard ignore file list for a Terraform project > - the AWSTerraformStarterKit files and folders that should not be commited in your Git repo. > - You own list of files and directories that should not be commited in your Git repo. ### Step 3 -1. Locate the `configure.yaml.dist` then copy it as `configure.yaml`. +1. Locate the `configure.yaml.dist` then copy it as `configure.yaml`. ```bash cp configure.yaml.dist configure.yaml @@ -108,7 +108,7 @@ Project Root Directory: 2. Edit `configure.yaml` file in a text editor and update the parameters with your desired values. Make sure to follow the instructions or comments provided in the file to correctly configure each parameter. -> `configure.yaml` is the main configuration file of AWSTerraformStarterKit. It contains : +> `configure.yaml` is the main configuration file of AWSTerraformStarterKit. It contains : > - ENV Variables > - Docker Compose image tags to use > - GITLAB CI configuration @@ -180,7 +180,7 @@ It's important to note that if your AWS credentials expire or change, you need t ``` ## Help -To get help and list all the available commands in the AWSTerraformStarterKit, you can use the `make help` command. This command will display the available targets and their descriptions from the `Makefile`. +To get help and list all the available commands in the AWSTerraformStarterKit, you can use the `make help` command. This command will display the available targets and their descriptions from the `Makefile`. ```bash $ make help @@ -377,7 +377,7 @@ Example configuration in `configure.yaml`: ### Change the Python Version -The TFenv image is built using the `pyenv` tool, a popular utility that simplifies the management of multiple Python versions. Several Python versions, ranging from Python 3.8 to Python 3.12, are pre-installed in the image. +The TEnv image is built using the `pyenv` tool, a popular utility that simplifies the management of multiple Python versions. Several Python versions, ranging from Python 3.8 to Python 3.12, are pre-installed in the image. To switch the Python version for a Terraform plan, simply add a `.python-version` file to the plan's folder. This file should specify the desired Python version, and `pyenv` will automatically switch to that version when executing the plan. @@ -484,7 +484,7 @@ Makefile exists, will be deleted ./get-starter-kit.sh ``` -3. Run `make start` +3. Run `make start` ```bash make start ``` diff --git a/docs/tools.md b/docs/tools.md index 8f4ace7..5190272 100644 --- a/docs/tools.md +++ b/docs/tools.md @@ -1,12 +1,12 @@ # Tools -- [TFEnv](https://github.com/tfutils/tfenv) +- [TEnv](https://github.com/tfutils/TEnv) -tfenv is a version manager specifically designed for Terraform. It provides a simple and convenient way to manage multiple -versions of Terraform on a single machine. With tfenv, you can easily switch between different versions of Terraform based on your project's requirements. +TEnv is a version manager specifically designed for Terraform. It provides a simple and convenient way to manage multiple +versions of Terraform on a single machine. With TEnv, you can easily switch between different versions of Terraform based on your project's requirements. -Using tfenv, you can install and manage multiple versions of Terraform side by side, ensuring compatibility with different projects or environments. +Using TEnv, you can install and manage multiple versions of Terraform side by side, ensuring compatibility with different projects or environments. It allows you to easily switch between versions with a single command, making it effortless to work on different projects that may require different versions of Terraform. @@ -14,16 +14,16 @@ versions of Terraform. 2. Inside the `.terraform-version` file, specify the desired version of Terraform you want to use for your project. For example, you can write `0.15.4` to indicate that you want to use version 0.15.4. -3. Install tfenv on your machine if you haven't done so already. You can refer to the tfenv documentation for installation instructions specific to your operating system. +3. Install TEnv on your machine if you haven't done so already. You can refer to the TEnv documentation for installation instructions specific to your operating system. -4. Once tfenv is installed, navigate to the root directory of your Terraform project using the command line. +4. Once TEnv is installed, navigate to the root directory of your Terraform project using the command line. -5. Run the following command to let tfenv detect and switch to the version specified in the `.terraform-version` file +5. Run the following command to let TEnv detect and switch to the version specified in the `.terraform-version` file -`tfenv install` +`TEnv install` This command will check the `.terraform-version` file and automatically install the specified version of Terraform if it's not already installed. -If the desired version is already installed, tfenv will switch to that version. +If the desired version is already installed, TEnv will switch to that version. 6. Verify that the correct version of Terraform is now in use by running: @@ -31,7 +31,7 @@ If the desired version is already installed, tfenv will switch to that version. You should see the version specified in the `.terraform-version` file displayed in the output. -By using the `.terraform-version` file, tfenv makes it easy to ensure that the correct version of Terraform is used for each specific project or directory. It simplifies the management of Terraform versions and helps maintain consistency across different projects. +By using the `.terraform-version` file, TEnv makes it easy to ensure that the correct version of Terraform is used for each specific project or directory. It simplifies the management of Terraform versions and helps maintain consistency across different projects. If you have any further questions or need additional assistance, feel free to ask! @@ -164,7 +164,7 @@ documentation, improving the overall quality of module documentation and enhanci - [Terraform Check Version (tsvc)](https://github.com/tfverch/tfvc) -- Terraform version check (tfvc) is a reporting tool to identify available updates for providers and modules referenced in your Terraform code. +- Terraform version check (tfvc) is a reporting tool to identify available updates for providers and modules referenced in your Terraform code. - It provides clear warning/failure output and resolution guidance for any issues it detects. # Adding a Tool diff --git a/terraform/common.tfvars b/terraform/common.tfvars index a6a9645..c188d8f 100644 --- a/terraform/common.tfvars +++ b/terraform/common.tfvars @@ -1 +1 @@ -region = "eu-central-1" \ No newline at end of file +region = "eu-central-1" diff --git a/terraform/demo/.terraform-version b/terraform/demo/.terraform-version index 83d1a5e..ec70f75 100644 --- a/terraform/demo/.terraform-version +++ b/terraform/demo/.terraform-version @@ -1 +1 @@ -1.6.6 \ No newline at end of file +1.6.6 diff --git a/terraform/demo/README.md b/terraform/demo/README.md index b088440..f27f654 100644 --- a/terraform/demo/README.md +++ b/terraform/demo/README.md @@ -1,6 +1,6 @@ # Demo project plan - +## Requirements ## Requirements | Name | Version | diff --git a/terraform/demo/TEST.md b/terraform/demo/TEST.md index 648ab58..b9661ae 100644 --- a/terraform/demo/TEST.md +++ b/terraform/demo/TEST.md @@ -2,4 +2,4 @@ markdown content * bullet 1 * bullet 2 -* bullet 3 \ No newline at end of file +* bullet 3 diff --git a/terraform/demo/test.sh b/terraform/demo/test.sh index 7dd01ea..80f0e08 100644 --- a/terraform/demo/test.sh +++ b/terraform/demo/test.sh @@ -1,4 +1,4 @@ this is a script file -echo $BLABLA \ No newline at end of file +echo $BLABLA diff --git a/terraform/demo/test.yaml b/terraform/demo/test.yaml index c9d0bfa..fa173fc 100644 --- a/terraform/demo/test.yaml +++ b/terraform/demo/test.yaml @@ -1,3 +1,3 @@ first_key: the first key second_key: -- the second key \ No newline at end of file +- the second key diff --git a/terraform/demo/variables.tf b/terraform/demo/variables.tf index ada59d9..96ba564 100644 --- a/terraform/demo/variables.tf +++ b/terraform/demo/variables.tf @@ -5,4 +5,4 @@ variable "region" { variable "module_path" { type = string -} \ No newline at end of file +} diff --git a/terraform/demo2/variables.tf b/terraform/demo2/variables.tf index ada59d9..96ba564 100644 --- a/terraform/demo2/variables.tf +++ b/terraform/demo2/variables.tf @@ -5,4 +5,4 @@ variable "region" { variable "module_path" { type = string -} \ No newline at end of file +} diff --git a/terraform/demo3/variables.tf b/terraform/demo3/variables.tf index ada59d9..96ba564 100644 --- a/terraform/demo3/variables.tf +++ b/terraform/demo3/variables.tf @@ -5,4 +5,4 @@ variable "region" { variable "module_path" { type = string -} \ No newline at end of file +}