https://pulumi.com logo
#esc
Title
# esc
b

brash-gigabyte-81569

04/03/2024, 7:10 PM
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

gorgeous-egg-16927

04/03/2024, 7:31 PM
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

brash-gigabyte-81569

04/03/2024, 7:32 PM
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

gorgeous-egg-16927

04/03/2024, 7:42 PM