Code Monkey home page Code Monkey logo

gitops-bridge-argocd-bootstrap-terraform's Introduction

ARCHIVED REPOSITORY: Create issues and PRs in the new repository

gitops-bridge-argocd-bootstrap-terraform

Terraform module for gitops-bridge argocd bootstrap

It handles three aspect of ArgoCD bootstrap

  1. Installs an intial deployment of argocd, this deployment (gets replaced by argocd applicationset)
  2. Creates the ArgoCD cluster secret (including in-cluster)
  3. Creates the intial set App of Apps (addons, workloads, etc.)

To be use with gitops-bridge project, see example here

Usage

locals {
  name                   = "ex-${replace(basename(path.cwd), "_", "-")}"
  environment            = "dev"
  cluster_version        = "1.27"
  gitops_addons_url      = "https://github.com/gitops-bridge-dev/gitops-bridge-argocd-control-plane-template"
  gitops_addons_basepath = ""
  gitops_addons_path     = "bootstrap/control-plane/addons"
  gitops_addons_revision = "HEAD"

  oss_addons = {
    enable_argo_workflows = true
    enable_foo                                   = true # you can add any addon here, make sure to update the gitops repo with the corresponding application set
  }
  addons = merge(local.oss_addons, { kubernetes_version = local.cluster_version })

  addons_metadata = merge(
    {
      addons_repo_url      = local.gitops_addons_url
      addons_repo_basepath = local.gitops_addons_basepath
      addons_repo_path     = local.gitops_addons_path
      addons_repo_revision = local.gitops_addons_revision
    }
  )

  argocd_apps = {
    addons = file("${path.module}/bootstrap/addons.yaml")
    workloads = file("${path.module}/bootstrap/workloads.yaml")
  }

}

################################################################################
# GitOps Bridge: Bootstrap
################################################################################
module "gitops_bridge_bootstrap" {
  source = "github.com/gitops-bridge-dev/gitops-bridge-argocd-bootstrap-terraform?ref=v2.0.0"

  cluster = {
    cluster_name = local.name
    environment  = local.environment
    metadata     = local.addons_metadata
    addons       = local.addons
  }
  apps = local.argocd_apps
}

Requirements

Name Version
terraform >= 1.0
helm >= 2.10.1
kubernetes >= 2.22.0

Providers

Name Version
helm >= 2.10.1
kubernetes >= 2.22.0

Modules

No modules.

Resources

Name Type
helm_release.argocd resource
helm_release.bootstrap resource
kubernetes_secret_v1.cluster resource

Inputs

Name Description Type Default Required
apps argocd app of apps to deploy any {} no
argocd argocd helm options any {} no
cluster argocd cluster secret any null no
create Create terraform resources bool true no
install Deploy argocd helm bool true no

Outputs

Name Description
apps ArgoCD apps
argocd Argocd helm release
cluster ArgoCD cluster

gitops-bridge-argocd-bootstrap-terraform's People

Contributors

csantanapr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gitops-bridge-argocd-bootstrap-terraform's Issues

is this ready for usage?

Thanks for making this! Much cleaner to have the bootstrap in its own repo. I was in the middle of configuring our code with the old bootstrap module when I noticed this one. Is this ready to use?

Something wrong with bootstrap yaml file rendering

./bootstrap/addons.yaml

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: addons
  namespace: argocd
spec:
  destination:
    server: https://kubernetes.default.svc
  project: system
  source:
    helm:
      values: |
        "account": "{{metadata.annotations.aws_account_id}}"
        "clusterName": "{{metadata.annotations.cluster_name}}"
        "region": "{{metadata.annotations.aws_region}}"
        "repoUrl": "{{metadata.annotations.addons_repo_revision}}"
    path: '{{metadata.annotations.addons_repo_path}}' #chart
    repoURL: '{{metadata.annotations.addons_repo_url}}'
    targetRevision: '{{metadata.annotations.addons_repo_revision}}'
  syncPolicy:
    retry:
      backoff:
        duration: 10s
        factor: 2
        maxDuration: 3m
      limit: 10
    syncOptions:
      - Validate=false
      - CreateNamespace=true
      - PrunePropagationPolicy=foreground
      - PruneLast=true
      - ServerSideApply=true
      - RespectIgnoreDifferences=true

all of the metadata.annotations are successfully created as secret.

Error applying several bootstraps with terraform

While working with the cluster, sometimes, Terraform is not able to apply the manifest due to fetch error:

│ Error: argocd/bootstrap-addons failed to fetch resource from kubernetes: the server could not find the requested resource
│ 
│   with module.eks_cluster.module.gitops_bridge_bootstrap.kubectl_manifest.bootstrap["addons"],
│   on .terraform/modules/eks_cluster.gitops_bridge_bootstrap/main.tf line 93, in resource "kubectl_manifest" "bootstrap":
│   93: resource "kubectl_manifest" "bootstrap" {
│ 

This seems to be related to gavinbunney/terraform-provider-kubectl#270

One of the suggested workaround, is to relay on a raw helm chart to apply the manifest

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.