markwalker,
@markwalker@fosstodon.org avatar

Anyone familiar with terraform, GKE and enabling GCP services from TF?

Setting up a new project and trying to plan a GKE cluster. But I get this response saying the Kubernetes API hasn't be used or is disabled - well yes, it's a new project. But it's listed in the services for the project and should then get enabled like all the others, right 🤔

Google just asked if we could enable via the UI. But that's not the point. This is meant to be automated with TF.

markwalker,
@markwalker@fosstodon.org avatar

And we've fixed it with a depends_on for the container service on the cluster definition.

ryancheley,
@ryancheley@mastodon.social avatar

@markwalker I think this might be what you’re looking for

https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_project_service

The work I’ve done with GCP though (with people internal to Google) was also to enable the API from the front end so not sure if this will get you what you need or not 🤷🏼‍♂️

markwalker,
@markwalker@fosstodon.org avatar

@ryancheley We've resolved it by ensuring the cluster definition depends on the container service. That way it's enabled first.

claus,

@markwalker do you have a depends_on on your GKE resource so the API is enabled before terraform tries to create the cluster?

markwalker,
@markwalker@fosstodon.org avatar

@claus Ooooo. Probably not. I can see we have a private VPC connection that depends on the networking service.

Thank you - this sounds promising.

markwalker,
@markwalker@fosstodon.org avatar

@claus This has indeed fixed it! Thanks 👍

  • All
  • Subscribed
  • Moderated
  • Favorites
  • terraform
  • DreamBathrooms
  • ngwrru68w68
  • tester
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • InstantRegret
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • mdbf
  • tacticalgear
  • megavids
  • osvaldo12
  • normalnudes
  • cubers
  • cisconetworking
  • everett
  • GTA5RPClips
  • ethstaker
  • Leos
  • provamag3
  • anitta
  • modclub
  • JUstTest
  • lostlight
  • All magazines