Skip to content

Commit

Permalink
alloydb backup (#6866) (#13202)
Browse files Browse the repository at this point in the history
Closes #11754

Signed-off-by: Modular Magician <magic-modules@google.com>

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician committed Dec 8, 2022
1 parent 92ebbbc commit 5bc5b3b
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/6866.txt
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_alloydb_backup`
```
2 changes: 1 addition & 1 deletion .goreleaser.yml
Expand Up @@ -29,7 +29,7 @@ builds:
- goarch: arm64
goos: windows
ldflags:
- -s -w -X github.com/hashicorp/terraform-provider-google/version.ProviderVersion={{.Version}}
- -s -w -X version.ProviderVersion={{.Version}}
mod_timestamp: '{{ .CommitTimestamp }}'
checksum:
extra_files:
Expand Down
1 change: 1 addition & 0 deletions google/resource_alloydb_backup_test.go
@@ -0,0 +1 @@
package google
177 changes: 177 additions & 0 deletions website/docs/r/alloydb_backup.html.markdown
@@ -0,0 +1,177 @@
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "AlloyDB"
page_title: "Google: google_alloydb_backup"
description: |-
An AlloyDB Backup.
---

# google\_alloydb\_backup

An AlloyDB Backup.

~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.

To get more information about Backup, see:

* [API documentation](https://cloud.google.com/alloydb/docs/reference/rest/v1beta/projects.locations.backups/create)
* How-to Guides
* [AlloyDB](https://cloud.google.com/alloydb/docs/)

<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=alloydb_backup_full&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Alloydb Backup Full


```hcl
resource "google_alloydb_backup" "default" {
provider = google-beta
location = "us-central1"
backup_id = "alloydb-backup"
cluster_name = google_alloydb_cluster.default.name
description = "example description"
labels = {
"label" = "key"
}
depends_on = [google_alloydb_instance.default]
}
resource "google_alloydb_cluster" "default" {
provider = google-beta
cluster_id = "alloydb-cluster"
location = "us-central1"
network = data.google_compute_network.default.id
}
resource "google_alloydb_instance" "default" {
provider = google-beta
cluster = google_alloydb_cluster.default.name
instance_id = "alloydb-instance"
instance_type = "PRIMARY"
depends_on = [google_service_networking_connection.vpc_connection]
}
resource "google_compute_global_address" "private_ip_alloc" {
provider = google-beta
name = "alloydb-cluster"
address_type = "INTERNAL"
purpose = "VPC_PEERING"
prefix_length = 16
network = data.google_compute_network.default.id
}
resource "google_service_networking_connection" "vpc_connection" {
provider = google-beta
network = data.google_compute_network.default.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}
data "google_compute_network" "default" {
provider = google-beta
name = "alloydb-network"
}
```

## Argument Reference

The following arguments are supported:


* `cluster_name` -
(Required)
The full resource name of the backup source cluster (e.g., projects/{project}/locations/{location}/clusters/{clusterId}).

* `backup_id` -
(Required)
The ID of the alloydb backup.


- - -


* `labels` -
(Optional)
User-defined labels for the alloydb backup.

* `description` -
(Optional)
User-provided description of the backup.

* `location` -
(Optional)
The location where the alloydb backup should reside.

* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.


## Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

* `id` - an identifier for the resource with format `projects/{{project}}/locations/{{location}}/backups/{{backup_id}}`

* `name` -
Output only. The name of the backup resource with the format: * projects/{project}/locations/{region}/backups/{backupId}

* `uid` -
Output only. The system-generated UID of the resource. The UID is assigned when the resource is created, and it is retained until it is deleted.

* `create_time` -
Time the Backup was created in UTC.

* `update_time` -
Time the Backup was updated in UTC.

* `state` -
The current state of the backup.

* `reconciling` -
If true, indicates that the service is actively updating the resource. This can happen due to user-triggered updates or system actions like failover or maintenance.

* `etag` -
A hash of the resource.


## Timeouts

This resource provides the following
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options:

- `create` - Default is 10 minutes.
- `update` - Default is 10 minutes.
- `delete` - Default is 10 minutes.

## Import


Backup can be imported using any of these accepted formats:

```
$ terraform import google_alloydb_backup.default projects/{{project}}/locations/{{location}}/backups/{{backup_id}}
$ terraform import google_alloydb_backup.default {{project}}/{{location}}/{{backup_id}}
$ terraform import google_alloydb_backup.default {{location}}/{{backup_id}}
```

## User Project Overrides

This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).

0 comments on commit 5bc5b3b

Please sign in to comment.