You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix convertExamplesInObjectSpec to avoid in-place modification (#3108)
Due to an unfortunate interaction, pulumi/pulumi-aws on commit
7c14e422b23f9fbb34e37e381adb9d9ee4da49b4 started generating
`{convertExamples:123}` markers into the schema. These markers are an
artifact of convert_cli.go implementation and should not leak.
The root cause is subtle, with type reuse introduced in pulumi-aws,
convertExamplesInObjectSpec gets to repeatedly traverse the same
in-memory location, which causes cliConverter.StartConvertingExamples()
to call itself:
docs = StartConvertingExamples(StartConvertingExamples(docs, p), p)
Which breaks the assumptions, as it now assumes `{convertExamples:%d}`
is an HCL snippet.
The simple fix here is to avoid self-modifying the schema during
convertExamplesInObjectSpec. This is the expected behavior with the
signature:
```
func (g *Generator) convertExamplesInObjectSpec(path examplePath, spec pschema.ObjectTypeSpec) pschema.ObjectTypeSpec {
```
If later this changes to in-place traversal for efficiency, the
signature should also change to not return ObjectTypeSpec.
0 commit comments