Giter VIP home page Giter VIP logo

terraform's Introduction

Terraform

Repository for learning Terraform

Steps to get started:

  1. Run terraform init - This command initializes terraform in the current directory and downloads the providers needed in the terraform code.

  2. Run terraform apply - This will read the terraform code file and show the changes that will be made once the change is applied. In our case, this will be the S3 bucket creation details. This command will automatically generate the plan and make changes.

  3. Run terraform plan - This command will compare the current state of the system and the changes that will happen if you apply the code change. This is great for verifying the changes that will be applied due to current changes in code.

  4. Run terraform plan -out=sample.plan - This command generates a plan file which can be used to apply. This will also make sure that you only apply the changes that were part of a, This avoids mistakes due to unintended changes in the script after generating the plan.
    - The plan file (sample.plan) can only be viewed by running terraform show sample.plan since its a binary file.

  5. Run terraform apply "sample.plan" - This command applies changes from a specific plan.

  6. Run terraform plan -destroy -out destroy.plan - Generate the plan

    terraform apply destroy.plan - Execute the plan

    Good to clean up resources after ending a development session.



Terraform States

  • State define the current state of the resource or local representation of the state file.

  • The state file can be inspected for the most recent execution by running vi terraform.tfstate

  • Only running terraform plan, terraform refreshes the local state file based on the remote changes.

  • Remote storage for states is used for colloborative development.

  • Useful commands:

    1. terraform state list - Display the resources that have been provisioned.
    2. terraform state show <resource name> - Provides a detailed view about a provisioned resource.
    3. terraform show - Displays a full list of resources in details.

terraform's People

Contributors

nikhil36 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.