Skip to content

Commit

Permalink
SSL Mode and Require Connectors support for AlloyDB (#9064) (#6452)
Browse files Browse the repository at this point in the history
* support to create instance with ssl mode and require connectors, with acceptance tests

* removed client_connection_config in basic instance example, and cleaned up the code a little bit

* attempts to set the default ssl mode in the custom code

* able to set default value during instance creation and addressing some comments

* trying to fix updating ssl mode

* fixed updating the instance with ssl mode

* cleaning up code and fixing acceptance tests

* Fixing spacing issues in instance.yaml

* fixing spacing issues again in instance.yaml

* fixing formatting in unit test

* fixing the acceptance tests for other alloydb resources by explicitly adding the clientconnectionconfig

* fixing spacing and removing commented out imports

* commenting out createInstanceWithMandatoryFields and createPrimaryAndReadPoolInstance tests because they're failing due to an unrelated service networking issue

* fix tests failing due to missing client_connection_config

* removing service networking resources from tests since there's a bug in service networking
[upstream:5c055415a5aa320c396c2db197278a0ddc951a95]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Oct 5, 2023
1 parent 1305940 commit f7b97f8
Show file tree
Hide file tree
Showing 9 changed files with 651 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .changelog/9064.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note: enhancement

alloydb: added `client_connection_config`, `client_connection_config.require_connectors`, `client_connection_config.ssl_config`, and `client_connection_config.ssl_config.ssl_mode` fields to `google_alloydb_instance` resource
```
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ resource "google_alloydb_instance" "default" {
cluster = google_alloydb_cluster.default.name
instance_id = "tf-test-alloydb-instance%{random_suffix}"
instance_type = "PRIMARY"
client_connection_config {
require_connectors = false
ssl_config {
ssl_mode = "ENCRYPTED_ONLY"
}
}
depends_on = [google_service_networking_connection.vpc_connection]
}
Expand Down Expand Up @@ -149,6 +155,12 @@ resource "google_alloydb_instance" "default" {
cluster = google_alloydb_cluster.default.name
instance_id = "tf-test-alloydb-instance%{random_suffix}"
instance_type = "PRIMARY"
client_connection_config {
require_connectors = false
ssl_config {
ssl_mode = "ENCRYPTED_ONLY"
}
}
depends_on = [google_service_networking_connection.vpc_connection]
}
Expand Down
24 changes: 24 additions & 0 deletions google-beta/services/alloydb/resource_alloydb_backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ resource "google_alloydb_instance" "default" {
cluster = google_alloydb_cluster.default.name
instance_id = "tf-test-alloydb-instance%{random_suffix}"
instance_type = "PRIMARY"
client_connection_config {
require_connectors = false
ssl_config {
ssl_mode = "ENCRYPTED_ONLY"
}
}
}
data "google_compute_network" "default" {
Expand Down Expand Up @@ -103,6 +109,12 @@ resource "google_alloydb_instance" "default" {
cluster = google_alloydb_cluster.default.name
instance_id = "tf-test-alloydb-instance%{random_suffix}"
instance_type = "PRIMARY"
client_connection_config {
require_connectors = false
ssl_config {
ssl_mode = "ENCRYPTED_ONLY"
}
}
}
data "google_compute_network" "default" {
Expand Down Expand Up @@ -157,6 +169,12 @@ resource "google_alloydb_instance" "default" {
cluster = google_alloydb_cluster.default.name
instance_id = "tf-test-alloydb-instance%{random_suffix}"
instance_type = "PRIMARY"
client_connection_config {
require_connectors = false
ssl_config {
ssl_mode = "ENCRYPTED_ONLY"
}
}
}
`, context)
}
Expand Down Expand Up @@ -215,6 +233,12 @@ resource "google_alloydb_instance" "default" {
cluster = google_alloydb_cluster.default.name
instance_id = "tf-test-alloydb-instance%{random_suffix}"
instance_type = "PRIMARY"
client_connection_config {
require_connectors = false
ssl_config {
ssl_mode = "ENCRYPTED_ONLY"
}
}
}
data "google_compute_network" "default" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ resource "google_alloydb_instance" "source" {
cluster = google_alloydb_cluster.source.name
instance_id = "tf-test-alloydb-instance%{random_suffix}"
instance_type = "PRIMARY"
client_connection_config {
require_connectors = false
ssl_config {
ssl_mode = "ENCRYPTED_ONLY"
}
}
}
resource "google_alloydb_backup" "default" {
Expand Down Expand Up @@ -126,6 +132,12 @@ resource "google_alloydb_instance" "source" {
cluster = google_alloydb_cluster.source.name
instance_id = "tf-test-alloydb-instance%{random_suffix}"
instance_type = "PRIMARY"
client_connection_config {
require_connectors = false
ssl_config {
ssl_mode = "ENCRYPTED_ONLY"
}
}
}
resource "google_alloydb_backup" "default" {
Expand Down Expand Up @@ -174,6 +186,12 @@ resource "google_alloydb_instance" "source" {
cluster = google_alloydb_cluster.source.name
instance_id = "tf-test-alloydb-instance%{random_suffix}"
instance_type = "PRIMARY"
client_connection_config {
require_connectors = false
ssl_config {
ssl_mode = "ENCRYPTED_ONLY"
}
}
}
resource "google_alloydb_backup" "default" {
Expand Down Expand Up @@ -218,6 +236,12 @@ resource "google_alloydb_instance" "source" {
cluster = google_alloydb_cluster.source.name
instance_id = "tf-test-alloydb-instance%{random_suffix}"
instance_type = "PRIMARY"
client_connection_config {
require_connectors = false
ssl_config {
ssl_mode = "ENCRYPTED_ONLY"
}
}
}
resource "google_alloydb_backup" "default" {
Expand Down Expand Up @@ -263,6 +287,12 @@ resource "google_alloydb_instance" "source" {
cluster = google_alloydb_cluster.source.name
instance_id = "tf-test-alloydb-instance%{random_suffix}"
instance_type = "PRIMARY"
client_connection_config {
require_connectors = false
ssl_config {
ssl_mode = "ENCRYPTED_ONLY"
}
}
}
resource "google_alloydb_backup" "default" {
Expand Down Expand Up @@ -322,6 +352,12 @@ resource "google_alloydb_instance" "source" {
cluster = google_alloydb_cluster.source.name
instance_id = "tf-test-alloydb-instance%{random_suffix}"
instance_type = "PRIMARY"
client_connection_config {
require_connectors = false
ssl_config {
ssl_mode = "ENCRYPTED_ONLY"
}
}
}
resource "google_alloydb_backup" "default" {
Expand Down Expand Up @@ -391,6 +427,12 @@ resource "google_alloydb_instance" "source" {
cluster = google_alloydb_cluster.source.name
instance_id = "tf-test-alloydb-instance%{random_suffix}"
instance_type = "PRIMARY"
client_connection_config {
require_connectors = false
ssl_config {
ssl_mode = "ENCRYPTED_ONLY"
}
}
}
resource "google_alloydb_backup" "default" {
Expand Down Expand Up @@ -470,6 +512,12 @@ resource "google_alloydb_instance" "source" {
cluster = google_alloydb_cluster.source.name
instance_id = "tf-test-alloydb-instance%{random_suffix}"
instance_type = "PRIMARY"
client_connection_config {
require_connectors = false
ssl_config {
ssl_mode = "ENCRYPTED_ONLY"
}
}
}
resource "google_alloydb_backup" "default" {
Expand Down
Loading

0 comments on commit f7b97f8

Please sign in to comment.