From 17b4647cf7e5e6f2b93b63571fda4abb2d4e0085 Mon Sep 17 00:00:00 2001 From: Julien Breux Date: Tue, 22 Mar 2022 15:28:39 +0100 Subject: [PATCH 1/2] feat: Add missing auth_string output. Fix #76 --- README.md | 1 + outputs.tf | 5 +++++ test/fixtures/redis/outputs.tf | 3 +++ test/integration/redis/controls/gcloud.rb | 5 +++++ test/integration/redis/inspec.yml | 3 +++ 5 files changed, 17 insertions(+) diff --git a/README.md b/README.md index e8d9627..6c28bc9 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ module "memorystore" { | Name | Description | |------|-------------| +| auth\_string | AUTH String set on the instance. This field will only be populated if auth_enabled is true. | | current\_location\_id | The current zone where the Redis endpoint is placed. | | host | The IP address of the instance. | | id | The memorystore instance ID. | diff --git a/outputs.tf b/outputs.tf index 7f5ab48..3352e3e 100644 --- a/outputs.tf +++ b/outputs.tf @@ -43,3 +43,8 @@ output "persistence_iam_identity" { description = "Cloud IAM identity used by import/export operations. Format is 'serviceAccount:'. May change over time" value = google_redis_instance.default.persistence_iam_identity } + +output "auth_string" { + description = "AUTH String set on the instance. This field will only be populated if auth_enabled is true." + value = google_redis_instance.default.auth_string +} diff --git a/test/fixtures/redis/outputs.tf b/test/fixtures/redis/outputs.tf index c74b62f..d7fd2f6 100644 --- a/test/fixtures/redis/outputs.tf +++ b/test/fixtures/redis/outputs.tf @@ -66,3 +66,6 @@ output "output_current_location_id" { value = module.memstore.current_location_id } +output "output_auth_string" { + value = module.memstore.auth_string +} diff --git a/test/integration/redis/controls/gcloud.rb b/test/integration/redis/controls/gcloud.rb index 28610ce..3c5e58b 100644 --- a/test/integration/redis/controls/gcloud.rb +++ b/test/integration/redis/controls/gcloud.rb @@ -25,6 +25,7 @@ output_region = attribute('output_region') output_host = attribute('output_host') output_current_location_id = attribute('output_current_location_id') +output_auth_string = attribute('output_auth_string') describe 'Outputs' do it 'should reflect inputted variables' do @@ -40,6 +41,10 @@ it 'should have a valid id' do expect(output_id).to end_with name end + + it 'should have a valid auth string' do + expect(output_auth_string).to match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/) + end end control 'redis-instance' do diff --git a/test/integration/redis/inspec.yml b/test/integration/redis/inspec.yml index dfd2e4e..3bb6988 100644 --- a/test/integration/redis/inspec.yml +++ b/test/integration/redis/inspec.yml @@ -44,6 +44,9 @@ attributes: - name: output_current_location_id required: true type: string + - name: output_auth_string + required: true + type: string - name: auth_enabled required: true type: boolean From 03660c6b996a2d919a830290d151f60afa88e18a Mon Sep 17 00:00:00 2001 From: Julien Breux Date: Tue, 22 Mar 2022 16:01:59 +0100 Subject: [PATCH 2/2] doc: Generate documentation --- README.md | 2 +- test/fixtures/redis/README.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c28bc9..619b4d4 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ module "memorystore" { | Name | Description | |------|-------------| -| auth\_string | AUTH String set on the instance. This field will only be populated if auth_enabled is true. | +| auth\_string | AUTH String set on the instance. This field will only be populated if auth\_enabled is true. | | current\_location\_id | The current zone where the Redis endpoint is placed. | | host | The IP address of the instance. | | id | The memorystore instance ID. | diff --git a/test/fixtures/redis/README.md b/test/fixtures/redis/README.md index 4f64a71..d8a3fde 100644 --- a/test/fixtures/redis/README.md +++ b/test/fixtures/redis/README.md @@ -27,6 +27,7 @@ This test will create a new redis instance. | location\_id | n/a | | memory\_size\_gb | n/a | | name | n/a | +| output\_auth\_string | n/a | | output\_current\_location\_id | n/a | | output\_host | n/a | | output\_id | n/a |