GoogleCloudPlatform / GoogleCloudPlatform/cloud-run-button
Enable precreate to Provision Resources
- Dominant language
- Go
- Stars
- 553
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
Once we get #76 any resource provisioning will have to happen in `postcreate` because there is no way to propagate the config to the create command or env vars. This means the app is created with missing resources which could cause the app deployment to fail (depending on how the app is built). It's tough to generalize the passing of config from `precreate` scripts to our `cloudshell_open` because sometimes an env var is needed, sometimes multiple, and sometimes additional params for `gcloud run deploy`. So while it'd be really nice to do provisioning in `precreate` I don't really see a good way to make it work. The only way I can come up with so far is to have `precreate` optionally write a `/tmp/create-$K_SERVICE` file that could contain something like:
```
{
"envs": {
"CLOUD_SQL_CONNECTION_NAME": "foo-project:us-central1:my-foo-db"
},
"params": [
"--set-cloudsql-instances=my-foo-db"
]
}
```
Then if that file exists our `cloudshell_open` would merge that config with it's own for service creation. But I don't love this approach.
This would be an alternative to #74
Contributor guide
Assessment
This issue has not been assessed yet.