I hold a passion for DevOps, Security and Networking and I love bringing these principles to my customers by empowering them with the power of the public cloud.
Thanks for the quick response, this helped and I was able to run the scripts, however, with some modifications.
sed -i "s,,$AUTHORIZED_NETWORK,g" terraform.tfvars gave an error - sed: 1: "terraform.tfvars": undefined label 'erraform.tfvars'. I modified it to sed "s//$AUTHORIZED_NETWORK/g" terraform.tfvars I haven't really used sed tool before (followed steps from this link). Eventually I gave up and replaced the value for AUTHORIZED_NETWORK to the IP I got from the checkip.amazonaws.com url.
All other definitions in *.tf files error-ed out due to missing definition/property - project. I created a variable project in variable.tf with default value as "" and referenced it in each definition as project = var.project.
Created an apply.sh file for running these set of commands -
cd infra/plan
export AUTHORIZED_NETWORK=$(curl -s checkip.amazonaws.com/)export TF_VAR_project=$PROJECT_IDecho'AUTHORIZED_NETWORK ='$AUTHORIZED_NETWORKecho'TF_VAR_project ='$PROJECT_IDsed"s/<AUTHORIZED_NETWORK>/$AUTHORIZED_NETWORK/g" terraform.tfvars
# sed -i "s,<AUTHORIZED_NETWORK>,$AUTHORIZED_NETWORK,g" terraform.tfvars
terraform init \-backend-config="bucket=${TERRAFORM_BUCKET_NAME}"\-backend-config="prefix=state"
terraform apply
It all worked at the end, but my approach seems a hacky one, let me know your thoughts.
Looking forward to reading the next posts in the series. 😃
Great tutorial series, loving it so far... I have a question - What env value to set for AUTHORIZED_NETWORK?
Thanks for your feedback :+1
AUTHORIZED_NETWORK could be your local ip (curl -s checkip.amazonaws.com/)
or the public IP of your private network
Thanks for the quick response, this helped and I was able to run the scripts, however, with some modifications.
It all worked at the end, but my approach seems a hacky one, let me know your thoughts.
Looking forward to reading the next posts in the series. 😃
Great series... thanks again for sharing it :-) I was able to setup and customise the scripts as per my requirements.