pulumi/pkg/testing/integration
bors[bot] 3bcbe35c0a
Merge #10832
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>
2022-10-18 16:42:18 +00:00
..
command.go Don't disable ambiant providers during tests (#9404) 2022-04-15 11:14:47 +02:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
program.go feat(programtest): Enable ProgramTest for Azure-Native split modules 2022-10-16 21:43:43 -07:00
program_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
pulumi.go Fix tests that have incomplete project config. Correct docs for CreatePulumiRepo 2022-10-04 21:29:42 +02:00
s3reporter.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
util.go refactor: use `os.ReadDir` for lightweight directory reading 2022-09-24 15:20:43 +08:00