https://pulumi.com logo
#golang
Title
# golang
a

ambitious-salesmen-39356

12/22/2020, 4:16 PM
Is there a better way to handle JSON policy documents (thinking AWS IAM, bucket policies here) than just a huge mangled string?
g

gentle-diamond-70147

12/22/2020, 5:01 PM
b

billowy-army-68599

12/22/2020, 6:34 PM
I generally tend to define the structs explicitly rather than
map[string]interface{}
https://github.com/jaxxstorm/iac-in-go/blob/master/eks/kubeConfig.go @ambitious-salesmen-39356
👍 1
a

ambitious-salesmen-39356

12/22/2020, 6:49 PM
I'll take a look at both of these - thank you.
b

billowy-army-68599

12/22/2020, 6:54 PM
@gentle-diamond-70147 we should add some overlays for this stuff I think
👍 1
g

gentle-diamond-70147

12/22/2020, 6:56 PM
@billowy-army-68599 agreed!
a

ambitious-salesmen-39356

12/22/2020, 7:03 PM
what would overlay mean in this context?
b

billowy-army-68599

12/22/2020, 7:07 PM
An overlay is like a helper method built into the SDK that abstracts some of this pain away
b

billions-oxygen-70106

12/23/2020, 12:21 AM
Handy tool for generating the structs: https://mholt.github.io/json-to-go/
i

important-appointment-55126

12/24/2020, 5:34 PM
as a third approach, i’ve been using Go templates: https://pkg.go.dev/github.com/gwatts/pulutil/template/#example-NewJSON
combining the explicit struct or map approach with a library to handle the json + apply might be a nice half-way measure perhaps
3 Views