Anyone have a working example of <https://www.pulu...
# esc
b
Anyone have a working example of https://www.pulumi.com/docs/pulumi-cloud/cloud-rest-api/#create-environment? I think there is a bug where it doesn’t actually set the content on create, but does work on a subsequent update.
Here are my example: Create that doesn’t set content:
Copy code
curl \
  -H "Accept: application/vnd.pulumi+8" \
  -H "Content-Type: application/json" \
  -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
  --request POST \
  --data '
  values:
    test:
      fn::secret: blah
    environmentVariables:
      EXAMPLE_SETTING: test
  ' \
  <https://api.pulumi.com/api/preview/environments/{org}/test-env>
Update that actually sets the content:
Copy code
curl \
  -H "Accept: application/vnd.pulumi+8" \
  -H "Content-Type: application/json" \
  -H "Authorization: token $PULUMI_ACCESS_TOKEN" \
  --request PATCH \
  --data '
  values:
    test:
      fn::secret: blah
    environmentVariables:
      EXAMPLE_SETTING: test
  ' \
  <https://api.pulumi.com/api/preview/environments/{org}/test-env>
g
That looks like a docs bug, actually. The POST call just creates the empty environment, and then you update the content with the PATCH call as you found. Thanks for catching that!
b
No prob. Was about to say that was the likely case as I was looking at the test cases on the ESC I noted it didn’t send content
g