Giter Club home page Giter Club logo

introduction-to-terraform-with-firehydrant's Introduction

Introduction to Terraform with the FireHydrant Provider

What is Terraform?

Terraform is an infrastructure-as-code provisioning tool comprised of the Terraform language and the Terraform CLI. It lets you treat all parts of operations like software - defining, creating, updating, and destroying your infrastructure with code.

  • Written in Go
  • Language is declarative, meaning your configurations describe your desired end state, not the steps necessary to get there. Terraform handles the underlying logic of figuring out how to get to the end state by creating a graph of resource dependencies and using that to determine the correct order to make changes.
  • Terraform generally takes an immutable infrastructure approach, meaning once something is created, it doesn't get changed. Any changes needed are generally made by destroying the existing resource and recreating it with the desired configuration.

Why use Terraform?

  • Allows you to automate your provisioning workflows. This allows for less human errors, speeds up how long it takes to provision new infrastructure, and makes things more consistent.
  • Defines infrastruture in human-readable configuration files that can be put in version control. Once in version control, you can run tests, do code reviews, and track changes over time.
  • Enables reused through composable modules.
  • Supports encoding security and other standards as code so you can have consistently applied policies across all of your infrastruture.

The Core Terraform Workflow Using the FireHydrant Provider

  • Write
    1. Make sure you have Terraform installed.
    2. Make sure Terraform is working by running terraform -version. You can see other commands avaialble with terraform -help
    3. Clone this repository and navigate into the firehydrant-configuration directory. You should see 3 files in this directory: main.tf, variables.tf, and outputs.tf.
    4. Generate a bot token for yourself in FireHydrant and export it to the environment variable TF_VAR_firehydrant_api_key
      export TF_VAR_firehydrant_api_key=YOUR_BOT_TOKEN_HERE
      
    5. Export a unique prefix to the environment variable TF_VAR_resource_prefix (ideally something like your name, with only alphanumeric characters)
      export TF_VAR_resource_prefix=YOUR_CHOSEN_PREFIX_HERE
      
      This will help make sure the resources you create don't conflict with anyone else's.
    6. Get the IDs for data-source-service, data-source-functionality, and data-source-environment fron the FireHydrant UI and add them to your main.tf file under the Data Sources section.
    7. Run terraform init to download any necessary providers needed to work with your configuration.
    8. Run terraform fmt to automatically format your configuration with the standard Terraform style.
    9. Run terraform validate to check whether your current configuration is valid.
  • Plan
    1. Run terraform plan. This will show a preview of everything that will be created if your run terraform apply with your current configuration.
  • Apply
    1. Run terraform apply. This will generate another plan and ask for your approval before creating anything. Type 'yes' and then look in the FireHydrant UI to see your applied changes.
    2. Update your configuration by changing the attributes of a few resources. Save your changes.
    3. Run terraform apply again. This will generate another plan and ask for your approval before changing anything. Type 'yes' and then look in the FireHydrant UI to see your applied changes.
    4. Run terraform destroy. This will generate another plan and ask for your approval before destroying anything. Type 'yes' and then look in the FireHydrant UI to see that everything .

Learning Resources

  1. Intro to Terraform documentation
  2. Intro to Terraform CLI tutorial
  3. HashiCorp Learn
  4. Terraform CLI documentation
  5. Terraform Language documentation
  6. FireHydrant Terraform provider documentation
  7. FireHydrant Terraform provider repository

introduction-to-terraform-with-firehydrant's People

Contributors

lafentres avatar

Watchers

 avatar  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.