How to add dependency between helm chart and kubernetes resource

I’m installing a helm chart which creates a CRD and then I want to instantiate the CRD defined in the helm chart. What’s the correct way to declare a dependency between them so that terraform doesn’t try to create the CRD until after the helm chart has finished installing?

    new helm.Release(this, "doppler-kubernetes-operator-helm-chart", {
      chart: "doppler-kubernetes-operator",
      name: "doppler",
      repository: "https://helm.doppler.com",
      version: "1.2.0"
    })

    const dopplerOperatingSystemNamespace = "doppler-operator-system";

    // create a secret referenced by the CRD
    const dopplerApiServerProjectServiceTokenSecret = new kubernetes.Secret(this, "doppler-api-server-project-service-token", {
      metadata: {
        name: "doppler-api-server-project-service-token",
        namespace: dopplerOperatingSystemNamespace
      },
      data: {
        "serviceToken": "<some secret>"
      }
    })

    // Create the CRD <------------- how do I get this to depend on the helm chart?
    new kubernetes.Manifest(this, "doppler-kubernetes-operator", {
      manifest: {
        apiVersion: "secrets.doppler.com/v1alpha1",
        kind: "DopplerSecret",
        metadata: {
          name: "doppler-secret-default",
          namespace: dopplerOperatingSystemNamespace,
        },
        spec: {
          tokenSecret: {
            name: dopplerApiServerProjectServiceTokenSecret.metadata.name
          },
          managedSecret: {
            name: "doppler-api-server-managed-secret",
            namespace: "default"
          }
        }
      }
    })

In this case I would like to only attempt creating doppler-kubernetes-operator after the helm chart has finished installing.

I’m a newbie myself so might not be 100% accurate; but you should be able to assign the helm.Release into a variable, and pass that into depends_on in kubernetes.Manifest.

d’oh you’re right! I was looking for that argument and Intellij wasn’t autocompleting it but I guess my cursor was in the wrong position…