Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 3.98 KB

aws-terraform.md

File metadata and controls

59 lines (40 loc) · 3.98 KB

1. What is Terraform?

Terraform is an open-source Infrastructure as Code (IaC) tool that allows you to define, manage, and provision infrastructure resources using declarative code.

2. How does Terraform work with AWS?

Terraform interacts with the AWS API to create and manage resources based on the configurations defined in Terraform files.

3. What is an AWS provider in Terraform?

An AWS provider in Terraform is a plugin that allows Terraform to interact with AWS services by making API calls.

4. How do you define resources in Terraform?

Resources are defined in Terraform using HashiCorp Configuration Language (HCL) syntax in .tf files. Each resource type corresponds to an AWS service.

5. What is a Terraform state file?

The Terraform state file maintains the state of the resources managed by Terraform. It's used to track the actual state of the infrastructure.

6. How can you initialize a Terraform project?

You can initialize a Terraform project using the terraform init command. It downloads required provider plugins and initializes the backend.

7. How do you plan infrastructure changes in Terraform?

You can use the terraform plan command to see the changes that Terraform will apply to your infrastructure before actually applying them.

8. What is the terraform apply command used for?

The terraform apply command applies the changes defined in your Terraform configuration to your infrastructure. It creates, updates, or deletes resources as needed.

9. What is the purpose of Terraform variables?

Terraform variables allow you to parameterize your configurations, making them more flexible and reusable across different environments.

10. How do you manage secrets and sensitive information in Terraform?

Sensitive information should be stored in environment variables or external systems like AWS Secrets Manager. You can use variables to reference these values in Terraform.

11. What is remote state in Terraform?

Remote state in Terraform refers to storing the state file on a remote backend, such as Amazon S3, instead of locally. This facilitates collaboration and enables locking.

12. How can you manage multiple environments (dev, prod) with Terraform?

You can use Terraform workspaces or create separate directories for each environment, each with its own state file and variables.

13. How do you handle dependencies between resources in Terraform?

Terraform automatically handles dependencies based on the resource definitions in your configuration. It will create resources in the correct order.

14. What is Terraform's "apply" process?

The "apply" process in Terraform involves comparing the desired state from your configuration to the current state, generating an execution plan, and then applying the changes.

15. How can you manage versioning of Terraform configurations?

You can use version control systems like Git to track changes to your Terraform configurations. Additionally, Terraform Cloud and Enterprise offer versioning features.

16. What is the difference between Terraform and CloudFormation?

Terraform is a multi-cloud IaC tool that supports various cloud providers, including AWS. CloudFormation is AWS-specific and focuses on AWS resource provisioning.

17. What is a Terraform module?

A Terraform module is a reusable set of configurations that can be used to create multiple resources with a consistent configuration.

18. How can you destroy infrastructure created by Terraform?

You can use the terraform destroy command to remove all resources defined in your Terraform configuration.

19. How does Terraform manage updates to existing resources?

Terraform applies updates by modifying existing resources rather than recreating them. This helps preserve data and configurations.

20. Can Terraform be used for managing third-party resources?

Yes, Terraform has the capability to manage resources beyond AWS. It supports multiple providers, making it versatile for managing various cloud and on-premises resources.