Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement. Update tests to exercise examples #76

89 changes: 33 additions & 56 deletions build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,50 +22,50 @@ steps:
- 'TF_VAR_folder_id=$_FOLDER_ID'
- 'TF_VAR_billing_account=$_BILLING_ACCOUNT'

- id: create-postgresql-simple-local
- id: create-postgresql-public-local
waitFor:
- prepare
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create postgresql-simple-local']
- id: converge-postgresql-simple-local
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create postgresql-public-local']
- id: converge-postgresql-public-local
waitFor:
- create-postgresql-simple-local
- create-postgresql-public-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge postgresql-simple-local']
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge postgresql-public-local']
timeout: 3600s
- id: verify-postgresql-simple-local
- id: verify-postgresql-public-local
waitFor:
- converge-postgresql-simple-local
- converge-postgresql-public-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify postgresql-simple-local']
- id: destroy-postgresql-simple-local
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify postgresql-public-local']
- id: destroy-postgresql-public-local
waitFor:
- verify-postgresql-simple-local
- verify-postgresql-public-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy postgresql-simple-local']
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy postgresql-public-local']
timeout: 1800s

- id: create-mysql-simple-local
- id: create-mysql-public-local
waitFor:
- prepare
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create mysql-simple-local']
- id: converge-mysql-simple-local
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create mysql-public-local']
- id: converge-mysql-public-local
waitFor:
- create-mysql-simple-local
- create-mysql-public-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge mysql-simple-local']
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge mysql-public-local']
timeout: 3600s
- id: verify-mysql-simple-local
- id: verify-mysql-public-local
waitFor:
- converge-mysql-simple-local
- converge-mysql-public-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify mysql-simple-local']
- id: destroy-mysql-simple-local
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify mysql-public-local']
- id: destroy-mysql-public-local
waitFor:
- verify-mysql-simple-local
- verify-mysql-public-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy mysql-simple-local']
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy mysql-public-local']
timeout: 1800s

- id: create-mysql-ha-local
Expand Down Expand Up @@ -114,50 +114,27 @@ steps:
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy postgresql-ha-local']
timeout: 1800s

- id: create-mysql-simple-safer-local
- id: create-mysql-private-local
waitFor:
- prepare
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create mysql-simple-safer-local']
- id: converge-mysql-simple-safer-local
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create mysql-private-local']
- id: converge-mysql-private-local
waitFor:
- create-mysql-simple-safer-local
- create-mysql-private-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge mysql-simple-safer-local']
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge mysql-private-local']
timeout: 3600s
- id: verify-mysql-simple-safer-local
- id: verify-mysql-private-local
waitFor:
- converge-mysql-simple-safer-local
- converge-mysql-private-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify mysql-simple-safer-local']
- id: destroy-mysql-simple-safer-local
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify mysql-private-local']
- id: destroy-mysql-private-local
waitFor:
- verify-mysql-simple-safer-local
- verify-mysql-private-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy mysql-simple-safer-local']
timeout: 1800s

- id: create-private-service-access-local
waitFor:
- prepare
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create private-service-access-local']
- id: converge-private-service-access-local
waitFor:
- create-private-service-access-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge private-service-access-local']
timeout: 3600s
- id: verify-private-service-access-local
waitFor:
- converge-private-service-access-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify private-service-access-local']
- id: destroy-private-service-access-local
waitFor:
- verify-private-service-access-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy private-service-access-local']
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy mysql-private-local']
timeout: 1800s

tags:
Expand Down
136 changes: 0 additions & 136 deletions examples/mysql-and-postgres-private/main.tf

This file was deleted.

49 changes: 0 additions & 49 deletions examples/mysql-and-postgres-private/variables.tf

This file was deleted.

38 changes: 38 additions & 0 deletions examples/mysql-ha/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Cloud SQL Database Example

This example shows how to create the public MySQL HA Cloud cluster using the Terraform module.

## Run Terraform

Create resources with terraform:

```bash
terraform init
terraform plan
terraform apply
```

To remove all resources created by terraform:

```bash
terraform destroy
```

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## 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 |

## Outputs

| Name | Description |
|------|-------------|
| authorized\_network | |
| name | |
| project\_id | |

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