Skip to main content
The sync block declares a GitOps sync target. ubx creates the CRD; a GitOps controller (ArgoCD, Flux) reconciles the actual deployment. Infra outputs are passed as parameters.

Syntax

sync "controller_type" "name" {
  # attributes
}

Supported Types

TypeCRD
argocdArgoCD Application (argoproj.io/v1alpha1)
fluxFlux Kustomization (kustomize.toolkit.fluxcd.io/v1)

ArgoCD Example

sync "argocd" "backend" {
  repo      = "https://github.com/my-org/app-config"
  path      = "apps/backend"
  target    = "https://kubernetes.default.svc"
  namespace = "argocd"
  values = {
    db_host = ~unit.aws_rds_instance.db.endpoint
    db_port = "5432"
  }
}
Generated TypeScript:
const backend = new k8s.apiextensions.CustomResource("backend", {
    apiVersion: "argoproj.io/v1alpha1",
    kind: "Application",
    metadata: { name: "backend", namespace: "argocd" },
    spec: {
        source: { repoURL: "https://github.com/my-org/app-config", path: "apps/backend" },
        destination: { server: "https://kubernetes.default.svc" },
        helm: {
            parameters: pulumi.all([db.endpoint]).apply(([_dep0]) => ([
                { name: "dbHost", value: _dep0 },
                { name: "dbPort", value: "5432" },
            ]))
        },
    },
} as any);

Attribute Mapping

ubx attributeArgoCD field
repospec.source.repoURL
pathspec.source.path
targetspec.destination.server
namespacemetadata.namespace
valuesspec.helm.parameters as [{name, value}]

Flux Example

sync "flux" "infra" {
  repo      = "https://github.com/my-org/fleet-infra"
  path      = "./clusters/prod"
  namespace = "flux-system"
  values = {
    vpc_id = ~unit.aws_vpc.main.id
  }
}

Meta-Arguments

sync "argocd" "backend" {
  repo       = "https://github.com/my-org/app-config"
  path       = "apps/backend"
  target     = "https://kubernetes.default.svc"
  namespace  = "argocd"
  depends_on = [unit.aws_rds_instance.db]
  when       = input.env == "prod"
}