https://pulumi.com logo
#general
Title
# general
b

bumpy-byte-21437

06/04/2022, 10:23 AM
hi, question anyone knows how to get stack information in go using pulumi
b

billowy-army-68599

06/04/2022, 10:25 AM
What stack information? The current stack name?
b

bumpy-byte-21437

06/04/2022, 10:31 AM
yeah in the yaml config
how to reference it correctly from the code
b

billowy-army-68599

06/04/2022, 12:46 PM
ctx.GetStack
b

bumpy-byte-21437

06/04/2022, 1:13 PM
for example i use this
Copy code
import (
  "<http://github.com/pulumi/pulumi-azure-native/sdk/go/azure/resources|github.com/pulumi/pulumi-azure-native/sdk/go/azure/resources>"
  "<http://github.com/pulumi/pulumi-azure-native/sdk/go/azure/storage|github.com/pulumi/pulumi-azure-native/sdk/go/azure/storage>"
  "<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
  "<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi/config|github.com/pulumi/pulumi/sdk/v3/go/pulumi/config>"
)
my config looks like this
Copy code
config:
  azure-native:location: westeurope
  pulumi-azure-go:storage:
    EnableHttpsTrafficOnly: true
    kind: StorageV2
    sku: GRS
referencing the sku like this
Copy code
Name: pulumi.String(config.Get("sku")),
Copy code
config := config.New(ctx, "")
also referncing it like this doesn’t work properly
Copy code
Name: config.Get("sku"),
it gives me this error
Copy code
cannot use config.Get("sku") (value of type string) as pulumi.StringInput value in struct literal: string does not implement pulumi.StringInput (missing method ElementType)
b

billowy-army-68599

06/04/2022, 3:16 PM
@bumpy-byte-21437 this is structured config data, you need to retrieve it like this: https://www.pulumi.com/docs/intro/concepts/config/#structured-configuration
b

bumpy-byte-21437

06/04/2022, 3:54 PM
Aah thanks allot, will try that
2 Views