All Projects β†’ env0 β†’ Terratag

env0 / Terratag

Licence: mpl-2.0
Terratag is a CLI tool that enables users of Terraform to automatically create and maintain tags across their entire set of AWS, Azure, and GCP resources

Projects that are alternatives of or similar to Terratag

Terracognita
Reads from existing Cloud Providers (reverse Terraform) and generates your infrastructure as code on Terraform configuration
Stars: ✭ 452 (+17.4%)
Mutual labels:  aws, cloud, azure, gcp, terraform, infrastructure-as-code, devops
Infracost
Cloud cost estimates for Terraform in pull requestsπŸ’°πŸ“‰ Love your cloud bill!
Stars: ✭ 4,505 (+1070.13%)
Mutual labels:  aws, cloud, gcp, terraform, infrastructure-as-code, azure
Terraformer
CLI tool to generate terraform files from existing infrastructure (reverse Terraform). Infrastructure to Code
Stars: ✭ 6,316 (+1540.52%)
Mutual labels:  aws, cloud, gcp, terraform, hcl, infrastructure-as-code
Checkov
Prevent cloud misconfigurations during build-time for Terraform, Cloudformation, Kubernetes, Serverless framework and other infrastructure-as-code-languages with Checkov by Bridgecrew.
Stars: ✭ 3,572 (+827.79%)
Mutual labels:  aws, azure, gcp, terraform, infrastructure-as-code, devops
Cloudguardiaas
Check Point CloudGuard Network Security repository containing solution templates, Terraform templates, tools and scripts for deploying and configuring CloudGuard Network Security products.
Stars: ✭ 27 (-92.99%)
Mutual labels:  aws, azure, gcp, terraform, hcl
Terraform Modules
Terraform Modules
Stars: ✭ 25 (-93.51%)
Mutual labels:  aws, terraform, hcl, infrastructure-as-code, devops
Azure arc
Automated Azure Arc environments
Stars: ✭ 224 (-41.82%)
Mutual labels:  aws, azure, gcp, terraform, hcl
Pulumi
Pulumi - Developer-First Infrastructure as Code. Your Cloud, Your Language, Your Way πŸš€
Stars: ✭ 10,887 (+2727.79%)
Mutual labels:  aws, cloud, azure, gcp, infrastructure-as-code
Docker Swarm
🐳🐳🐳 This repository is part of a blog series on Docker Swarm example using VirtualBox, OVH Openstack, Azure and Amazon Web Services AWS
Stars: ✭ 43 (-88.83%)
Mutual labels:  aws, cloud, azure, infrastructure-as-code, devops
Engine
Deploy your apps on any Cloud provider in just a few seconds
Stars: ✭ 1,132 (+194.03%)
Mutual labels:  aws, cloud, azure, gcp, terraform
Terraform
Terraform automation for Cloud
Stars: ✭ 121 (-68.57%)
Mutual labels:  aws, terraform, hcl, infrastructure-as-code, devops
Hybrid multicloud overlay
MutiCloud_Overlay demonstrates a use case of overlay over one or more clouds such as AWS, Azure, GCP, OCI, Alibaba and a vSphere private infrastructure in Hub and spoke topology, point to point topology and in a Single cloud. Overlay protocols IPv6 and IPv4 are independent of underlying infrastructure. This solution can be integrated with encryption and additional security features.
Stars: ✭ 127 (-67.01%)
Mutual labels:  aws, azure, gcp, terraform, hcl
My Links
Knowledge seeks no man
Stars: ✭ 311 (-19.22%)
Mutual labels:  aws, cloud, gcp, infrastructure-as-code, devops
Terraform Kubestack
Terraform GitOps Framework β€” Everything you need to build reliable automation for AKS, EKS and GKE Kubernetes clusters in one free and open-source framework.
Stars: ✭ 300 (-22.08%)
Mutual labels:  aws, azure, gcp, terraform, hcl
Terraform Modules
Reusable Terraform modules
Stars: ✭ 63 (-83.64%)
Mutual labels:  aws, cloud, terraform, hcl, devops
Cloudblock
Cloudblock automates deployment of secure ad-blocking for all of your devices - even when mobile. Step-by-step text and video guides included! Compatible clouds include AWS, Azure, Google Cloud, and Oracle Cloud. Cloudblock deploys Wireguard VPN, Pi-Hole DNS Ad-blocking, and DNS over HTTPS in a cloud provider - or locally - using Terraform and Ansible.
Stars: ✭ 257 (-33.25%)
Mutual labels:  aws, cloud, gcp, terraform, hcl
Docker Android
Android in docker solution with noVNC supported and video recording
Stars: ✭ 4,042 (+949.87%)
Mutual labels:  aws, cloud, azure, gcp, terraform
Terraform Aws Gitlab Runner
Terraform module for AWS GitLab runners on ec2 (spot) instances
Stars: ✭ 292 (-24.16%)
Mutual labels:  aws, terraform, hcl, infrastructure-as-code
Kubify
Terraform Template to Setup a Kubernetes Cluster on OpenStack/AWS/Azure
Stars: ✭ 142 (-63.12%)
Mutual labels:  aws, azure, terraform, hcl
Externalsecret Operator
An operator to fetch secrets from cloud services and inject them in Kubernetes
Stars: ✭ 177 (-54.03%)
Mutual labels:  aws, cloud, azure, gcp

