Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support "Backup for GKE" #12634

Comments

@eraac
Copy link
Contributor

eraac commented Sep 23, 2022

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

A support of https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke/concepts/backup-for-gke from Terraform

New or Affected Resource(s)

  • google_backup_plan_container_cluster
  • google_backup_container_cluster (one-shot backup)
  • google_restore_plan_container_cluster
  • google_restore_container_cluster

Maintainer note- current statuses

  • google_gke_backup_backup_plan (google_backup_plan_container_cluster above)
  • google_backup_container_cluster (one-shot backup) (wontfix)
  • google_gke_backup_restore_plan (google_restore_plan_container_cluster above)
  • google_restore_container_cluster (wontfix)

References

  • b/266661399
@rileykarson rileykarson self-assigned this Sep 26, 2022
modular-magician added a commit to modular-magician/docs-examples that referenced this issue Dec 5, 2022
modular-magician added a commit to terraform-google-modules/docs-examples that referenced this issue Dec 5, 2022
modular-magician added a commit to modular-magician/terraform-provider-google-beta that referenced this issue Dec 5, 2022
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this issue Dec 5, 2022
modular-magician added a commit that referenced this issue Dec 5, 2022
Fixes #12634

Signed-off-by: Modular Magician <[email protected]>

Signed-off-by: Modular Magician <[email protected]>
modular-magician added a commit to modular-magician/terraform-validator that referenced this issue Dec 5, 2022
modular-magician added a commit to GoogleCloudPlatform/terraform-validator that referenced this issue Dec 5, 2022
@rileykarson rileykarson reopened this Dec 12, 2022
@rileykarson
Copy link
Collaborator

rileykarson commented Dec 12, 2022

I believe that google_gke_backup_backup_plan corresponds to the proposed google_backup_plan_container_cluster resource. It's named differently than proposed due to the naming structure of the gkebackup API. https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke/reference/rest/v1/projects.locations.restorePlans appears reasonable to support, at first glance, and would appear as google_gke_backup_restore_plan. I've reopened the issue to mark that as incomplete.

One-off operations (google_backup_container_cluster, google_restore_container_cluster) are not something we believe should be supported through our provider. Instead, we'd recommend using gcloud to kick them off, whether through direct invocation, local exec in Terraform, or the https://registry.terraform.io/modules/terraform-google-modules/gcloud/google/latest module (which wraps local exec).

@maksym-kursin
Copy link

Is there any work going to implement google_gke_backup_restore_plan?

@rileykarson
Copy link
Collaborator

None at the moment- that's generally indicated by marking an assignee on the issue.

@rileykarson
Copy link
Collaborator

Sorry for the noise! Commits with incorrect "Closes" or "Fixes" notes in forks will close issues in some cases if the fork owner has a commit bit on the mainline repo. I'll reopen this as any come up,

@ego93
Copy link

ego93 commented Jun 6, 2023

Here is a helpful example of how to create a restore plan in Terraform while we wait for the official google_gke_backup_restore_plan resource.

module "restore_plan" {
  source  = "terraform-google-modules/gcloud/google"
  version = "~> 3.0"

  create_cmd_body = "beta container backup-restore restore-plans create basic-restore-plan --project=${google_gke_backup_backup_plan.basic.project} --location=${google_gke_backup_backup_plan.basic.location} --backup-plan=${google_gke_backup_backup_plan.basic.id} --cluster=${google_container_cluster.primary.id} --all-namespaces --quiet"

  destroy_cmd_body = "beta container backup-restore restore-plans delete basic-restore-plan --project=${google_gke_backup_backup_plan.basic.project} --location=${google_gke_backup_backup_plan.basic.location} --quiet"
}

Refs:

Disclaimer this is just an example that worked in my case with different command flags, your use case may vary.

@fishpen0
Copy link

fishpen0 commented Aug 1, 2023

Ideally there would also be data sources for google_gke_backup_backup_plan and google_gke_backup_backup so we can plumb an existing backup plan to a restore plan on a new cluster in a separate terraform state and restore a specific backup

@tiaguinho
Copy link

There is anyone working on google_gke_backup_restore_plan ?

@rileykarson
Copy link
Collaborator

The Google-internal ticket has an owner as of a few weeks ago, assigning modular-magician to mark that. No strict timeline on delivery- the next update will likely happen when a PR that references this issue is opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment