diff --git a/content/docs/esc/environments/imports.md b/content/docs/esc/environments/imports.md index 2c4b779f4cae..24fbec205220 100644 --- a/content/docs/esc/environments/imports.md +++ b/content/docs/esc/environments/imports.md @@ -17,10 +17,10 @@ Different applications are often configured in similar ways and with common valu To address these challenges, Pulumi ESC allows you to identify common or closely related configuration settings and define them only once, as individual environments, and then _import_ those environments into other, more specialized environments as needed. Imports also allow you to expose certain environments without having to distribute any concrete values and to delegate responsibility for particular environments to other teams in your organization. Environments can import both static and dynamic values, including secrets, from any number of other environments. -In the following example, two environments, `aws-dev` and `stripe-dev`, are used to compose a third environment, `myapp-dev`: +In the following example, two environments, `aws/dev` and `stripe/dev`, are used to compose a third environment, `myapp/dev`: ```yaml -# myorg/aws-dev +# myorg/aws/dev values: aws: region: us-west-2 @@ -34,7 +34,7 @@ values: ``` ```yaml -# myorg/stripe-dev +# myorg/stripe/dev values: stripe: apiURL: https://api.stripe.com @@ -42,16 +42,16 @@ values: fn::secret: sk_XemWAl12i4x3hZhp4vBKDEXAMPLE ``` -The application-specific `myapp-dev` environment then `imports` these two environments and use their settings to compose new values: +The application-specific `myapp/dev` environment then `imports` these two environments and use their settings to compose new values: ```yaml -# myorg/myapp-dev +# myorg/myapp/dev imports: - - aws-dev - - stripe-dev + - aws/dev + - stripe/dev values: - greeting: Hello from the dev environment! + greeting: Hello from the myapp/dev environment! environmentVariables: AWS_ACCESS_KEY_ID: ${aws.login.accessKeyId} @@ -61,19 +61,19 @@ values: GREETING: ${greeting} ``` -Finally, `esc run` renders `myapp-dev`'s environment variables for use on the command line: +Finally, `esc run` renders `myapp/dev`'s environment variables for use on the command line: ```bash -$ esc run myorg/myapp-dev -- bash -c 'echo $GREETING' +$ esc run myorg/myapp/dev -- bash -c 'echo $GREETING' Hello from the dev environment! -$ esc run myorg/myapp-dev -- bash -c 'echo $STRIPE_API_URL' +$ esc run myorg/myapp/dev -- bash -c 'echo $STRIPE_API_URL' https://api.stripe.com -$ esc run myorg/myapp-dev -- bash -c 'echo $STRIPE_API_KEY' +$ esc run myorg/myapp/dev -- bash -c 'echo $STRIPE_API_KEY' [secret] -$ esc run myorg/myapp-dev -- bash -c 'echo $AWS_SECRET_ACCESS_KEY' +$ esc run myorg/myapp/dev -- bash -c 'echo $AWS_SECRET_ACCESS_KEY' [secret] $ echo "'$GREETING'" diff --git a/content/docs/esc/integrations/infrastructure/pulumi-iac/_index.md b/content/docs/esc/integrations/infrastructure/pulumi-iac/_index.md index 86d9689ac727..c343f86bba09 100644 --- a/content/docs/esc/integrations/infrastructure/pulumi-iac/_index.md +++ b/content/docs/esc/integrations/infrastructure/pulumi-iac/_index.md @@ -12,16 +12,20 @@ menu: With support for Pulumi ESC built into the Pulumi CLI, you can expose an environment's settings and secrets to any or all of your Pulumi stacks, bypassing the need to define and maintain individual configuration settings or secrets "locally" in Pulumi config files. The optional `pulumiConfig` key enables this. -The following example updates the `myorg/myapp-dev` environment by adding a `pulumiConfig` block. This block specifies the [Pulumi configuration](/docs/concepts/config/) settings to expose to the Pulumi stack at runtime: +{{% notes type="info" %}} +The [pulumi](/docs/iac/cli/) CLI (as of v3.139.0) now tracks ESC environments used in stack updates. You can view which ESC environments were used in your updates on the Stack Overview page within the Pulumi Cloud Console. +{{% /notes %}} + +The following example updates the `myorg/myapp/dev` environment by adding a `pulumiConfig` block. This block specifies the [Pulumi configuration](/docs/concepts/config/) settings to expose to the Pulumi stack at runtime: ```yaml -# myorg/myapp-dev +# myorg/myapp/dev imports: - - aws-dev - - stripe-dev + - aws/dev + - stripe/dev values: - greeting: Hello from the dev environment! + greeting: Hello from the myapp/dev environment! environmentVariables: AWS_ACCESS_KEY_ID: ${aws.login.accessKeyId} @@ -43,7 +47,7 @@ Any stack belonging to the `myorg` organization can inherit these settings by ad ```yaml # Pulumi.dev.yaml environment: - - myapp-dev + - myapp/dev ``` Values are accessible using the standard [configuration API](/docs/concepts/config/#code): @@ -86,6 +90,16 @@ export const url = functionUrl.functionUrl; Stacks may only read from environments that belong to the same Pulumi organization. +### Convert existing Stack Config to an ESC Environment + +To convert your existing stack config to a new ESC Environment, you can use the pulumi CLI to run the following: + +```shell +pulumi config env init +``` + +See [here](/docs/iac/cli/commands/pulumi_config_env_init/) for more information. + ### Automation API integration You can use ESC with [Automation API](/docs/using-pulumi/automation-api/) in [Node](/docs/reference/pkg/nodejs/pulumi/pulumi/classes/automation.Stack.html#addEnvironments), [Go](https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3@v3.117.0/go/auto#LocalWorkspace.AddEnvironments), and [Python](docs/reference/pkg/python/pulumi/#pulumi.automation.LocalWorkspace.add_environments). The following methods are supported today: