Skip to content

Commit

Permalink
feat!: add Terraform 0.13 constraint and module attribution (#202)
Browse files Browse the repository at this point in the history
* feat!: add Terraform 0.13 constraint and module attribution

* Update versions.tf

* Update versions.tf

* Update versions.tf

Co-authored-by: Morgante Pell <morgantep@google.com>
  • Loading branch information
cloud-foundation-bot and morgante committed Mar 19, 2021
1 parent 2619b42 commit ec0911c
Show file tree
Hide file tree
Showing 21 changed files with 294 additions and 229 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Make will use bash instead of sh
SHELL := /usr/bin/env bash

DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.4.3
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.13
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
REGISTRY_URL := gcr.io/cloud-foundation-cicd

Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ This module consists of the following submodules:
See more details in each module's README.

## Compatibility

This module is meant for use with Terraform 0.12. If you haven't
[upgraded](https://www.terraform.io/upgrade-guides/0-12.html)
and need a Terraform 0.11.x-compatible version of this module, the last
released version intended for Terraform 0.11.x is
[v1.2.0](https://registry.terraform.io/modules/GoogleCloudPlatform/sql-db/google/1.2.0).
This module is meant for use with Terraform 0.13. If you haven't
[upgraded](https://www.terraform.io/upgrade-guides/0-13.html) and need a Terraform
0.12.x-compatible version of this module, the last released version
intended for Terraform 0.12.x is [v4.5.0](https://registry.terraform.io/modules/terraform-google-modules/-sql-db/google/v4.5.0).

## Upgrading

Expand All @@ -32,7 +30,7 @@ The root module has been deprecated. Please switch to using one of the submodule

### Installation Dependencies

- [terraform](https://www.terraform.io/downloads.html) 0.12.x
- [Terraform](https://www.terraform.io/downloads.html) >= 0.13.0
- [terraform-provider-google](https://github.com/terraform-providers/terraform-provider-google) plugin v2.5.x

The following dependency must be available for SQL Server module:
Expand Down
2 changes: 1 addition & 1 deletion build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,4 @@ tags:
- 'integration'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.4.3'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.13'
2 changes: 1 addition & 1 deletion build/lint.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ tags:
- 'lint'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.4.3'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.13'
10 changes: 5 additions & 5 deletions examples/mssql-public/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ This example shows how create MS SQL Server database using the Terraform module.
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| name | The name for Cloud SQL instance | string | `"tf-mssql-public"` | no |
| project\_id | The project to run tests against | string | n/a | yes |
| region | | string | `"us-central1"` | no |
|------|-------------|------|---------|:--------:|
| name | The name for Cloud SQL instance | `string` | `"tf-mssql-public"` | no |
| project\_id | The project to run tests against | `string` | n/a | yes |
| region | n/a | `string` | `"us-central1"` | no |

## Outputs

| Name | Description |
|------|-------------|
| instance\_name | The name for Cloud SQL instance |
| mssql\_connection | The connection name of the master instance to be used in connection strings |
| project\_id | |
| project\_id | n/a |
| public\_ip\_address | Public ip address |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Expand Down
12 changes: 6 additions & 6 deletions examples/mysql-ha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ terraform destroy
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| mysql\_ha\_external\_ip\_range | The ip range to allow connecting from/to Cloud SQL | string | `"192.10.10.10/32"` | no |
| mysql\_ha\_name | The name for Cloud SQL instance | string | `"tf-mysql-ha"` | no |
| project\_id | The project to run tests against | string | n/a | yes |
|------|-------------|------|---------|:--------:|
| mysql\_ha\_external\_ip\_range | The ip range to allow connecting from/to Cloud SQL | `string` | `"192.10.10.10/32"` | no |
| mysql\_ha\_name | The name for Cloud SQL instance | `string` | `"tf-mysql-ha"` | no |
| project\_id | The project to run tests against | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| authorized\_network | |
| authorized\_network | n/a |
| name | The name for Cloud SQL instance |
| project\_id | |
| project\_id | n/a |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
10 changes: 5 additions & 5 deletions examples/mysql-private/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ terraform destroy
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| db\_name | The name of the SQL Database instance | string | `"example-mysql-private"` | no |
| network\_name | | string | `"mysql-privat"` | no |
| project\_id | The project to run tests against | string | n/a | yes |
|------|-------------|------|---------|:--------:|
| db\_name | The name of the SQL Database instance | `string` | `"example-mysql-private"` | no |
| network\_name | n/a | `string` | `"mysql-privat"` | no |
| project\_id | The project to run tests against | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| mysql\_conn | The connection name of the master instance to be used in connection strings |
| mysql\_user\_pass | The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable. |
| mysql\_user\_pass | The password for the default user. If not set, a random one will be generated and available in the generated\_user\_password output variable. |
| name | The name for Cloud SQL instance |
| private\_ip\_address | The first private (PRIVATE) IPv4 address assigned for the master instance |
| project\_id | The project to run tests against |
Expand Down
10 changes: 5 additions & 5 deletions examples/mysql-public/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ terraform destroy
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| authorized\_networks | List of mapped public networks authorized to access to the instances. Default - short range of GCP health-checkers IPs | list(map(string)) | `<list>` | no |
| db\_name | The name of the SQL Database instance | string | `"example-mysql-public"` | no |
| project\_id | The ID of the project in which resources will be provisioned. | string | n/a | yes |
|------|-------------|------|---------|:--------:|
| authorized\_networks | List of mapped public networks authorized to access to the instances. Default - short range of GCP health-checkers IPs | `list(map(string))` | <pre>[<br> {<br> "name": "sample-gcp-health-checkers-range",<br> "value": "130.211.0.0/28"<br> }<br>]</pre> | no |
| db\_name | The name of the SQL Database instance | `string` | `"example-mysql-public"` | no |
| project\_id | The ID of the project in which resources will be provisioned. | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| mysql\_conn | The connection name of the master instance to be used in connection strings |
| mysql\_user\_pass | The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable. |
| mysql\_user\_pass | The password for the default user. If not set, a random one will be generated and available in the generated\_user\_password output variable. |
| name | The name for Cloud SQL instance |
| private\_ip\_address | The first private (PRIVATE) IPv4 address assigned for the master instance |
| project\_id | The project to run tests against |
Expand Down
12 changes: 6 additions & 6 deletions examples/postgresql-ha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ terraform destroy
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| pg\_ha\_external\_ip\_range | The ip range to allow connecting from/to Cloud SQL | string | `"192.10.10.10/32"` | no |
| pg\_ha\_name | The name for Cloud SQL instance | string | `"tf-pg-ha"` | no |
| project\_id | The project to run tests against | string | n/a | yes |
|------|-------------|------|---------|:--------:|
| pg\_ha\_external\_ip\_range | The ip range to allow connecting from/to Cloud SQL | `string` | `"192.10.10.10/32"` | no |
| pg\_ha\_name | The name for Cloud SQL instance | `string` | `"tf-pg-ha"` | no |
| project\_id | The project to run tests against | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| authorized\_network | |
| authorized\_network | n/a |
| name | The name for Cloud SQL instance |
| project\_id | |
| project\_id | n/a |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
10 changes: 5 additions & 5 deletions examples/postgresql-public/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ terraform destroy
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| authorized\_networks | List of mapped public networks authorized to access to the instances. Default - short range of GCP health-checkers IPs | list(map(string)) | `<list>` | no |
| db\_name | The name of the SQL Database instance | string | `"example-postgres-public"` | no |
| project\_id | The ID of the project in which resources will be provisioned. | string | n/a | yes |
|------|-------------|------|---------|:--------:|
| authorized\_networks | List of mapped public networks authorized to access to the instances. Default - short range of GCP health-checkers IPs | `list(map(string))` | <pre>[<br> {<br> "name": "sample-gcp-health-checkers-range",<br> "value": "130.211.0.0/28"<br> }<br>]</pre> | no |
| db\_name | The name of the SQL Database instance | `string` | `"example-postgres-public"` | no |
| project\_id | The ID of the project in which resources will be provisioned. | `string` | n/a | yes |

## Outputs

Expand All @@ -34,7 +34,7 @@ terraform destroy
| name | The name for Cloud SQL instance |
| project\_id | The project to run tests against |
| psql\_conn | The connection name of the master instance to be used in connection strings |
| psql\_user\_pass | The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable. |
| psql\_user\_pass | The password for the default user. If not set, a random one will be generated and available in the generated\_user\_password output variable. |
| public\_ip\_address | The first public (PRIMARY) IPv4 address assigned for the master instance |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
74 changes: 37 additions & 37 deletions modules/mssql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,42 @@ The following dependency must be available for SQL Server module:
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| activation\_policy | The activation policy for the master instance.Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`. | string | `"ALWAYS"` | no |
| additional\_databases | A list of databases to be created in your cluster | object | `<list>` | no |
| additional\_users | A list of users to be created in your cluster | object | `<list>` | no |
| authorized\_gae\_applications | The authorized gae applications for the Cloud SQL instances | list(string) | `<list>` | no |
| availability\_type | The availability type for the master instance.This is only used to set up high availability for the MSSQL instance. Can be either `ZONAL` or `REGIONAL`. | string | `"ZONAL"` | no |
| backup\_configuration | The database backup configuration. | object | `<map>` | no |
| create\_timeout | The optional timeout that is applied to limit long database creates. | string | `"15m"` | no |
| database\_flags | The database flags for the master instance. See [more details](https://cloud.google.com/sql/docs/sqlserver/flags) | object | `<list>` | no |
| database\_version | The database version to use: SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, or SQLSERVER_2017_WEB | string | `"SQLSERVER_2017_STANDARD"` | no |
| db\_charset | The charset for the default database | string | `""` | no |
| db\_collation | The collation for the default database. Example: 'en_US.UTF8' | string | `""` | no |
| db\_name | The name of the default database to create | string | `"default"` | no |
| delete\_timeout | The optional timeout that is applied to limit long database deletes. | string | `"30m"` | no |
| deletion\_protection | Used to block Terraform from deleting a SQL Instance. | bool | `"true"` | no |
| disk\_autoresize | Configuration to increase storage size. | bool | `"true"` | no |
| disk\_size | The disk size for the master instance. | string | `"10"` | no |
| disk\_type | The disk type for the master instance. | string | `"PD_SSD"` | no |
| encryption\_key\_name | The full path to the encryption key used for the CMEK disk encryption | string | `"null"` | no |
| ip\_configuration | The ip configuration for the master instances. | object | `<map>` | no |
| maintenance\_window\_day | The day of week (1-7) for the master instance maintenance. | number | `"1"` | no |
| maintenance\_window\_hour | The hour of day (0-23) maintenance window for the master instance maintenance. | number | `"23"` | no |
| maintenance\_window\_update\_track | The update track of maintenance window for the master instance maintenance.Can be either `canary` or `stable`. | string | `"canary"` | no |
| module\_depends\_on | List of modules or resources this module depends on. | list(any) | `<list>` | no |
| name | The name of the Cloud SQL resources | string | n/a | yes |
| pricing\_plan | The pricing plan for the master instance. | string | `"PER_USE"` | no |
| project\_id | The project ID to manage the Cloud SQL resources | string | n/a | yes |
| random\_instance\_name | Sets random suffix at the end of the Cloud SQL resource name | bool | `"false"` | no |
| region | The region of the Cloud SQL resources | string | `"us-central1"` | no |
| root\_password | MSSERVER password for the root user. If not set, a random one will be generated and available in the root_password output variable. | string | `""` | no |
| tier | The tier for the master instance. | string | `"db-custom-2-3840"` | no |
| update\_timeout | The optional timeout that is applied to limit long database updates. | string | `"15m"` | no |
| user\_labels | The key/value labels for the master instances. | map(string) | `<map>` | no |
| user\_name | The name of the default user | string | `"default"` | no |
| user\_password | The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable. | string | `""` | no |
| zone | The zone for the master instance. | string | `"us-central1-a"` | no |
|------|-------------|------|---------|:--------:|
| activation\_policy | The activation policy for the master instance.Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`. | `string` | `"ALWAYS"` | no |
| additional\_databases | A list of databases to be created in your cluster | <pre>list(object({<br> name = string<br> charset = string<br> collation = string<br> }))</pre> | `[]` | no |
| additional\_users | A list of users to be created in your cluster | <pre>list(object({<br> name = string<br> password = string<br> }))</pre> | `[]` | no |
| authorized\_gae\_applications | The authorized gae applications for the Cloud SQL instances | `list(string)` | `[]` | no |
| availability\_type | The availability type for the master instance.This is only used to set up high availability for the MSSQL instance. Can be either `ZONAL` or `REGIONAL`. | `string` | `"ZONAL"` | no |
| backup\_configuration | The database backup configuration. | <pre>object({<br> binary_log_enabled = bool<br> enabled = bool<br> point_in_time_recovery_enabled = bool<br> start_time = string<br> })</pre> | <pre>{<br> "binary_log_enabled": null,<br> "enabled": false,<br> "point_in_time_recovery_enabled": null,<br> "start_time": null<br>}</pre> | no |
| create\_timeout | The optional timeout that is applied to limit long database creates. | `string` | `"15m"` | no |
| database\_flags | The database flags for the master instance. See [more details](https://cloud.google.com/sql/docs/sqlserver/flags) | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
| database\_version | The database version to use: SQLSERVER\_2017\_STANDARD, SQLSERVER\_2017\_ENTERPRISE, SQLSERVER\_2017\_EXPRESS, or SQLSERVER\_2017\_WEB | `string` | `"SQLSERVER_2017_STANDARD"` | no |
| db\_charset | The charset for the default database | `string` | `""` | no |
| db\_collation | The collation for the default database. Example: 'en\_US.UTF8' | `string` | `""` | no |
| db\_name | The name of the default database to create | `string` | `"default"` | no |
| delete\_timeout | The optional timeout that is applied to limit long database deletes. | `string` | `"30m"` | no |
| deletion\_protection | Used to block Terraform from deleting a SQL Instance. | `bool` | `true` | no |
| disk\_autoresize | Configuration to increase storage size. | `bool` | `true` | no |
| disk\_size | The disk size for the master instance. | `number` | `10` | no |
| disk\_type | The disk type for the master instance. | `string` | `"PD_SSD"` | no |
| encryption\_key\_name | The full path to the encryption key used for the CMEK disk encryption | `string` | `null` | no |
| ip\_configuration | The ip configuration for the master instances. | <pre>object({<br> authorized_networks = list(map(string))<br> ipv4_enabled = bool<br> private_network = string<br> require_ssl = bool<br> })</pre> | <pre>{<br> "authorized_networks": [],<br> "ipv4_enabled": true,<br> "private_network": null,<br> "require_ssl": null<br>}</pre> | no |
| maintenance\_window\_day | The day of week (1-7) for the master instance maintenance. | `number` | `1` | no |
| maintenance\_window\_hour | The hour of day (0-23) maintenance window for the master instance maintenance. | `number` | `23` | no |
| maintenance\_window\_update\_track | The update track of maintenance window for the master instance maintenance.Can be either `canary` or `stable`. | `string` | `"canary"` | no |
| module\_depends\_on | List of modules or resources this module depends on. | `list(any)` | `[]` | no |
| name | The name of the Cloud SQL resources | `string` | n/a | yes |
| pricing\_plan | The pricing plan for the master instance. | `string` | `"PER_USE"` | no |
| project\_id | The project ID to manage the Cloud SQL resources | `string` | n/a | yes |
| random\_instance\_name | Sets random suffix at the end of the Cloud SQL resource name | `bool` | `false` | no |
| region | The region of the Cloud SQL resources | `string` | `"us-central1"` | no |
| root\_password | MSSERVER password for the root user. If not set, a random one will be generated and available in the root\_password output variable. | `string` | `""` | no |
| tier | The tier for the master instance. | `string` | `"db-custom-2-3840"` | no |
| update\_timeout | The optional timeout that is applied to limit long database updates. | `string` | `"15m"` | no |
| user\_labels | The key/value labels for the master instances. | `map(string)` | `{}` | no |
| user\_name | The name of the default user | `string` | `"default"` | no |
| user\_password | The password for the default user. If not set, a random one will be generated and available in the generated\_user\_password output variable. | `string` | `""` | no |
| zone | The zone for the master instance. | `string` | `"us-central1-a"` | no |

## Outputs

Expand All @@ -58,6 +58,6 @@ The following dependency must be available for SQL Server module:
| instance\_server\_ca\_cert | The CA certificate information used to connect to the SQL instance via SSL |
| instance\_service\_account\_email\_address | The service account email address assigned to the master instance |
| private\_address | The private IP address assigned for the master instance |
| root\_password | MSSERVER password for the root user. If not set, a random one will be generated and available in the root_password output variable. |
| root\_password | MSSERVER password for the root user. If not set, a random one will be generated and available in the root\_password output variable. |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

0 comments on commit ec0911c

Please sign in to comment.