-
Notifications
You must be signed in to change notification settings - Fork 0
/
apply.sh
34 lines (24 loc) · 1.12 KB
/
apply.sh
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
#######################################################################################
#!/bin/bash
######################################################################################
# Export Path Variable
export PATH=$PATH:/opt
######################################################################################
# If statement to ensure a user has provided a Terraform folder path
if [[ -z "$1" ]]; then
echo ""
echo "You have not provided a Terraform path."
echo "SYNTAX = ./apply.sh <PATH>"
echo "EXAMPLE = ./apply.sh terraform/instance"
echo ""
exit
fi
######################################################################################
# The Init command is used to initialize a working directory containing Terraform configuration files.
# This is the first command that should be run after writing a new Terraform configuration
terraform init $1
#The Get command is used to download and update modules mentioned in the root module.
terraform get $1
#The Plan command is used to create an execution plan
terraform apply -auto-approve $1
######################################################################################