First time at Zeet?

19 Mar
2024
-
5
min read

Manage Zeet Projects With Terraform Using The New Terraform Provider

Control your entire Zeet-powered multi-cloud footprint with Terraform! Whether it be alongside your existing Terraform Infrastructure, or in a brand new module, the new Terraform Provider gives you maximum control with minimal disruption to your existing workflows.

Jack Dwyer

Product
Changelog
Content
heading2
heading3
heading4
heading5
heading6
heading7

Share this article

Define Your Infrastructure With IaC Using Zeet’s Terraform Provider

Control is more important than ever in cloud computing. Whether you need to know what’s going on and what changed in your cloud, or you want to make changes to your infrastructure in a way that’s directed and informed, you need the right tools.

A PaaS tool or platform can be great for deploying and even managing infrastructure, but only in the context of what’s possible on the platform. DIY, on the other hand, can be great for getting the full control and collaboration that tools like git offer, but what if you want both? What if you want easy deployment and operation, and the benefits and control of a pure IaC solution?

Introducing the Zeet Terraform Provider

Zeet just released a Terraform Provider, meaning you can control all your cloud Projects in Zeet using Terraform. If you’ve already got a fleshed out Terraform-powered Infrastructure stack, simply add the Zeet provider to the bottom of your Terraform and you’re done. No need to change workflows or juggle repositories—your Zeet Projects can now be defined and controlled from the same Terraform Module as all the rest of your Terraform Infrastructure.

In short, you can make tweaks to your infrastructure, collaborate with your team, and get native-change tracking with Terraform code in your VCS.  All this can easily be deployed and controlled with a suite of Zeet operate features like Revisions, native logging and metrics, alerting and notifications, autoscaling, and more across your clouds and clusters using Zeet’s UI, API, or CLI.

Infrastructure-as-Code, Git, and Zeet

To access this feature, simply connect your git, point to your Terraform Module, and click deploy.

You can get a full breakdown of the feature and how to use it here:

If you want to dive right in and add Zeet to your Terraform module, you can add the below code to your Terraform, or you can visit the Terraform Registry to view a full breakdown and configure it to your liking.


terraform {
  required_providers {
    zeet = {
      source  = "zeet-dev/zeet"
      version = "~> 1.0.0"
    }
  }
}

provider "zeet" {
  # Configuration options

  # You can also use the environment variable ZEET_API_URL to set the API URL
  api_url = "https://anchor.zeet.co"

  # You can also use the environment variable ZEET_TOKEN to set the API key
  token = "zeet-api-key"
}

variable "team_id" {
  type = string
}

variable "cluster_id" {
  type = string
}

resource "zeet_group" "group" {
  team_id = var.team_id
  name    = "my-group"
}

resource "zeet_group_subgroup" "subgroup" {
  team_id  = var.team_id
  group_id = zeet_group.group.id
  name     = "my-subgroup"
}

data "zeet_blueprint" "service_container" {
  slug = "zeet-kubernetes-container-app"
}

resource "zeet_project" "container" {
  team_id     = var.team_id
  group_id    = zeet_group.group.id
  subgroup_id = zeet_group_subgroup.subgroup.id

  name         = "my-container"
  blueprint_id = data.zeet_blueprint.service_container.id
  enabled      = false // draft mode

  container = {
    source = {
      container_registry = jsonencode({
        repository = "docker.io/library/nginx",
        tag        = "latest"
      })
    }
    workflow = {
      deploy_timeout_seconds = 300
    }
    kubernetes = jsonencode({
      deployTarget = {
        deployTarget = "KUBERNETES"
        clusterID    = var.cluster_id
      }
      namespace = var.team_id
      app = {
        deployService = true
        ports = [
          {
            port     = "80"
            protocol = "tcp"
            public   = true
            https    = true
          }
        ]
      }
    })
  }
}

output "project_id" {
  description = "value of the project_id used in apiv1"
  value       = zeet_project.container.id
}

output "repo_id" {
  description = "value of the repo_id used in apiv0"
  value       = zeet_project.container.container.repo_id
}

Zeet simplifies your infra stack

With Zeet’s new Terraform Provider capabilities, you get more control over your infrastructure stack while still getting all the deploy and operate features of Zeet. Let us provision your infrastructure for you, so you can focus on building.

To try it out, it’s easy to get started using this guide, and if you’re a Terraform-powered company, or just want to get access to Terraform’s power while still getting Zeet’s suite of Deployment and Operational tools, just reach out.

Subscribe to Changelog newsletter

Jack from the Zeet team shares DevOps & SRE learnings, top articles, and new Zeet features in a twice-a-month newsletter.

Thank you!

Your submission has been processed
Oops! Something went wrong while submitting the form.