Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
jdongmo 4b6cd5d212 Add first code. il y a 3 ans
modules Add first code. il y a 3 ans
.gitignore Initial commit il y a 3 ans
LICENSE Initial commit il y a 3 ans
README.md Add first code. il y a 3 ans
main.tf Add first code. il y a 3 ans
outputs.tf Add first code. il y a 3 ans
run.sh Add first code. il y a 3 ans
variables.tf Add first code. il y a 3 ans

README.md

terraform.azure.automation

Terraform repository to perform automatic tasks in Azure cloud.

Requirements

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"

Run

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

Docker

We’ll have a Dockerfile in order to generate a docker image to use it for running play in an controled environment.

  • Build image: docker build -t devops-docker .
  • Run terraform using this image:
docker run -e "TERRAFORM_FILE=state.tf" --entrypoint "./run.sh"
devops-docker -v