Git Product home page Git Product logo

elopez-terraform-templates's Introduction

elopez-terraform-templates

Terraform templates from different trainings or developed by myself

NOTE : Inside each folder there will be specific README files adapted to the template request

Useful commands

This small part provide some useful commands for terraform

terraform state list

List all resources we have state for, mostly resources that i created

terraform state show <resource>

Provides detailf of an specific resource, example:

  • terraform state show aws_instance.myfirstServer
terraform apply --auto-approve

Apply your terraform template with automatic approval (you must be cautious with this)

terraform output

Show all the outputs defined on your template

terraform refresh

Refresh the state of your terraform deployment without actually redeploying anything, helpful if you add outputs to your template and want to see how it looks like

terraform destroy --target resource.name

This command will destroy a specific resource instead of all the resources defined in the template

  • Example: terraform destroy --target aws_instance.myfirstServer
terraform apply --target resource.name

This command will create a specific resource instead of all the resources defined in the template

  • Example: terraform apply --target aws_instance.myfirstServer
terraform apply -var "var_name=var_value"

Apply a terraform template entering the value you defined in a variable inside the template.

  • Lets say you define the following variable:
    • variable "instance_type" { description = "Instance Type"}
    • you can apply it using terraform apply -var "instance_type=t3.micro"
terraform apply -var-file <name>.tfvars

This command apply a template using the variables defined in an specific file.

  • Note by default terraform look for a file named terraform.tfvars for variables but you can rename this file and send it to terraform

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.