From 2756d9b2483ee1b6047785ef60aa1108cf02e1a7 Mon Sep 17 00:00:00 2001 From: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> Date: Fri, 18 Jun 2021 12:47:14 -0700 Subject: [PATCH] add update test step --- .../provider/resource_vault_cluster_test.go | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/internal/provider/resource_vault_cluster_test.go b/internal/provider/resource_vault_cluster_test.go index 0b1725c8f..f1b50cb0d 100644 --- a/internal/provider/resource_vault_cluster_test.go +++ b/internal/provider/resource_vault_cluster_test.go @@ -23,6 +23,25 @@ resource "hcp_vault_cluster" "test" { tier = "dev" } +data "hcp_vault_cluster" "test" { + cluster_id = hcp_vault_cluster.test.cluster_id +} +` + +var testAccUpdatedVaultClusterConfig = ` +resource "hcp_hvn" "test" { + hvn_id = "test-hvn" + cloud_provider = "aws" + region = "us-west-2" +} + +resource "hcp_vault_cluster" "test" { + cluster_id = "test-vault-cluster" + hvn_id = hcp_hvn.test.hvn_id + tier = "dev" + public_endpoint = true +} + data "hcp_vault_cluster" "test" { cluster_id = hcp_vault_cluster.test.cluster_id } @@ -126,6 +145,18 @@ func TestAccVaultCluster(t *testing.T) { resource.TestCheckResourceAttrPair(vaultClusterResourceName, "created_at", vaultClusterDataSourceName, "created_at"), ), }, + // This step verifies the successful update of updatable fields. + { + Config: testConfig(testAccUpdatedVaultClusterConfig), + Check: resource.ComposeTestCheckFunc( + testAccCheckVaultClusterExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "public_endpoint", "true"), + resource.TestCheckResourceAttrSet(resourceName, "vault_public_endpoint_url"), + testAccCheckFullURL(resourceName, "vault_public_endpoint_url", "8200"), + resource.TestCheckResourceAttrSet(resourceName, "vault_private_endpoint_url"), + testAccCheckFullURL(resourceName, "vault_private_endpoint_url", "8200"), + ), + }, }, }) }