Pulumi Cloud: is there a way to get which projects...
# general
c
Pulumi Cloud: is there a way to get which projects are importing an environment? It's available in the UI on the "Imported By" tab. I'd like to make a webhook when an environment is updated to cascade trigger
pulumi up
all stacks that import the environment. I looked in the API docs and couldn't find it or another best practice. Currently the alternative seems to be getting all projects, then looping through each project and seeing if it imports the environment 😞 In the webapp basically exactly what I want is coming from
<https://api.pulumi.com/api/esc/environments/><org>/<esc_project>/<environment>/referrers?allRevisions=true&latestStackVersionOnly=true
Copy code
{
  "referrers": {
    "latest": [
      {
        "stack": {
          "project": "<project1>",
          "stack": "dev",
          "version": 6
        }
      },
      {
        "stack": {
          "project": "<project2>",
          "stack": "dev",
          "version": 47
        }
      },
      {
        "stack": {
          "project": "<project3>",
          "stack": "qa",
          "version": 8
        }
      },
      {
        "stack": {
          "project": "<project4>",
          "stack": "dev",
          "version": 20
        }
      }
    ]
  },
  "continuationToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
m
Although we are missing public documentation for this API, there should be no issues using the API you shared above. I will look at filing a docs issue to track updating the docs to include this API.
🙌 1