|
|
hace 3 años | |
|---|---|---|
| modules | hace 3 años | |
| .gitignore | hace 3 años | |
| LICENSE | hace 3 años | |
| README.md | hace 3 años | |
| main.tf | hace 3 años | |
| outputs.tf | hace 3 años | |
| run.sh | hace 3 años | |
| variables.tf | hace 3 años | |
Terraform repository to perform automatic tasks in Azure cloud.
First you must have terraform installed on host who run your automatism.
To install terraform, you should have wget and unzip.
sudo apt install wget unzip
wget -O terraform_0.12.20_linux_amd64.zip https://releases.hashicorp.com/terraform/0.12.20/terraform_0.12.20_linux_amd64.zip \
&& wget -O terraform_0.12.20_SHA256SUMS https://releases.hashicorp.com/terraform/0.12.20/terraform_0.12.20_SHA256SUMS \
&& sha256sum --ignore-missing -c terraform_0.12.20_SHA256SUMS \
&& unzip -qn terraform_0.12.20_linux_amd64.zip \
&& mv terraform ${PATH%%:*}/ \
&& rm terraform_0.12.20_linux_amd64.zip terraform_0.12.20_SHA256SUMS
To run terraform against Azure cloud, you should have Azure variable (credentials and location) set in environment
$ export ARM_CLIENT_ID="00000000-0000-0000-0000-000000000000"
$ export ARM_CLIENT_CERTIFICATE_PATH="/path/to/my/client/certificate.pfx"
$ export ARM_CLIENT_CERTIFICATE_PASSWORD="Pa55w0rd123"
$ export ARM_SUBSCRIPTION_ID="00000000-0000-0000-0000-000000000000"
$ export ARM_TENANT_ID="00000000-0000-0000-0000-000000000000"
To run terraform, we’ll use wrapper script run.sh To run default infrastructure playbook infra.tf who create all the infra
./run.sh -v
To only play another state file state.tf
TERRAFORM_FILE=state.tf ./run.sh -v
We’ll have a Dockerfile in order to generate a docker image to use it for running play in an controled environment.
docker build -t devops-docker .docker run -e "TERRAFORM_FILE=state.tf" --entrypoint "./run.sh"
devops-docker -v