Terraform-provider-google: Cloud Run support

Created on 11 Apr 2019  ยท  15Comments  ยท  Source: hashicorp/terraform-provider-google


Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

Is there a plan to implement GCP's new "cloud run" functionality?

New or Affected Resource(s)

  • google_cloud_run

Potential Terraform Configuration

# Propose what you think the configuration to take advantage of this feature should look like.
# We may not use it verbatim, but it's helpful in understanding your intent.
resource "google_cloud_run" "example" {
  container    = "us.gcr.io/project/service@sha256:fff"
  service_name = "some-service"
}
enhancement new-resource

Most helpful comment

The cloudrun REST API hasn't been released at v1beta1 yet, however they have updated the v1alpha1 endpoints to accept and respond with the beta object models. I've updated our mappings to use those so it looks and feels "beta-y" even though it's using alpha endpoints under the hood. I don't have an estimate for when the beta endpoints will ship but I've been told the models _shouldn't_ be changing between now and then.
Given the above I'm planning on shipping the Terraform support for this in the next release and I'm calling it a "betpha" so use with good judgement. We will update the resource when the beta apis ship.

All 15 comments

also: i would be happy to attempt implementing this

we are always open to community contributions! as a side note, we generally are trying to develop new resources via our autogeneration repo, https://github.com/GoogleCloudPlatform/magic-modules

@emilymye thank you! started working on PR here: https://github.com/GoogleCloudPlatform/magic-modules/pull/1643

@emilymye I'm currently stuck on the API calls to the Cloud Run REST API. they are all returning 400, even simple GET/list operations. Googling did not yield anything helpful. I even tried setting the default region for my project. Here's the comment: https://github.com/GoogleCloudPlatform/magic-modules/pull/1643#issuecomment-483665744 any thoughts on this, or where i can go for help with this?

@quinn My understanding is that the namespaces.* endpoints listed are a side effect of the object model that CloudRun is built on and they are not actually valid or updatable resources. The projects.locations.* endpoints should have the real resources. I have been told there is work in progress to get those removed from the docs.

That being said the locations.services object is unfortunately much more complex than the namespaces one. Thank you for tackling this, but we've been building tools to generate the api definition from complex upstream discovery docs so I can take this over from here.

@chrisst thanks for the update ! looking forward to this being available

What is the current ETA/current progress on this module? Thoroughly looking forward to integrating with this! @chrisst

I've implemented this locally. Happy to help whoever is working on PR for this.

Quick update on this. I've been talking with the Cloud Run team and have found that while the Cloud Run product is in beta our support of it would required using alpha KNative apis. Part of the proposal for the KNative v1beta1 is an overhaul of the object structure that the API will accept, for more details check out KNative's latest release which explains the beta proposal.

We do not want to release a Terraform resource that will have to change within months of its release or one that relies on alpha apis that are still stabilizing. Additionally we strive to not introduce intentional breaking changes to our beta provider. So we have decided to wait until the API hits v1beta1 before releasing official support for Cloud Run. This should be happening soon, but feel free to track https://github.com/knative/serving for more precision.

The code in the linked PR is currently functional and tested against the alpha APIs so those who are interested are welcome to pull it locally and use it to prototype or build against. Once v1beta1 is available I'll be updating the resource but hopefully it will remain very similar.

@chrisst, is the new 0.7.0 release of KNative/serving the one we've been waiting for? It looks like v1beta1 APIs are present now ๐Ÿ˜„

https://github.com/knative/serving/releases/tag/v0.7.0

@sheepsteak yup that's the one! Once the Cloud Run API's migrate to the v1beta1 Knative APIs then we'll be able to launch Terraform support.

The cloudrun REST API hasn't been released at v1beta1 yet, however they have updated the v1alpha1 endpoints to accept and respond with the beta object models. I've updated our mappings to use those so it looks and feels "beta-y" even though it's using alpha endpoints under the hood. I don't have an estimate for when the beta endpoints will ship but I've been told the models _shouldn't_ be changing between now and then.
Given the above I'm planning on shipping the Terraform support for this in the next release and I'm calling it a "betpha" so use with good judgement. We will update the resource when the beta apis ship.

With the initial release of google_cloud_run_service resource type, there seems to be a few things still missing and I'm wondering if this is a Terraform module limit or API limit. Two I've hit are assigning service account and IAM roles. Am I just missing something here?

Since this is supported (it isn't documented on our sidebar- fixing that with https://github.com/GoogleCloudPlatform/magic-modules/pull/2263), I'm closing this issue out. #4262 can cover the features @mbrancato raised that it appears we're missing.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error ๐Ÿค– ๐Ÿ™‰ , please reach out to my human friends ๐Ÿ‘‰ [email protected]. Thanks!

Was this page helpful?
0 / 5 - 0 ratings