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

important-appointment-55126

05/26/2020, 6:50 PM
but it seems the same thing in Go would require me to build the policy string
w

white-balloon-205

05/27/2020, 3:33 PM
Currently, you need to build the string. Supporting a strongly typed way to build these JSON objects in Go, .net and Python is tracked in https://github.com/pulumi/pulumi-terraform-bridge/issues/132 which is partly complete - and hopefully will be completed soon!
i

important-appointment-55126

05/27/2020, 4:10 PM
great thanks - For now i wrote a little helper for Go’s template library that makes it easy to use outputs with templates
my current hack, if you’re curious:
Copy code
Policy: pulutil.Template(map[string]interface{}{
                                "BucketARN": bucket.Arn,
                                "KeyARN":    key.Arn,
                        }, `{
                                        "Version": "2012-10-17",
                                        "Statement": [
                                                {
                                                        "Effect": "Allow",
                                                        "Action": [
                                                                "s3:ListBucket"
                                                        ],
                                                        "Resource": [
                                                                "{{ .BucketARN }}"
                                                        ]
                                                },{
                                                        "Sid": "S3PutAndGetAccess",
                                                        "Effect": "Allow",
                                                        "Action": [
                                                                "s3:PutObject",
                                                                "s3:GetObject"
                                                        ],
                                                        "Resource": [
                                                                "{{ .BucketARN }}/*"
                                                        ]
                                                }, {
                                                        "Sid": "KMSDecryptAndEncryptAccess",
                                                        "Effect": "Allow",
                                                        "Action": [
                                                                "kms:Decrypt",
                                                                "kms:Encrypt"
                                                        ],
                                                        "Resource": "{{ .KeyARN }}"
                                                }
                                        ]
                                }`),
👍 1
5 Views