Diagram of product resources

DigitalOcean Container Registry

DigitalOcean Container Registry management
$250
BUY
682

Module manages a DigitalOcean Container Registry (creates a new one or manages an existing one), creates Docker credentials to access the Container Registry with read-only and read-write permissions, and optionally configures an integration with the DigitalOcean Kubernetes Cluster namespaces.

The module is designed to wrap a DOCR resource and provide namespace-based registry authorization for DigitalOcean Kubernetes Cluster deployed by DOKS module. For the DigitalOcean Container Registry integration with Kubernetes cluster you must authenticate kubernetes provider.

Log in to Corewide IaC registry

Once you have a Corewide Solutions Portal account, this one-time action will use your browser session to retrieve credentials:

 shellterraform login solutions.corewide.com
Provision instructions

Initialize mandatory providers:

Copy and paste into your Terraform configuration and insert the variables:

 hclmodule "tf_do_docr" {
  source  = "solutions.corewide.com/digitalocean/tf-do-docr/digitalocean"
  version = "~> 2.0.1"

  # specify module inputs here or try one of the examples below
  ...
}

Initialize the setup:

 shellterraform init
Define update strategy

Corewide DevOps team strictly follows Semantic Versioning Specification to provide our clients with products that have predictable upgrades between versions. We recommend pinning patch versions of our modules using pessimistic constraint operator (~>) to prevent breaking changes during upgrades.

To get new features during the upgrades (without breaking compatibility), use ~> 2.0 and run terraform init -upgrade

For the safest setup, use strict pinning with version = "2.0.1"

v2.0.1 released 6 months, 3 weeks ago
New version approx. every 28 weeks

Create only Container Registry and access credentials (for example, for integration with Docker on Digital Ocean Droplets):

 hclmodule "docr" {
  source  = "solutions.corewide.com/digitalocean/tf-do-docr/digitalocean"
  version = "~> 2.0"

  name = "applications"
}

Create only Container Registry in nyc1 region and access credentials (for example, for integration with Docker on Digital Ocean Droplets):

 hclmodule "docr" {
  source  = "solutions.corewide.com/digitalocean/tf-do-docr/digitalocean"
  version = "~> 2.0"

  name   = "applications"
  region = "nyc1"
}

Create a Container Registry and integrate it with all of the Kubernetes namespaces with the read-only permissions:

NOTE: Kubernetes Cluster namespaces are fetched as data sources. If the number of namespaces changes, the module will update resources accordingly.

 hclmodule "docr" {
  source  = "solutions.corewide.com/digitalocean/tf-do-docr/digitalocean"
  version = "~> 2.0"

  name = "applications"

  kubernetes_access = {}
}

Create a Container Registry and integrate with the Kubernetes Cluster namespaces: with read-write permissions for the ci namespace and read-only permissions for all other namespaces:

 hclmodule "docr" {
  source  = "solutions.corewide.com/digitalocean/tf-do-docr/digitalocean"
  version = "~> 2.0"

  name = "applications"

  kubernetes_access = {
    rw_namespaces = [
      "ci",
    ]
  }
}

Setup for Container Registry management in several workspaces:

 hclmodule "docr" {
  source  = "solutions.corewide.com/digitalocean/tf-do-docr/digitalocean"
  version = "~> 2.0"

  create = terraform.workspace == "service"
  name   = "applications"

  kubernetes_access = {
    ro_namespaces = [
      "backend",
      "frontend",
    ]

    rw_namespaces = terraform.workspace == "service" ? [
      "ci",
    ] : []
  }
}
Variable Description Type Default Required Sensitive
name The name of the Container Registry string yes no
create Toggle Container Registry creation bool true no no
kubernetes_access Parameters for granting Kubernetes namespaces access to Container Registry (set it as an empty block - {} to grant read-only permissions for all of the Kubernetes namespaces) object {} no no
kubernetes_access.ro_namespaces A list of namespaces that must have read-only permissions list(string) [] no no
kubernetes_access.rw_namespaces A list of namespace that must have read-write permissions list(string) [] no no
region The region slug where the Container Registry should be created in string no no
subscription The identifier for the subscription tier to use for Container Registry (starter, basic or professional) string starter no no
Output Description Type Sensitive
credentials_ro Contains Container Registry Docker credentials with read-only permissions attribute yes
credentials_rw Contains Container Registry Docker credentials with read-write permissions attribute yes
k8s_secret_names Map of K8s secret names with read-only and read-write permissions in authorized namespaces map no
registry Contains a set of the Container Registry attributes computed no
Dependency Version Kind
terraform >= 1.3 CLI
digitalocean/digitalocean ~> 2.19 provider
hashicorp/kubernetes ~> 2.9 provider

Not sure where to start?
Let's find your perfect match.