Skip to content

Commit

Permalink
Merge pull request #3 from trotttrotttrott/feature/optional-api-enabl…
Browse files Browse the repository at this point in the history
…ement

Optionally Enable "redis.googleapis.com" Service
  • Loading branch information
morgante authored Jan 16, 2019
2 parents 0ab3860 + 319d5e0 commit 1fd6cae
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 25 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@ module "memorystore" {

[^]: (autogen_docs_start)


## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| alternative_location_id | The alternative zone where the instance will be provisioned. | string | `` | no |
| authorized_network | The name of the memorystore authorized network. | string | `` | no |
| display_name | An arbitrary and optional user-provided name for the instance. | string | `` | no |
| labels | The resource labels to represent user provided metadata. | string | `<map>` | no |
| location_id | The zone where the instance will be provisioned. | string | `` | no |
| memory_size_gb | Redis memory size in GiB. | string | - | yes |
| alternative\_location\_id | The alternative zone where the instance will be provisioned. | string | `` | no |
| authorized\_network | The name of the memorystore authorized network. | string | `` | no |
| display\_name | An arbitrary and optional user-provided name for the instance. | string | `` | no |
| enable\_apis | Enable required APIs for Cloud Memorystore. | string | `true` | no |
| labels | The resource labels to represent user provided metadata. | map | `<map>` | no |
| location\_id | The zone where the instance will be provisioned. | string | `` | no |
| memory\_size\_gb | Redis memory size in GiB. | string | - | yes |
| name | The ID of the instance or a fully qualified identifier for the instance. | string | - | yes |
| project | The ID of the project in which the resource belongs to. | string | - | yes |
| redis_version | The version of Redis software. | string | `` | no |
| redis\_version | The version of Redis software. | string | `` | no |
| region | The GCP region to use. | string | `` | no |
| reserved_ip_range | The CIDR range of internal addresses that are reserved for this instance. | string | `` | no |
| reserved\_ip\_range | The CIDR range of internal addresses that are reserved for this instance. | string | `` | no |
| tier | The service tier of the instance. | string | `STANDARD_HA` | no |

## Outputs

| Name | Description |
|------|-------------|
| current_location_id | The current zone where the Redis endpoint is placed. |
| current\_location\_id | The current zone where the Redis endpoint is placed. |
| host | The IP address of the instance. |
| id | The memorystore instance ID. |
| region | The region the instance lives in. |
Expand Down
9 changes: 9 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,13 @@ resource "google_redis_instance" "default" {
reserved_ip_range = "${var.reserved_ip_range}"

labels = "${var.labels}"

depends_on = ["google_project_service.redis"]
}

resource "google_project_service" "redis" {
count = "${var.enable_apis ? 1 : 0}"

project = "${var.project}"
service = "redis.googleapis.com"
}
29 changes: 14 additions & 15 deletions test/fixtures/minimal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,30 @@ This test with create a new redis instance.

[^]: (autogen_docs_start)


## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| credentials_path | Path to service account key (usually credentials.json). | string | - | yes |
| location_id | Zone to create test instance. | string | `us-east1-b` | no |
| memory_size_gb | Memory size of test instance. | string | `1` | no |
| credentials\_path | Path to service account key (usually credentials.json). | string | - | yes |
| location\_id | Zone to create test instance. | string | `us-east1-b` | no |
| memory\_size\_gb | Memory size of test instance. | string | `1` | no |
| name | Name of redis instance. | string | `test-minimal` | no |
| project_id | Google cloud project id to create redis instance. | string | - | yes |
| project\_id | Google cloud project id to create redis instance. | string | - | yes |
| region | Region to create test instance. | string | `us-east1` | no |

## Outputs

| Name | Description |
|------|-------------|
| credentials_path | |
| location_id | |
| memory_size_gb | |
| name | |
| output_current_location_id | |
| output_host | |
| output_id | |
| output_region | |
| project_id | |
| region | |
| credentials\_path | - |
| location\_id | - |
| memory\_size\_gb | - |
| name | - |
| output\_current\_location\_id | - |
| output\_host | - |
| output\_id | - |
| output\_region | - |
| project\_id | - |
| region | - |

[^]: (autogen_docs_end)
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,8 @@ variable "labels" {
description = "The resource labels to represent user provided metadata."
default = {}
}

variable "enable_apis" {
description = "Enable required APIs for Cloud Memorystore."
default = "true"
}

0 comments on commit 1fd6cae

Please sign in to comment.