subcategory | page_title | description |
---|---|---|
AlloyDB |
Google: google_alloydb_cluster |
A managed alloydb cluster. |
A managed alloydb cluster.
~> Warning: This resource is in beta, and should be used with the terraform-provider-google-beta provider. See Provider Versions for more details on beta resources.
To get more information about Cluster, see:
- API documentation
- How-to Guides
~> Warning: All arguments including initial_user.password
will be stored in the raw
state as plain-text. Read more about sensitive data in state.
resource "google_alloydb_cluster" "default" {
provider = google-beta
cluster_id = "alloydb-cluster"
location = "us-central1"
network = "projects/${data.google_project.project.number}/global/networks/${google_compute_network.default.name}"
}
data "google_project" "project" {
provider = google-beta
}
resource "google_compute_network" "default" {
provider = google-beta
name = "alloydb-cluster"
}
resource "google_alloydb_cluster" "full" {
provider = google-beta
cluster_id = "alloydb-cluster-full"
location = "us-central1"
network = "projects/${data.google_project.project.number}/global/networks/${google_compute_network.default.name}"
initial_user {
user = "alloydb-cluster-full"
password = "alloydb-cluster-full"
}
automated_backup_policy {
location = "us-central1"
backup_window = "1800s"
enabled = true
weekly_schedule {
days_of_week = ["MONDAY"]
start_times {
hours = 23
minutes = 0
seconds = 0
nanos = 0
}
}
quantity_based_retention {
count = 1
}
labels = {
test = "alloydb-cluster-full"
}
}
labels = {
test = "alloydb-cluster-full"
}
}
data "google_project" "project" {
provider = google-beta
}
resource "google_compute_network" "default" {
provider = google-beta
name = "alloydb-cluster-full"
}
The following arguments are supported:
-
network
- (Required) The relative resource name of the VPC network on which the instance can be accessed. It is specified in the following form: "projects/{projectNumber}/global/networks/{network_id}". -
cluster_id
- (Required) The ID of the alloydb cluster.
-
labels
- (Optional) User-defined labels for the alloydb cluster. -
display_name
- (Optional) User-settable and human-readable display name for the Cluster. -
initial_user
- (Optional) Initial user to setup during cluster creation. Structure is documented below. -
automated_backup_policy
- (Optional) The automated backup policy for this cluster. If no policy is provided then the default policy will be used. The default policy takes one backup a day, has a backup window of 1 hour, and retains backups for 14 days. Structure is documented below. -
location
- (Optional) The location where the alloydb cluster should reside. -
project
- (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
The initial_user
block supports:
-
user
- (Optional) The database username. -
password
- (Required) The initial password for the user. Note: This property is sensitive and will not be displayed in the plan.
The automated_backup_policy
block supports:
-
backup_window
- (Optional) The length of the time window during which a backup can be taken. If a backup does not succeed within this time window, it will be canceled and considered failed. The backup window must be at least 5 minutes long. There is no upper bound on the window. If not set, it will default to 1 hour. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". -
location
- (Optional) The location where the backup will be stored. Currently, the only supported option is to store the backup in the same region as the cluster. -
labels
- (Optional) Labels to apply to backups created using this configuration. -
weekly_schedule
- (Required) Weekly schedule for the Backup. Structure is documented below. -
time_based_retention
- (Optional) Time-based Backup retention policy. Structure is documented below. -
quantity_based_retention
- (Optional) Quantity-based Backup retention policy to retain recent backups. Structure is documented below. -
enabled
- (Optional) Whether automated automated backups are enabled.
The weekly_schedule
block supports:
-
days_of_week
- (Optional) The days of the week to perform a backup. At least one day of the week must be provided. Each value may be one ofMONDAY
,TUESDAY
,WEDNESDAY
,THURSDAY
,FRIDAY
,SATURDAY
, andSUNDAY
. -
start_times
- (Required) The times during the day to start a backup. At least one start time must be provided. The start times are assumed to be in UTC and to be an exact hour (e.g., 04:00:00). Structure is documented below.
The start_times
block supports:
-
hours
- (Optional) Hours of day in 24 hour format. Should be from 0 to 23. An API may choose to allow the value "24:00:00" for scenarios like business closing time. -
minutes
- (Optional) Minutes of hour of day. Must be from 0 to 59. -
seconds
- (Optional) Seconds of minutes of the time. Must normally be from 0 to 59. An API may allow the value 60 if it allows leap-seconds. -
nanos
- (Optional) Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.
The time_based_retention
block supports:
retention_period
- (Optional) The retention period. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
The quantity_based_retention
block supports:
count
- (Optional) The number of backups to retain.
In addition to the arguments listed above, the following computed attributes are exported:
-
id
- an identifier for the resource with formatprojects/{{project}}/locations/{{location}}/clusters/{{cluster_id}}
-
name
- The name of the cluster resource. -
uid
- The system-generated UID of the resource. -
database_version
- The database engine major version. This is an output-only field and it's populated at the Cluster creation time. This field cannot be changed after cluster creation. -
backup_source
- Cluster created from backup. Structure is documented below. -
migration_source
- Cluster created via DMS migration. Structure is documented below.
The backup_source
block contains:
backup_name
- (Optional) The name of the backup resource.
The migration_source
block contains:
-
host_port
- (Optional) The host and port of the on-premises instance in host:port format -
reference_id
- (Optional) Place holder for the external source identifier(e.g DMS job name) that created the cluster. -
source_type
- (Optional) Type of migration source.
This resource provides the following Timeouts configuration options:
create
- Default is 10 minutes.update
- Default is 10 minutes.delete
- Default is 10 minutes.
Cluster can be imported using any of these accepted formats:
$ terraform import google_alloydb_cluster.default projects/{{project}}/locations/{{location}}/clusters/{{cluster_id}}
$ terraform import google_alloydb_cluster.default {{project}}/{{location}}/{{cluster_id}}
$ terraform import google_alloydb_cluster.default {{location}}/{{cluster_id}}
$ terraform import google_alloydb_cluster.default {{cluster_id}}
This resource supports User Project Overrides.