A Terraform module to create a Linux Virtual Machine on Azure.
To make it easier when declaring which OS should be used, this module has a structure that allows choosing the OS with a single string, the available options are the keys on os-variables.tf, it's also posible to define the block on your own, following the same structure and declaring it under the "os_info" variable.
The default OS is Ubuntu, with details as declared in the first block inside os-variables.tf.
The init
command needs to be executed in order to initialize the Terraform Backend, this command uses the backend configuration declared or referenced in the root directory of the module.
The validate
command is useful to check if the Terraform file has a valid structure, it can be used to check if any breaking changes have been introduced.
It's a good practice to run the plan
command before running any operations on your existing infrastructure, this way you can always tell if there are unexpected and/or breaking changes.
To make sure any subsequent apply
commands do what the plan
command said they would do, you can run the following command:
terraform plan -out tfplan
This command creates a plan file, which can then be used in the apply
command.
This command is the one that applies the actions detailed in the results of the plan
command.
This command will ask for manual approval, unless if provided a plan file or explicitly told to do so with the -auto-approve
option.
To execute this command referencing the plan file created on the previous step use:
terraform apply tfplan