Skip to content

Commit

Permalink
AlloyDB Instance (#6792) (#12981)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician committed Nov 8, 2022
1 parent e623d9f commit ca5ebf2
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/6792.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_alloydb_instance`
```
1 change: 1 addition & 0 deletions google/resource_alloydb_instance_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package google
205 changes: 205 additions & 0 deletions website/docs/r/alloydb_instance.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
---
# ----------------------------------------------------------------------------
#
# *** 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_instance"
description: |-
A managed alloydb cluster instance.
---

# google\_alloydb\_instance

A managed alloydb cluster instance.

~> **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 Instance, see:

* [API documentation](https://cloud.google.com/alloydb/docs/reference/rest/v1beta/projects.locations.clusters.instances/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_instance_basic&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 Instance Basic


```hcl
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_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}"
initial_user {
password = "alloydb-cluster"
}
}
data "google_project" "project" {
provider = google-beta
}
resource "google_compute_network" "default" {
provider = google-beta
name = "alloydb-cluster"
}
resource "google_compute_global_address" "private_ip_alloc" {
provider = google-beta
name = "alloydb-cluster"
address_type = "INTERNAL"
purpose = "VPC_PEERING"
prefix_length = 16
network = google_compute_network.default.id
}
resource "google_service_networking_connection" "vpc_connection" {
provider = google-beta
network = google_compute_network.default.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}
```

## Argument Reference

The following arguments are supported:


* `instance_type` -
(Required)
The type of the instance.
Possible values are `PRIMARY` and `READ_POOL`.

* `cluster` -
(Required)
Identifies the alloydb cluster. Must be in the format
'projects/{project}/locations/{location}/clusters/{cluster_id}'

* `instance_id` -
(Required)
The ID of the alloydb instance.


- - -


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

* `annotations` -
(Optional)
Annotations to allow client tools to store small amount of arbitrary data. This is distinct from labels.

* `display_name` -
(Optional)
User-settable and human-readable display name for the Instance.

* `gce_zone` -
(Optional)
The Compute Engine zone that the instance should serve from, per https://cloud.google.com/compute/docs/regions-zones This can ONLY be specified for ZONAL instances. If present for a REGIONAL instance, an error will be thrown. If this is absent for a ZONAL instance, instance is created in a random zone with available capacity.

* `database_flags` -
(Optional)
Database flags. Set at instance level. * They are copied from primary instance on read instance creation. * Read instances can set new or override existing flags that are relevant for reads, e.g. for enabling columnar cache on a read instance. Flags set on read instance may or may not be present on primary.

* `availability_type` -
(Optional)
Availability type of an Instance. Defaults to REGIONAL for both primary and read instances. Note that primary and read instances can have different availability types.
Possible values are `AVAILABILITY_TYPE_UNSPECIFIED`, `ZONAL`, and `REGIONAL`.

* `read_pool_config` -
(Optional)
Read pool specific config.
Structure is [documented below](#nested_read_pool_config).

* `machine_config` -
(Optional)
Configurations for the machines that host the underlying database engine.
Structure is [documented below](#nested_machine_config).


<a name="nested_read_pool_config"></a>The `read_pool_config` block supports:

* `node_count` -
(Optional)
Read capacity, i.e. number of nodes in a read pool instance.

<a name="nested_machine_config"></a>The `machine_config` block supports:

* `cpu_count` -
(Optional)
The number of CPU's in the VM instance.

## Attributes Reference

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

* `id` - an identifier for the resource with format `{{cluster}}/instances/{{instance_id}}`

* `name` -
The name of the instance resource.

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

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

* `uid` -
The system-generated UID of the resource.

* `state` -
The current state of the alloydb instance.

* `reconciling` -
Set to true if the current state of Instance does not match the user's intended state, and the service is actively updating the resource to reconcile them. This can happen due to user-triggered updates or system actions like failover or maintenance.

* `ip_address` -
The IP address for the Instance. This is the connection endpoint for an end-user application.


## 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


Instance can be imported using any of these accepted formats:

```
$ terraform import google_alloydb_instance.default {{cluster}}/instances/{{instance_id}}
$ terraform import google_alloydb_instance.default {{cluster}}/{{instance_id}}
```

0 comments on commit ca5ebf2

Please sign in to comment.