echoing-noon-85874
10/02/2024, 3:08 PMcmd := exec.Command("gcloud", "auth", "activate-service-account", "--key-file", fullPath)
err = os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", fullPath)
but it seems like this is not a really good solution. is there anyway i can achieve this using pulumi ? or any other way ?4future-hairdresser-70637
10/02/2024, 4:57 PMcredentials
property which should be "Contents of a file (or path to a file) that contains your service account private key in JSON format."echoing-noon-85874
10/02/2024, 6:18 PMechoing-noon-85874
10/04/2024, 11:46 AM@ Updating....
pulumi:pulumi:Stack pulumi-compute-project-test-dev running warning: failed to get regions list: failed to create compute service: google: could not find default credentials. See <https://cloud.google.com/docs/authentication/external/set-up-adc> for more information
it'll output this error. I don't want to use the gcloud auth commands to authenticate googlefuture-hairdresser-70637
10/04/2024, 12:32 PMechoing-noon-85874
10/04/2024, 3:11 PMfunc CreateCompute(ctx *pulumi.Context, cmnLogs []zapcore.Field, proivder *gcp.Provider, config config.Config) (err error) {
log.Logger.Debug(log.TraceMsgFuncStart(CreateComputeMethod), log.TraceMethodInputs(cmnLogs, config)...)
defer log.Logger.Debug(log.TraceMsgFuncEnd(CreateComputeMethod), log.TraceError(cmnLogs, err)...)
// Declare variables
var instance *compute.Instance
instance, err = compute.NewInstance(ctx, config.ComputeInstanceName, &compute.InstanceArgs{
MachineType: pulumi.String(config.MachineType),
Zone: pulumi.String(config.Zone),
BootDisk: &compute.InstanceBootDiskArgs{
InitializeParams: &compute.InstanceBootDiskInitializeParamsArgs{
Image: pulumi.String(config.Image),
},
},
NetworkInterfaces: compute.InstanceNetworkInterfaceArray{
&compute.InstanceNetworkInterfaceArgs{
Network: pulumi.String(config.Network),
},
},
}, pulumi.Provider(proivder))
if err != nil {
log.Logger.Error(log.TraceMsgErrorOccurredFrom(NewInstanceMethod), log.TraceError(cmnLogs, err)...)
return err
}
// Export the instance details
exportComputeInstanceDetails(ctx, instance)
return nil
}
future-hairdresser-70637
10/04/2024, 5:37 PMPulumi.yaml
(at least temporarily, so you know you're getting the explicit provider)
• your proivder
- did you provide a path to a file that contains the service account private key in JSON format via `Credentials`; you'll need to provide Project
as wellechoing-noon-85874
10/06/2024, 12:17 PMechoing-noon-85874
10/06/2024, 12:18 PMechoing-noon-85874
10/06/2024, 12:19 PMfuture-hairdresser-70637
10/06/2024, 9:30 PMCredentials
to a file path to the JSON file? I'm not 100% sure having that be the content of the JSON keyfile from GCP is acceptedNo matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by