Skip to content

project-octal/terraform-kubernetes-argocd-project

Repository files navigation

Project-Octal: ArgoCD Project

A Terraform module for provisioning and configuring ArgoCD projects. This module can be used with or without the Project-Octal terraform-kubernetes-argocd module. The only hard requirement is a Kubernetes cluster with a functioning ArgoCD deployment.


Note: This repository has been renamed from terraform-argocd-project to terraform-kubernetes-argocd-project to better follow the Terraform module naming convention.


Example

# The namespace the project will reside in
resource "kubernetes_namespace" "kergiva_namespace" {
  metadata {
    name = local.instance_name
  }
}

# Create the ArgoCD Project.
module "project" {
  source  = "project-octal/argocd-project/kubernetes"
  version = "1.0.4"
  
  argocd_namespace = data.terraform_remote_state.infra.outputs.cluster_argocd_namespace
  name             = local.instance_name
  description      = local.project_description
  destinations = [
    {
      server    = "https://kubernetes.default.svc"
      namespace = kubernetes_namespace.kergiva_namespace.metadata.0.name
    }
  ]
  permissions = [
    {
      name = "developer-read-only"
      description = "A read-only role for the developers of Kergiva"
      policies = [
        {
          resource = "applications"
          action = "get"
          object = "*"
        }
      ]
      oidc_groups = [
        "argocd-kergiva-developers"
      ]
    }
  ]
}

Requirements

Name Version
terraform >= 0.14.8, < 2.0.0

Providers

Name Version
kubernetes 2.6.1

Modules

No modules.

Resources

Name Type
kubernetes_manifest.argo_project resource

Inputs

Name Description Type Default Required
cascade_delete Set to true if this application should cascade delete bool false no
cluster_resource_whitelist A list of cluster-scoped resources the project is allowed to access list(object({ kind : string, group : string })) [] no
description A description for this ArgoCD project string n/a yes
destinations A list of server and namespaces that this project may deploy to. list(object({ server : string, namespace : string }))
[
{
"namespace": "default",
"server": "https://kubernetes.default.svc"
}
]
no
name The name for this ArgoCD project string n/a yes
namespace The name of the target ArgoCD Namespace string n/a yes
namespace_resource_blacklist A list of namespace-scoped resources the project is NOT allowed to access list(object({ kind : string, group : string })) [] no
namespace_resource_whitelist A list of namespace-scoped resources the project is allowed to access list(object({ kind : string, group : string })) [] no
permissions A list of roles and their policies to define within ArgoCD
list(object({
name : string
description : string
policies : list(object({
resource : string
action : string
object : string
}))
oidc_groups : list(string)
}))
[] no
source_repos A list of repositories this project may pull from list(string)
[
"*"
]
no

Outputs

Name Description
name n/a