Terratag by env0 ci FOSSA Status

Terratag is brought to you with β€οΈ  by

Let your team manage their own environment in AWS, Azure and Google.
Governed by your policies and with complete visibility and cost management.

What?

Terratag is a CLI tool allowing for tags or labels to be applied across an entire set of Terraform files. Terratag will apply tags or labels to any AWS, GCP and Azure resources.

Terratag in action

Why?

Maintaining tags across your application is hard, especially when done manually. Terratag enables you to easily add tags to your existing IaC and benefit from some cross-resource tag applications you wish you had thought of when you had just started writing your Terraform, saving you tons of time and making future updates easy. Read more on why tagging is important.

How?

Prerequisites

  • Terraform 0.11, 0.12, 0.13 or 0.14

Usage

  1. Install from homebrew:

    ➜ brew install env0/terratag/terratag
    

    Or download the latest release binary .

  2. Initialize Terraform modules to get provider schema and pull child modules:

     terraform init  
    
  3. Run Terratag

     terratag -dir=foo/bar -tags={\"environment_id\": \"prod\"}
    

    Terratag supports the following arguments:

    • -dir - optional, the directory to recursively search for any .tf file and try to terratag it.
    • -tags - tags, as valid JSON (NOT HCL)
    • -skipTerratagFiles - optional. Default to true. Skips any previously tagged - (files with terratag.tf suffix)

Example Output

Before Terratag

|- aws.tf
|- gcp.tf
# aws.tf
provider "aws" {
  version = "~> 2.0"
  region  = "us-east-1"
}

resource "aws_s3_bucket" "b" {
  bucket = "my-tf-test-bucket"
  acl    = "private"

  tags {
    Name        = "My bucket"
  }
}
#gcp.tf
resource "google_storage_bucket" "static-site" {
  name          = "image-store.com"
  location      = "EU"
  force_destroy = true

  bucket_policy_only = true

  website {
    main_page_suffix = "index.html"
    not_found_page   = "404.html"
  }
  cors {
    origin          = ["http://image-store.com"]
    method          = ["GET", "HEAD", "PUT", "POST", "DELETE"]
    response_header = ["*"]
    max_age_seconds = 3600
  }
  labels = {
    "foo" = "bar"
  }
}

After Terratag

Running terratag -tags={\"env0_environment_id\":\"dev\",\"env0_project_id\":\"clientA\"} will output:

|- aws.terratag.tf
|- gcp.terratag.tf
|- aws.tf.bak
|- gcp.tf.bak
# aws.terratag.tf
provider "aws" {
  version = "~> 2.0"
  region  = "us-east-1"
}

resource "aws_s3_bucket" "b" {
  bucket = "my-tf-test-bucket"
  acl    = "private"

  tags = merge( map("Name", "My bucket" ), local.terratag_added_main)
}
locals {
  terratag_added_main = {"env0_environment_id"="dev","env0_project_id"="clientA"}
}
# gcp.terratag.tf
resource "google_storage_bucket" "static-site" {
  name          = "image-store.com"
  location      = "EU"
  force_destroy = true

  bucket_policy_only = true

  website {
    main_page_suffix = "index.html"
    not_found_page   = "404.html"
  }
  cors {
    origin          = ["http://image-store.com"]
    method          = ["GET", "HEAD", "PUT", "POST", "DELETE"]
    response_header = ["*"]
    max_age_seconds = 3600
  }
  labels = merge( map("foo" , "bar"), local.terratag_added_main)
}
locals {
  terratag_added_main = {"env0_environment_id"="dev","env0_project_id"="clientA"}
}

Optional CLI flags

  • -dir=<path> - defaults to .. Sets the terraform folder to tag .tf files in
  • -skipTerratagFiles=false - Dont skip processing *.terratag.tf files (when running terratag a second time for the same directory)
  • -verbose=true - Turn on verbose logging
  • -rename=false - Instead of replacing files named <basename>.tf with <basename>.terratag.tf, keep the original filename
See more samples here

Notes

  • Resources already having the exact same tag as the one being appended will be overridden

Develop

Issues and Pull Requests are very welcome!

Prerequisites

  • Go > 1.13.5

Build

git clone https://github.com/env0/terratag
go get
go build

Test

Structure

The test suite will look for fixtures under test/fixtures/terraform_xx.
Each fixture placed there should have the following directory structure:

my_fixture
|+ input
  ...            // any depth under /input
     |- main.tf  // this is where we will run all terraform/terratag commands
|- expected
  • input is where you should place the terraform files of your fixture.
    All commands will be executed wherever down the hierarchy where main.tf is located.
    We do that to allow cases where complex nested submodule resolution may take place, and one would like to test how a directory higher up the hierarchy gets resolved.
  • expected is a directory in which all .terratag.tf files will be matched with the output directory

What's being tested?

Each test will run:

  • terraform init
  • terratag
  • terraform validate

And finally, will compare the results in out with the expected directory

Running Tests

Tests can only run on a specific Terraform version -

go test -run TestTerraformXX

We use tfenv to switch between versions. The exact versions used in the CI tests can be found under test/tfenvconf.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].