Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support full fidelity YAML round-tripping #6489

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- [automation/dotnet] Expose structured logging
[#6572](https://github.com/pulumi/pulumi/pull/6572)

- [cli] Support full fidelity YAML round-tripping
- [cli] Support full fidelity YAML round-tripping - [#6489](https://github.com/pulumi/pulumi/pull/6489)
- Strip Byte-order Mark (BOM) from YAML configs during load. - [#6636](https://github.com/pulumi/pulumi/pull/6636)
- Swap out YAML parser library - [#6642](https://github.com/pulumi/pulumi/pull/6642)

Expand Down
34 changes: 34 additions & 0 deletions pkg/cmd/pulumi/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ func newConfigRmCmd(stack *string) *cobra.Command {
return err
}

err = ps.FileAST.RemoveConfig("config", key, path)
if err != nil {
return err
}

return saveProjectStack(s, ps)
}),
}
Expand Down Expand Up @@ -366,6 +371,11 @@ func newConfigRmAllCmd(stack *string) *cobra.Command {
if err != nil {
return err
}

err = ps.FileAST.RemoveConfig("config", key, path)
if err != nil {
return err
}
}

return saveProjectStack(s, ps)
Expand Down Expand Up @@ -542,6 +552,14 @@ func newConfigSetCmd(stack *string) *cobra.Command {
return err
}

// For a new config, the file is not yet populated, so just use the default struct marshalling.
if ps.FileAST.HasKey("config") {
err = ps.FileAST.SetConfig("config", key, v, path)
if err != nil {
return err
}
}

return saveProjectStack(s, ps)
}),
}
Expand Down Expand Up @@ -606,6 +624,14 @@ func newConfigSetAllCmd(stack *string) *cobra.Command {
if err != nil {
return err
}

// For a new config, the file is not yet populated, so just use the default struct marshalling.
if ps.FileAST.HasKey("config") {
err = ps.FileAST.SetConfig("config", key, v, path)
if err != nil {
return err
}
}
}

for _, sArg := range secretArgs {
Expand All @@ -627,6 +653,14 @@ func newConfigSetAllCmd(stack *string) *cobra.Command {
if err != nil {
return err
}

// For a new config, the file is not yet populated, so just use the default struct marshalling.
if ps.FileAST.HasKey("config") {
err = ps.FileAST.SetConfig("config", key, v, path)
if err != nil {
return err
}
}
}

return saveProjectStack(s, ps)
Expand Down
14 changes: 2 additions & 12 deletions pkg/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y
github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
Expand Down Expand Up @@ -261,7 +259,6 @@ github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8c
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
Expand Down Expand Up @@ -495,16 +492,12 @@ github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDe
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-ieproxy v0.0.1 h1:qiyop7gCflfhwCzGyeT0gro3sF9AIg9HU98JORTkqfI=
github.com/mattn/go-ieproxy v0.0.1/go.mod h1:pYabZ6IHcRpFh7vIaLfK7rdcWgFEb3SFJ6/gNWuh88E=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.8 h1:3tS41NlGYSmhhe/8fhGRzc+z3AYCw1Fe1WAyLuujKs0=
Expand Down Expand Up @@ -589,10 +582,8 @@ github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 h1:sofwID9zm4tzr
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/pulumi/go-yaml v1.8.10-0.20210311214047-95da20da6e94 h1:Htsu46DUlRauQVuY0qXQWwGMkuGvc9PReS60kNYPuzE=
github.com/pulumi/go-yaml v1.8.10-0.20210311214047-95da20da6e94/go.mod h1:gY5v736YyqzhcB0WcDSX4ePCUM90DU88xiH4gQ/ZcXo=
github.com/pulumi/pulumi/sdk/v2 v2.23.0 h1:uyTvI6axYV3feeMbcWLnNtHZQsbkx98OoY5Jpq7acSM=
github.com/pulumi/pulumi/sdk/v2 v2.23.0/go.mod h1:sHQdzD0/cIopR5uLeoikXi1pNBv5SwA4M617VqdIA3E=
github.com/pulumi/go-yaml v1.8.10-0.20210324191824-ab3fac7774fd h1:+HKDP2rMBF696ioSiYwnvzkSJ384oPjAKriIqJjmZ6Y=
github.com/pulumi/go-yaml v1.8.10-0.20210324191824-ab3fac7774fd/go.mod h1:gY5v736YyqzhcB0WcDSX4ePCUM90DU88xiH4gQ/ZcXo=
github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8=
github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng=
Expand Down Expand Up @@ -723,7 +714,6 @@ golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200317142112-1b76d66859c6/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand Down
2 changes: 1 addition & 1 deletion sdk/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/opentracing/basictracer-go v1.0.0 // indirect
github.com/opentracing/opentracing-go v1.1.0
github.com/pkg/errors v0.9.1
github.com/pulumi/go-yaml v1.8.10-0.20210311214047-95da20da6e94
github.com/pulumi/go-yaml v1.8.10-0.20210324191824-ab3fac7774fd
github.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94
github.com/sergi/go-diff v1.1.0 // indirect
github.com/spf13/cast v1.3.1
Expand Down
4 changes: 2 additions & 2 deletions sdk/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 h1:sofwID9zm4tzr
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/pulumi/go-yaml v1.8.10-0.20210311214047-95da20da6e94 h1:Htsu46DUlRauQVuY0qXQWwGMkuGvc9PReS60kNYPuzE=
github.com/pulumi/go-yaml v1.8.10-0.20210311214047-95da20da6e94/go.mod h1:gY5v736YyqzhcB0WcDSX4ePCUM90DU88xiH4gQ/ZcXo=
github.com/pulumi/go-yaml v1.8.10-0.20210324191824-ab3fac7774fd h1:+HKDP2rMBF696ioSiYwnvzkSJ384oPjAKriIqJjmZ6Y=
github.com/pulumi/go-yaml v1.8.10-0.20210324191824-ab3fac7774fd/go.mod h1:gY5v736YyqzhcB0WcDSX4ePCUM90DU88xiH4gQ/ZcXo=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
Expand Down