mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-24 07:26:26 -06:00
8e7f3cc09d
* merge master * added new constructs/naming for deploy scripts, etc. * suppress az login output * removed .tfvars and provider.tf; updated prev merge * reverted .travis.yml back to Hashicorp's * Reverting back to the Hashicorp travis file
36 lines
1.1 KiB
Bash
Executable File
36 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -o errexit -o nounset
|
|
|
|
docker run --rm -it \
|
|
-e ARM_CLIENT_ID \
|
|
-e ARM_CLIENT_SECRET \
|
|
-e ARM_SUBSCRIPTION_ID \
|
|
-e ARM_TENANT_ID \
|
|
-v $(pwd):/data \
|
|
--workdir=/data \
|
|
--entrypoint "/bin/sh" \
|
|
hashicorp/terraform:light \
|
|
-c "/bin/terraform get; \
|
|
/bin/terraform validate; \
|
|
/bin/terraform plan -out=out.tfplan -var dns_name=$KEY -var hostname=$KEY -var resource_group=$KEY -var admin_password=$PASSWORD; \
|
|
/bin/terraform apply out.tfplan; \
|
|
/bin/terraform show;"
|
|
|
|
# cleanup deployed azure resources via azure-cli
|
|
docker run --rm -it \
|
|
azuresdk/azure-cli-python \
|
|
sh -c "az login --service-principal -u $ARM_CLIENT_ID -p $ARM_CLIENT_SECRET --tenant $ARM_TENANT_ID > /dev/null; \
|
|
az vm show -g $KEY -n rgvm"
|
|
|
|
# cleanup deployed azure resources via terraform
|
|
docker run --rm -it \
|
|
-e ARM_CLIENT_ID \
|
|
-e ARM_CLIENT_SECRET \
|
|
-e ARM_SUBSCRIPTION_ID \
|
|
-e ARM_TENANT_ID \
|
|
-v $(pwd):/data \
|
|
--workdir=/data \
|
|
--entrypoint "/bin/sh" \
|
|
hashicorp/terraform:light \
|
|
-c "/bin/terraform destroy -force -var dns_name=$KEY -var hostname=$KEY -var resource_group=$KEY -var admin_password=$PASSWORD;" |