late-australia-13136
04/10/2024, 2:59 PMdoppler run pulumi up
and using ${MY_VAR}
or similar in the Pulumi config?miniature-musician-31262
04/10/2024, 7:49 PM<http://process.env.MY|process.env.MY>_VAR
.miniature-musician-31262
04/10/2024, 7:50 PMminiature-musician-31262
04/10/2024, 7:51 PMlate-australia-13136
04/10/2024, 10:53 PMlate-australia-13136
04/10/2024, 11:03 PMdev
and prd
. Each of those environments has a corresponding Doppler stage (effectively the equivalent of .<http://env.dev|env.dev>
and .env.prd
.
With that in mind, I want a way to deploy those environments without having to maintain consistency between Doppler and Pulumi config/env.
I think the solution as far as I can tell would be to use a custom provider instance to the effect of;
provider, err := scaleway.NewProvider(ctx, "pulumi-scaleway-provider", &scaleway.ProviderArgs{
AccessKey: pulumi.String(os.Getenv("SCW_ACCESS_KEY")),
SecretKey: pulumi.String(os.Getenv("SCW_SECRET_KEY")),
ProjectId: pulumi.String(os.Getenv("SCW_DEFAULT_PROJECT_ID")),
})
if err != nil {
return err
}
bucket, err := scaleway.NewObjectBucket(ctx, "my-bucket", nil , pulumi.Provider(provider))
Is that the idiomatic approach or am I bending something to fit my need rather than actually using it correctly? 😅miniature-musician-31262
04/10/2024, 11:15 PMPulumi.dev.yaml
and Pulumi.prd.yaml
, and you'd switch between then as you switch between your Doppler "stages" using pulumi stack select
.miniature-musician-31262
04/10/2024, 11:17 PMNewProvider
declaration and just start with the bucket
, and the Scaleway provider should automatically detect those environment variables without your having to do anything.late-australia-13136
04/10/2024, 11:18 PMlate-australia-13136
04/10/2024, 11:19 PMlate-australia-13136
04/10/2024, 11:19 PMlate-australia-13136
04/10/2024, 11:22 PMscw info
. If I run that outside of the Doppler stage context, I get this (some values omitted)
Settings:
KEY VALUE ORIGIN
config_path /scw/config.yaml default
profile connor-macbook active_profile in config file
default_region - default
default_zone fr-par-1 default
default_organization_id - unknown
default_project_id - unknown
access_key <omit> profile (connor-macbook)
secret_key <omit> profile (connor-macbook)
late-australia-13136
04/10/2024, 11:23 PMlate-australia-13136
04/10/2024, 11:24 PMSettings:
KEY VALUE ORIGIN
config_path /scw/config.yaml default
profile connor-macbook active_profile in config file
default_region nl-ams env (SCW_DEFAULT_REGION)
default_zone nl-ams-1 env (SCW_DEFAULT_ZONE)
default_organization_id <omit> env (SCW_DEFAULT_ORGANIZATION_ID)
default_project_id <omit> env (SCW_DEFAULT_PROJECT_ID)
access_key <omit> env (SCW_ACCESS_KEY)
secret_key <omit> env (SCW_SECRET_KEY)
late-australia-13136
04/10/2024, 11:25 PMlate-australia-13136
04/10/2024, 11:25 PMlate-australia-13136
04/10/2024, 11:26 PMlate-australia-13136
04/10/2024, 11:27 PMminiature-musician-31262
04/10/2024, 11:28 PMos.Getenv
, that still doesn't apply to the project ID setting.late-australia-13136
04/10/2024, 11:29 PMos.Getenv
returns the correct project_id for a Scaleway Project that’s not the defaultlate-australia-13136
04/10/2024, 11:29 PMminiature-musician-31262
04/10/2024, 11:29 PMlate-australia-13136
04/10/2024, 11:31 PMprovider
is the value returned from scaleway.NewProvider
bucket, err := scaleway.NewObjectBucket(ctx, "my-bucket", nil, pulumi.Provider(provider))
miniature-musician-31262
04/10/2024, 11:32 PMbucket, err := scaleway.NewObjectBucket(ctx, "my-bucket", nil, provider)
, since you've already declared it, but I can checkminiature-musician-31262
04/10/2024, 11:33 PMpulumi.Provider(provider)
late-australia-13136
04/10/2024, 11:34 PMlate-australia-13136
04/10/2024, 11:34 PMminiature-musician-31262
04/10/2024, 11:35 PMlate-australia-13136
04/10/2024, 11:35 PMSCW_DEFAULT_REGION
and SCW_DEFAULT_ZONE
.late-australia-13136
04/10/2024, 11:35 PMlate-australia-13136
04/10/2024, 11:36 PMminiature-musician-31262
04/10/2024, 11:37 PMlate-australia-13136
04/10/2024, 11:47 PMlate-australia-13136
04/10/2024, 11:47 PMlate-australia-13136
04/10/2024, 11:47 PMlate-australia-13136
04/10/2024, 11:47 PMlate-australia-13136
04/10/2024, 11:49 PMlate-australia-13136
04/10/2024, 11:49 PMlate-australia-13136
04/10/2024, 11:50 PMminiature-musician-31262
04/10/2024, 11:52 PMlate-australia-13136
04/11/2024, 11:08 AMrequire (
<http://github.com/lbrlabs/pulumi-scaleway/sdk|github.com/lbrlabs/pulumi-scaleway/sdk> v1.11.0
<http://github.com/pulumi/pulumi/sdk/v3|github.com/pulumi/pulumi/sdk/v3> v3.112.0
)
late-australia-13136
04/11/2024, 12:09 PMlate-australia-13136
04/11/2024, 12:09 PM