square-tiger-5809
01/05/2023, 8:54 PMPulumi.example.yaml
in program kubernetes
config:
gcp:project: "new"
kubernetes:pod_range: "test"
In Pulumi.yaml I define required by using:
config:
pod_range:
type: String
pulumi up says
error: could not get cloud url: could not load current project: could not validate '/Users/me/workspace/pulumi/kubernetes/Pulumi.yaml': 8 errors occurred:
* #/config/pod_range: oneOf failed
* #/config/pod_range: expected string, but got object
* #/config/pod_range: expected integer, but got object
* #/config/pod_range: expected boolean, but got object
* #/config/pod_range: expected array, but got object
* #/config/pod_range: doesn't validate with '/$defs/configTypeDeclaration'
* #/config/pod_range/type: doesn't validate with '/$defs/simpleConfigType'
* #/config/pod_range/type: value must be one of "string", "integer", "boolean", "array"
Removing the config
key from Pulumi.yaml will make a preview run.
Any ideas?red-match-15116
01/05/2023, 8:58 PMconfig.require()
in the code rather than by defining the schema for it in the pulumi.yaml: https://www.pulumi.com/docs/intro/concepts/config/#:~:text=let%20name%20%3D%20config.require(%22name%22)%3Bsquare-tiger-5809
01/05/2023, 9:31 PMconfiguration:
name:
type: String
lucky:
default: 42
outputs:
stdout: Hello, ${name} -- I see your lucky number is ${lucky}!
red-match-15116
01/05/2023, 10:09 PMsquare-tiger-5809
01/05/2023, 10:12 PMred-match-15116
01/05/2023, 10:14 PMAh okay, the string validation does seem to work for outputs. Just not within resources.I'm not sure I understand - is this still in relation to configuration?
square-tiger-5809
01/05/2023, 10:18 PMname: kubernetes
runtime: yaml
description: A minimal Google Cloud Pulumi YAML program
variables:
project: ${pulumi.project}
configuration:
cluster_name:
type: String
resources:
gke-cluster:
type: gcp:container:Cluster
properties:
location: europe-west2
name: ${cluster_name}
Produces this preview:
* #/config/cluster_name: oneOf failed
* #/config/cluster_name: expected string, but got object
* #/config/cluster_name: expected integer, but got object
* #/config/cluster_name: expected boolean, but got object
* #/config/cluster_name: expected array, but got object
* #/config/cluster_name: doesn't validate with '/$defs/configTypeDeclaration'
* #/config/cluster_name/type: doesn't validate with '/$defs/simpleConfigType'
* #/config/cluster_name/type: value must be one of "string", "integer", "boolean", "array"
with this config
config:
gcp:project: "new"
kubernetes:cluster_name: "test"
But this might go back to your answer that YAML won't support this.error: missing required configuration variable 'cluster_name'; run `pulumi config` to set
red-match-15116
01/05/2023, 10:21 PM* #/config/cluster_name/type: value must be one of "string", "integer", "boolean", "array"This last line implies that the declaration should be lower-case:
configuration:
cluster_name:
type: string
But yeah, the docs have it as capitalized. Indeed confusing.