Implementing our own Terraform provider to allow infrastructure automation

created: Thursday, Sep 12, 2024

We started implementing our own Terraform provider since we think automation is key to cloud adoption.

You can find our provider at github under

and over at the Hashicorp terraform site:

This provider give every customer another path of accessing DTZ resources and implemting their automation/IaaS on top of our services.

To setup the provider you need to generate an API-key through the website. We currently only support apikey authentication.

terraform {
  required_providers {
    dtz = {
      source = "DownToZero-Cloud/dtz"
      version = ">= 0.1.22"
    }
  }
}

provider "dtz" {
  api_key = "apikey-1234"
}

accessing a DTZ context

https://registry.terraform.io/providers/DownToZero-Cloud/dtz/latest/docs/data-sources/context

data "dtz_context" "ctx" {}

output "context-alias" {
  value = data.dtz_context.ctx.alias
}
output "context-id" {
  value = data.dtz_context.ctx.id
}