Skip to content

Commit 43536f8

Browse files
authored
Updating terraform version, improving error messag
1 parent fe8f7c7 commit 43536f8

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Diff for: terraforming_all_resources_aws.sh

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Generate .tf and .tfstate for existing AWS VPC resources
2-
# Author: Kyler Middleton, 7.9.2019
2+
# Author: Kyler Middleton, 7.8.2019
33

44
# Limitations/bugs
55
# SG rules are stripped of descriptions during import for some reason
@@ -56,14 +56,17 @@ find temp -type f -not -empty -name '*.tf' -exec basename {} \; | sed -e 's/.tf/
5656
echo "Removing versions.tf file which block 0.12upgrade process"
5757
rm -f versions.tf
5858

59-
# Fixup file for terraform 0.12, will automatically response yes
60-
echo "Init terraform project and auto-upgrading config and tfstate to 0.12 terraform standard"
61-
terraform init
62-
echo "yes" | terraform 0.12upgrade
63-
64-
# Format all local scripts
65-
echo "Formatting scripts via terraform fmt"
66-
terraform fmt
59+
# Init terraform
60+
echo "init and format Terraform"
61+
if $(terraform init && terraform fmt); then
62+
echo "Code is initialized"
63+
else
64+
echo "*******************************"
65+
echo "There were formatting issues with your code which isn't unusual"
66+
echo "Review the issues and manually fix them in the config file"
67+
echo "Test against with command \"terraform init && terraform fmt\""
68+
echo "*******************************"
69+
fi
6770

6871
# Remove temp directory, no longer needed
6972
echo "Deleting temp directory and all contents"

0 commit comments

Comments
 (0)