mirror of https://github.com/pulumi/pulumi.git
3bcbe35c0a
10832: Hierarchical and structured config implementation: the initial pass r=Zaid-Ajaj a=Zaid-Ajaj # Description <!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. --> This implements the initial pass of hierarchical and structured config which fixes #10602. This changes the CLI such that configuration can now be defined at the _project_ level using a `config` block. The configuration values defined here are inherited by all the stacks and made available to the Pulumi program without having to duplicate values in every stack (hence hierarchical) and the values are also typed / structured. Example Project.yaml syntax: ```yaml name: config-test runtime: dotnet config: instanceSize: type: string default: t3.micro instanceCount: type: integer default: 5 ``` This can also be rewritten using short-hand syntax and will be equivalent to the above ```yaml name: config-test runtime: dotnet config: instanceSize: t3.micro instanceCount: 5 ``` The complex types allowed for now are only arrays and nested arrays: ```yaml name: config-test runtime: dotnet config: availabilityZones: type: array items: type: string default: [us-east-1-atl-1a, us-east-1-chi-1a] ``` - Project-level configuration values that do not have a default value _MUST_ be defined at the stack level - Stack configuration values are type-checked against their defined type in the project file i.e. Pulumi.yaml - Short-hand syntax only accepts primitive values (no arrays for now) - Accepted config types are a subset of a JSON schema where the property `type: string | integer | boolean | array` is expected. When `type: array` then a config block must also have property `items` which defines the type of array elements (can be nested) - Running `pulumi config` will list the configuration values from the selected stack _AND_ the values inherited from the project - After a successful `pulumi up` run using hierarchical config from the project, `pulumi config refresh` will write _ALL_ the used config back to the refreshed stack - `pulumi config set/rm` only applies to the selected stack ## Checklist <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Service, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. --> Co-authored-by: Zaid Ajaj <zaid.naom@gmail.com> |
||
---|---|---|
.. | ||
command.go | ||
doc.go | ||
program.go | ||
program_test.go | ||
pulumi.go | ||
s3reporter.go | ||
util.go |