Search code examples
google-cloud-platformbackupinfrastructure-as-code

How to backup whole GCP projects (including service- and infrastructure config like subnets, firewallrules, etc)


We are evaluating options to backup whole google cloud projects. Everything that could possibly get lost somehow should be saved. What would be a good way to backup and recover networks, subnets, routing, etc?

Just to be clear: Our scope is not only data and files like compute engine disks or storage buckets but also the whole "how everything is put together" - all code and config describing the infrastructure and services of a gcp project (as far as possible). Of course we could simply save all code that created resources (e.g. via deployment manager or gcloud sdk) but we also want to be able to cover stuff someone provisioned by hand / via gui as good as possible.

Recursively pulling data with gcloud sdk (e.g. gcloud compute networks ... list/describe for network config) could be an option, but maybe someone has already found a better solution?

Output should be detailed enough to be able to restore a specific resource (better: all containing resources) in a gcp project (e.g. via deployment manager).

All constructive ideas are appreciated!


Solution

  • You can use this product for reverse engineering the infrastructure and to generate a tfstate file to use with Terraform

    https://github.com/GoogleCloudPlatform/terraformer

    For the rest, no magic things, you have to code.