1. Deploying Infrastructure with Terraform Flashcards
1
Q
Providers - Overview
- Terraform supports multiple providers.
- We have to specify the provider details for which we want to launch the infrastructure for.
- With the provider, we also have to add the tokens which will be used for authentication.
- On adding a provider, terraform init will download plugins associated with the provider.
A
2
Q
Providers - Update 0.13
From 0.13 onwards, Terraform requires explicit source information for any providers that are not HashiCorp-maintained, using a new syntax in the required_providers nested block inside the Terraform configuration block
A
3
Q
Terraform Destroy
- Terraform destroy* allows us to destroy all the resources that are created within the folder.
- Terraform destroy* with -target flag allows us to destroy the specific resource
A
4
Q
Terraform State File
- Terraform stores the state of the infrastructure that is being created from the TF files.
- This state allows terraform to map real-world resource to your existing configuration.
- Multiple resources in Terraform will have a separate block with the state file.
- When running a terraform plan, Terraform must know the current state of resources in order to effectively determine the changes that it needs to make to reach your desired configuration.
- Current State = Current Infrastructure Resource & Configuration
- Desired State = Infrastructure Configuration defined within the Terraform TF Files.
- Terraform will plan to match the desired state to the current state. If there is a difference between both, the desired state will take the preference.
A
5
Q
Providers - Versioning
- Provider plugins are released separately from Terraform itself.
- They have a different set of version numbers.
- During terraform init, if version argument is not specified, the most recent provider will be downloaded during initialization.
- For production use, you should constrain the acceptable provider versions via configuration, to ensure that new versions with breaking changes will not be automatically installed
A
6
Q
Providers - Types
- There are two major categories for Terraform providers:
- Hashicorp Distributed
- Third Party
- HashiCorp Distributed providers can be downloaded automatically during terraform init.
- terraform init cannot automatically download providers that are not distributed by HashiCorp.
A
7
Q
Providers - 3rd Party
- Third-party providers must be manually installed, since terraform init cannot automatically download them.
- Install third-party providers by placing their plugin executables in the user plugins directory.
- Plugin directory: /terraform.d/plugins
A
8
Q
Terraform Language
Terraform is an immutable, declarative, Infrastructure as Code provisioning language based on Hashicorp Configuration Language, or optionally JSON.
A