https://pulumi.com logo
#python
Title
# python
d

damp-elephant-82829

06/28/2020, 1:33 PM
@flat-australia-79845 did you find an answer? I am stucked trying to read the gcp.config.region in python, I am trying to import pulumi_gcp.config but it does not exists
g

gentle-diamond-70147

06/28/2020, 9:30 PM
d

damp-elephant-82829

06/30/2020, 6:16 AM
Not sure I understood. I can ‘t read the GCP region configuration param in python
f

flat-australia-79845

06/30/2020, 9:40 AM
@damp-elephant-82829 I had to do
from pulumi_gcp import config
as well as
import pulumi_gcp as gcp
then, if you have your stack set, you should be able to read it with
gcp.config.region
.
this is my import lines
Copy code
import pulumi
import pulumi_gcp as gcp
from pulumi_gcp import config, storage, cloudfunctions, cloudscheduler  # noqa
d

damp-elephant-82829

06/30/2020, 11:14 AM
How do you access config then? gcp.config.region ?
f

flat-australia-79845

06/30/2020, 12:13 PM
yes
does it work for you? if not, how does your config file looks like?
is your stack selected?
d

damp-elephant-82829

06/30/2020, 3:56 PM
it tells me that pulumi_gcp does not contain the module config
even if I have done a pulumi config set gcp:region ‘eu-west3’
f

flat-australia-79845

07/01/2020, 8:27 AM
are you doing
from pulumi_gcp import config
?
d

damp-elephant-82829

07/01/2020, 12:46 PM
I am doing import pulumi_gcp; pulumi_gcp.config
f

flat-australia-79845

07/01/2020, 12:59 PM
I know this does not make sense, but you have also to import config with:
from pulumi_gcp import config