Hi folks! I have a (potentially stupid) question, ...
# general
f
Hi folks! I have a (potentially stupid) question, but how do you keep parts of the provider configuration (or inputs) outside of the Pulumi state? The use case is that both the CI and local developer machines can manage the same set of infrastructure, but the connectivity to the provider from local machines differs from the machines in the CI. If I apply the infrastructure using my local machine then the CI cannot refresh the resources, because it tries to use the provider configuration inside of the state file. I tried to override the configuration in the CI using environment variables and
pulumi config set
but both approach don’t seem to work. Let me know if I’m missing something obvious 😅
f
Is there a particular provider you're working with? The answer is probably environment variables
f
Also it might be worth mentioning that we are instantiating the provider:
Copy code
snowflake_provider = snowflake.Provider(
    "snowflake_provider",
    account=settings.SNOWFLAKE_ACCOUNT,    
    role=settings.SNOWFLAKE_ROLE,
    username=settings.SNOWFLAKE_USER,
    password=settings.SNOWFLAKE_PASSWORD,
    region="",
)

snowflake.Database(
    "database",
    name="RAW",
    opts=pulumi.ResourceOptions(protect=True, provider=snowflake_provider),
)
The solution is to pass the config option you want to define using an environment variable as a Pulumi output:
Copy code
snowflake_provider = snowflake.Provider(
    "snowflake_provider",
    account=pulumi.Output.from_input(None), # this will force the provider to look for this value in the environment   
    role=settings.SNOWFLAKE_ROLE,
    username=settings.SNOWFLAKE_USER,
    password=settings.SNOWFLAKE_PASSWORD,
    region="",
)