// Initialize the Vault cluster and unseal each of the nodes by connecting to them over SSH and executing Vault
// commands. The reason we use SSH rather than using the Vault client remotely is we want to verify that the
// self-signed TLS certificate is properly configured on each server so when you're on that server, you don't
// get errors about the certificate being signed by an unknown party.
// Adapted from https://github.com/hashicorp/terraform-aws-vault/blob/141f57642215820ff758200fe63b3a52d7017061/test/vault_helpers.go#L507
Initialize the Vault cluster and unseal each of the nodes by connecting to them over SSH and executing Vault
commands. The reason we use SSH rather than using the Vault client remotely is we want to verify that the
self-signed TLS certificate is properly configured on each server so when you're on that server, you don't
get errors about the certificate being signed by an unknown party.
// Initialize the Vault cluster and unseal each of the nodes by connecting to them over SSH and executing Vault // commands . The reason we use SSH rather than using the Vault client remotely is we want to verify that the // self - signed TLS certificate is properly configured on each server so when you ' re on that server you don ' t // get errors about the certificate being signed by an unknown party . // Adapted from https : // github . com / hashicorp / terraform - aws - vault / blob / 141f57642215820ff758200fe63b3a52d7017061 / test / vault_helpers . go#L507
func initializeAndUnsealVaultCluster(t *testing.T, projectId string, region string, instanceGroupName string, sshUserName string, sshKeyPair *ssh.KeyPair, bastionHost *ssh.Host) *VaultCluster {
	cluster := findVaultClusterNodes(t, projectId, region, instanceGroupName, sshUserName, sshKeyPair, bastionHost)
	verifyCanSsh(t, cluster, bastionHost)
	assertAllNodesBooted(t, cluster, bastionHost)
	initOutput := initializeVault(t, cluster, bastionHost)
	cluster.UnsealKeys = parseUnsealKeysFromVaultInitResponse(t, initOutput)
	assertNodeStatus(t, cluster.Leader, bastionHost, Sealed)
	unsealNode(t, cluster.Leader, bastionHost, cluster.UnsealKeys)
	assertNodeStatus(t, cluster.Leader, bastionHost, Leader)
	assertNodeStatus(t, cluster.Standby1, bastionHost, Sealed)
	unsealNode(t, cluster.Standby1, bastionHost, cluster.UnsealKeys)
	assertNodeStatus(t, cluster.Standby1, bastionHost, Standby)
	assertNodeStatus(t, cluster.Standby2, bastionHost, Sealed)
	unsealNode(t, cluster.Standby2, bastionHost, cluster.UnsealKeys)
	assertNodeStatus(t, cluster.Standby2, bastionHost, Standby)
	return cluster
}
func initializeAndUnsealVaultCluster ( t * testing . T , projectId string , region string , instanceGroupName string , sshUserName string , sshKeyPair * ssh . KeyPair , bastionHost * ssh . Host ) * VaultCluster { cluster := findVaultClusterNodes ( t , projectId , region , instanceGroupName , sshUserName , sshKeyPair , bastionHost ) verifyCanSsh ( t , cluster , bastionHost ) assertAllNodesBooted ( t , cluster , bastionHost ) initOutput := initializeVault ( t , cluster , bastionHost ) cluster . UnsealKeys = parseUnsealKeysFromVaultInitResponse ( t , initOutput ) assertNodeStatus ( t , cluster . Leader , bastionHost , Sealed ) unsealNode ( t , cluster . Leader , bastionHost , cluster . UnsealKeys ) assertNodeStatus ( t , cluster . Leader , bastionHost , Leader ) assertNodeStatus ( t , cluster . Standby1 , bastionHost , Sealed ) unsealNode ( t , cluster . Standby1 , bastionHost , cluster . UnsealKeys ) assertNodeStatus ( t , cluster . Standby1 , bastionHost , Standby ) assertNodeStatus ( t , cluster . Standby2 , bastionHost , Sealed ) unsealNode ( t , cluster . Standby2 , bastionHost , cluster . UnsealKeys ) assertNodeStatus ( t , cluster . Standby2 , bastionHost , Standby ) return cluster }
Initialize the Vault cluster and unseal each of the nodes by connecting to them over SSH and executing Vault
commands.
Initialize the Vault cluster and unseal each of the nodes by connecting to them over SSH and executing Vault commands .