sparse-intern-71089
09/01/2023, 3:19 PMsalmon-account-74572
09/01/2023, 3:36 PMaws:region
in some of my Pulumi programs), you can use config.Require
or config.Try
(the latter would allow you to set a default value in the event the configuration value is missing):
awsRegion := config.Require(ctx, "aws:region")
brash-waitress-49970
09/01/2023, 3:39 PMsalmon-account-74572
09/01/2023, 3:56 PMbrash-waitress-49970
09/01/2023, 4:00 PMsalmon-account-74572
09/01/2023, 4:00 PMbrash-waitress-49970
09/02/2023, 8:54 AMconfig:
primary_region:
name: us-east-1
...
secondary_region:
name: us-west-1
....
So now I loop over this and will have all necessary information available within my config.
I got another (go specific) question now though:
For this new config setup, I will use a struct to read values into. For that, the struct parameters HAVE to start with an uppercase letter (I.e. exporting them) so pulumi config can 'see' them. This struct is in the same package as my pulumi code, so why does it need to be exported to be visible for pulumi?salmon-account-74572
09/05/2023, 2:40 PMsalmon-account-74572
09/05/2023, 4:44 PMimport
the Pulumi SDKs at the top of your code, this means they’re not in the same package as your code. Hence, any structs you define in your code need to have exported parameters in order for Pulumi to “see” them.brash-waitress-49970
09/05/2023, 5:18 PMsalmon-account-74572
09/05/2023, 5:23 PM