/terraform-provider-akp

Terraform provider for managing Akuity Platform resources

Primary LanguageGoMozilla Public License 2.0MPL-2.0

Terraform logo

Terraform Provider for Akuity Platform

Tests

With this provider you can manage Argo CD instances and clusters on Akuity Platform.

Requirements

Typical use case

Add a new cluster test-cluster to the existing Argo CD instance manualy-created and install the agent to the configured cluster.

  1. Create an API key for your organization
    • Use Admin role for the key
  2. Configure Environment variables
export AKUITY_API_KEY_ID=<key-id>
export AKUITY_API_KEY_SECRET=<key-secret>
  1. Use this or similar configuration:
terraform {
  required_providers {
    akp = {
      source = "akuity/akp"
      version = "~> 0.4"
    }
  }
}

provider "akp" {
  org_name = "<organization-name>"
}

# Read the existing Argo CD Instance
data "akp_instance" "existing" {
  name = "manualy-created"
}

# Add cluster to the existing instance and install the agent
resource "akp_cluster" "test" {
  name             = "test-cluster"
  description      = "Test Cluster 1"
  size             = "small"
  namespace        = "akuity"
  instance_id      = data.akp_instance.existing.id
  kube_config      = {
      # Configuration similar to `kubernetes` provider
  }
}

Creating an Argo CD instance with Terraform

resource "akp_instance" "example" {
  name        = "tf-example"
  version     = "v2.6.0"
  description = "An example of terraform automation for managing Akuity Platform resources"
  web_terminal = {
    enabled = true
  }
  kustomize = {
    build_options = "--enable-helm"
  }
  secrets = {
    sso_secret = {
      value = "secret"
    }
  }
  image_updater = {
    secrets = {
      docker_json = {
        value = "secret"
      }
    }
    registries = {
      docker = {
        prefix      = "docker.io"
        api_url     = "https://registry-1.docker.io"
        credentials = "secret:argocd/argocd-image-updater-secret#docker_json"
      }
    }
  }
  declarative_management_enabled = true
  image_updater_enabled          = true
}

See more examples in terraform-akp-example repo