Terraform with AWS

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

change infrastructure

By using Terraform to change infrastructure, you can version control not only your configurations but also your state so you can see how the infrastructure evolved over time.

Resources

The resource block defines a piece of infrastructure. A resource might be a physical component such as an EC2 instance, or it can be a logical resource such as a Heroku application.

terraform destroy

The terraform destroy command terminates resources defined in your Terraform configuration. This command is the reverse of terraform apply in that it terminates all the resources specified by the configuration.

terraform.tfstate

When you applied your configuration, Terraform wrote data into a file called terraform.tfstate. This file now contains the IDs and properties of the resources Terraform created so that it can manage or destroy those resources going forward.

Platform Agnostic

With Terraform, you can manage a heterogeneous environment with the same workflow by creating a configuration file to fit the needs of your project or organization.

terraform output

You can query the outputs after apply-time using terraform output

-var flag

You can set variables directly on the command-line with the -var flag.

Advantages of Terraform

1. Platform Agnostic 2. State Management 3. Operator Confidence

Providers

A provider is a plugin that Terraform uses to translate the API interactions with the service.

Scope

Confirm what resources need to be created for a given project.

Author

Create the configuration file in HCL based on the scoped parameters

Terraform language

HashiCorp Configuration Language (HCL)

Tainted Resources

If a resource successfully creates but fails during provisioning, Terraform will error and mark the resource as "tainted".

Provisioner

If you need to do some initial setup on your instances, provisioners let you upload files, run shell scripts, or install and trigger other software like configuration management tools, etc.

Implicit dependencies

Implicit dependencies via interpolation expressions are the primary way to inform Terraform about these relationships, and should be used whenever possible.

Infrastructure as Code

Infrastructure as Code is the process of managing infrastructure in a file or files rather than manually configuring resources in a user interface.

terraform show

Inspect the current state using terraform show.

Initialize

Run terraform init in the project directory with the configuration files. This will download the correct provider plug-ins for the project.

Plan & Apply

Run terraform plan to verify creation process and then terraform apply to create real resources as well as state file that compares future changes in your configuration files to what actually exists in your deployment environment.

Workflows

Scope - Author - Initialize - Plan & Apply

explicit dependencies

Sometimes there are dependencies between resources that are not visible to Terraform. The depends_on argument is accepted by any resource and accepts a list of resources to create explicit dependencies for.

Other Data Types

Strings and numbers are the most commonly used variables, but lists (arrays) and maps (hashtables or dictionaries) can also be used.

State Management

Terraform creates a state file when a project is first initialized. Terraform uses this local state to create plans and make changes to your infrastructure.

terraform state

Terraform has a built in command called terraform state for advanced state management.

What is Terraform?

Terraform is the infrastructure as code offering from HashiCorp. It is a tool for building, changing, and managing infrastructure in a safe, repeatable way.

dependency information

Terraform uses dependency information to determine the correct order in which to create the different resources.

Operator Confidence

The workflow built into Terraform aims to instill confidence in users by promoting easily repeatable operations

Input Variables

input variables as a way to parameterize the configurations as to become truly shareable and version controlled.

output variables

output variables is a way to organize data to be easily queried and shown back to the Terraform user.

terraform validate

terraform validate command will check and report errors within modules, attribute names, and value types.


Set pelajaran terkait

Unit Test- Age of Reason Short Answer

View Set

Lab 12-3 Installing Windows Updates

View Set

Chapt. 36 Abdominal & Genitourinary Trauma

View Set