IAC and config management Flashcards
declarative
defines what the state should be but now how it should be accomplished
imperative
what should be done to achive the result
idempotent
same result when code is re-ran even if the object already exists. Azure cli is an example of this
language used by Terraform
Hashicorp config lanagaue
format used by ARM templates
Json
what is Ansible used for
declarative configuration of VMs, networking devices and cloud infrastructure
main.tf
holds config code. Also called a terraform plan
terraform.tfstate
json file managed by terroaform. Helps map planned resources against the running resources (name to url, guid, id etc)
Terraform providers
what api to call, azurerm and aws have their own providers.
Azure terraform provider defination
provider “azurerm” {
version = “>=2.0.0”
features {}
}
how to store and call varibales in terraform
Variables “keyname” {
descritpion = “exmaple
}
var.keyname
how can variables be passed to terraform
terraform.tvvars file, -var cmd aurment, enviroment varibles, terraform cloud work space
terraform resource
defines a infrastructure object or a function that can be reused in the terraform. resources normally start with proivder_ then what type of resource type under the provider with parrement values
command: terraform init
initializes terraform enivorment and downloads needed plugins. provides should be added into the main.tf file first
command: terraform plan
creates a diff of what will be changed once the planned has been executed + shows what will added and - shows what will be destoryed