From 96f5dfe8fbc46d02ebcd4d5a7b2104551a6b381d Mon Sep 17 00:00:00 2001 From: imjoey Date: Wed, 3 Jul 2019 17:19:42 +0800 Subject: [PATCH] Prune the unnecessary scripts Since it's not the duty of provider to format tf configuration files, remove tf-fmt related scripts. Signed-off-by: imjoey --- .terraform-version | 1 - .travis.yml | 3 --- GNUmakefile | 9 +-------- scripts/terraform_install.sh | 14 -------------- scripts/tf-fmtcheck.sh | 25 ------------------------- 5 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 .terraform-version delete mode 100755 scripts/terraform_install.sh delete mode 100755 scripts/tf-fmtcheck.sh diff --git a/.terraform-version b/.terraform-version deleted file mode 100644 index 34a83616..00000000 --- a/.terraform-version +++ /dev/null @@ -1 +0,0 @@ -0.12.1 diff --git a/.travis.yml b/.travis.yml index 7ba8578c..4e457be4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,9 +15,6 @@ install: - bash scripts/gogetcookie.sh - go get github.com/kardianos/govendor -before_script: -- scripts/terraform_install.sh - script: - make test - make vet diff --git a/GNUmakefile b/GNUmakefile index 951abc37..6e91e4bd 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -19,7 +19,6 @@ test: fmtcheck go test -i $(TEST) || exit 1 echo $(TEST) | \ xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4 - $(MAKE) tf-fmtcheck testacc: fmtcheck TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 180m @@ -36,12 +35,6 @@ vet: fmt: gofmt -w $(GOFMT_FILES) -tf-fmt: - $(CURDIR)/bin/terraform fmt - -tf-fmtcheck: - @sh -c "'$(CURDIR)/scripts/tf-fmtcheck.sh'" - fmtcheck: @sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'" @@ -74,5 +67,5 @@ endif @$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME) -.PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile tf-fmt tf-fmtcheck website website-test +.PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile website website-test diff --git a/scripts/terraform_install.sh b/scripts/terraform_install.sh deleted file mode 100755 index 3dabce75..00000000 --- a/scripts/terraform_install.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# this file should be executed from the root directory of the repo -# -# install specific terraform version to bin/ directory, based on the TF_VERSION env var or -# if TF_VERSION is not set then get it from .terraform-version filecontents -# very basic, nothing fancy - -TF_VERSION="${TF_VERSION:-`cat .terraform-version`}" -echo TF_VERSION=${TF_VERSION} - -wget https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_amd64.zip -O /tmp/terraform.zip -unzip -o -d ./bin/ /tmp/terraform.zip -chmod +x ./bin/terraform -./bin/terraform --version diff --git a/scripts/tf-fmtcheck.sh b/scripts/tf-fmtcheck.sh deleted file mode 100755 index 2b5ba93a..00000000 --- a/scripts/tf-fmtcheck.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -# check if .tf files need reformatting -# this file should be executed from the root directory of the repo - -# check if terraform exists and is a valid version -TF_VERSION="${TF_VERSION:-`cat .terraform-version`}" -set +e -TF_VERSION_INSTALLED=$(bin/terraform --version | head -n1 | awk -Fv '{ print $2}') -set -e - -if ! [ "${TF_VERSION}" == "${TF_VERSION_INSTALLED}" ]; then - scripts/terraform_install.sh -fi - -# Check terraform fmt -echo "==> Checking that code passes terraform fmt requirements..." -tffmt_files=$(bin/terraform fmt -write=false -check=true ) -if [[ -n ${tffmt_files} ]]; then - echo 'terraform fmt needs running on the following files:' - echo "${tffmt_files}" - echo "You can use the command: \`make tf-fmt\` to reformat code." - exit 1 -fi - -exit 0