We recently encountered an error when creating a backup plan for GKE.
The error we’re specifically getting is:
Error creating BackupPlan: googleapi: Error 400: backup_plan_id field is required and must be 1-63 characters long and match a-z?
: invalid argument
In the debug we see that the request body does not include a directive for backup_plan_id but google is reporting it missing.
That said, Method: projects.locations.backupPlans.create | Backup for GKE | Google Cloud the api reference that says the definition of the body must include a BackupPlan configuration https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke/reference/rest/v1/projects.locations.backupPlans#BackupPlan that has no mention of a required backup_name_id parameter to be set.
I’d be happy to provide further information, but I do not see how this is directly a terraform problem as the definition of the API as provided by google does not specify the requirement
I have discovered this in the google cloud node folder of the googleapis repository in github:
Does list the
backup_name_id to be REQUIRED for completion of the request
As of August 4th, the construct for the API create backup plan method, does in fact note and require a
backup_plan_id to be set and sent with the request payload to the API.
Also, it is noted that the json example snippets also include a
backup_plan_id in the example payloads:
The error we’re receiving when creating a GKE backup plan is saying that the payload to the API did not include a definition for
backup_plan_name which makes complete sense, as the https://github.com/hashicorp/terraform-provider-google/blob/3756dc0ac753ab6b312094ab0f96f89307f492f8/google/services/gkebackup/resource_gke_backup_backup_plan.go#L317 does not construct one currently.
Looking at the full repository I cannot even see a reference to
backup_plan_id currently in the terraform google provider: https://github.com/search?q=repo%3Ahashicorp%2Fterraform-provider-google+backup_plan_id&type=code
I will be creating an issue in github to address this further.
Github Issue Created for further investigation and resolution.