astonishing-lifeguard-39886
01/11/2021, 3:19 PMservice, _ := cloudrun.NewService(s.ctx, "my-srv",
&cloudrun.ServiceArgs{
// Location from config
Location: pulumi.String(s.region),
// ProjectId from pulumi
Project: pulumi.StringPtr(gcpConf.GetProject(s.ctx)),
Template: &cloudrun.ServiceTemplateArgs{
Spec: &cloudrun.ServiceTemplateSpecArgs{
// e-mail of service account to run container in
ServiceAccountName: s.serviceAccount.Email,
Containers: &cloudrun.ServiceTemplateSpecContainerArray{
&cloudrun.ServiceTemplateSpecContainerArgs{
Image: "<my-image>",
},
},
},
}})
3)
pubsub.NewSubscription(s.ctx, "my-subscription", &pubsub.SubscriptionArgs{
Project: pulumi.StringPtr(gcpConf.GetProject(s.ctx)),
Topic: "<my-topic>",
Name: pulumi.String("my-subscription"),
PushConfig: &pubsub.SubscriptionPushConfigArgs {
PushEndpoint: // what does here?
}
})
PushConfig: &pubsub.SubscriptionPushConfigArgs {
PushEndpoint: // what does here?
}
Thx in advancecreamy-engine-1851
01/11/2021, 3:33 PMhttps://<serviceName>-<projectHash>-<region>.<http://run.app|run.app>
projectHash is generated by the Platform, and you need to deploy a cloud run app to figure out what it is.
region is a little bit odd, us-central1 is uc.a and europe-west1 is ew.a for instanceastonishing-lifeguard-39886
01/11/2021, 3:51 PMservice.Statuses
is an array of ServiceStatusInput.
ServiceStatusInput contains an URL property - which is an StringPtrOutput
But
PushConfig: &pubsub.SubscriptionPushConfigArgs {
PushEndpoint: service.Statuses.Index(<http://pulumi.Int|pulumi.Int>(0)).Url(),
},
will not compile as PushEndpoint
accepted StringInputs onlycreamy-engine-1851
01/11/2021, 4:02 PMPushConfig: &pubsub.SubscriptionPushConfigArgs {
PushEndpoint: service.Statuses.Index(<http://pulumi.Int|pulumi.Int>(0)).Url().ApplyString(func(v interface{}) (result string, err error) {
result, ok := v.(string)
if !ok {
return result, errors.New("could not convert to string")
}
return result, nil
}),
},
astonishing-lifeguard-39886
01/11/2021, 4:59 PMservice.Statuses.Index(<http://pulumi.Int|pulumi.Int>(0)).Url().ApplyString(func(v interface{}) (result string, err error) {
rawUrl, ok := v.(*string)
if !ok {
return *rawUrl, errors.New("could not convert to string")
}
return *rawUrl, nil
})