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

implement Vault update (public_endpoint only) #152

Merged
merged 8 commits into from
Jun 22, 2021
Merged

Conversation

bcmdarroch
Copy link
Contributor

@bcmdarroch bcmdarroch commented Jun 18, 2021

🛠️ Description

Jumping off @bplotnick's contribution #118, I've implemented the Vault cluster resource Update function to enable updating public_endpoint without forcing the recreation of the cluster.

🏗️ Acceptance tests

  • Are there any feature flags that are required to use this functionality?
  • Have you added an acceptance test for the functionality being added?
  • Have you run the acceptance tests on this branch?

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccVaultCluster'

--- PASS: TestAccVaultCluster (639.36s)

@bcmdarroch bcmdarroch requested a review from a team June 18, 2021 19:38
Copy link
Member

@jfreda jfreda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just nits; actual update code looks good!

DeleteContext: resourceVaultClusterDelete,
Timeouts: &schema.ResourceTimeout{
Create: &createVaultClusterTimeout,
Create: &createUpdateVaultClusterTimeout,
Update: &createUpdateTimeoutDuration,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be &createUpdateVaultClusterTimeout instead of using Consul's value?

Suggested change
Update: &createUpdateTimeoutDuration,
Update: &createUpdateVaultClusterTimeout,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah woops, good spot! Think I'm gonna rename the Consul values to be more specific too

@@ -22,7 +22,7 @@ var defaultVaultClusterTimeout = time.Minute * 5

// createTimeout is the amount of time that can elapse
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit

Suggested change
// createTimeout is the amount of time that can elapse
// createUpdateVaultClusterTimeout is the amount of time that can elapse

resource "hcp_vault_cluster" "test" {
cluster_id = "test-vault-cluster"
hvn_id = hcp_hvn.test.hvn_id
tier = "dev"
tier = "dev"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: looks like a mix of tabs and spaces here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gonna make note of this in our test writing readme.

resource "hcp_vault_cluster" "test" {
cluster_id = "test-vault-cluster"
hvn_id = hcp_hvn.test.hvn_id
tier = "dev"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: looks like a mix of tabs and spaces here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops that just needed a rebase

@@ -85,3 +85,28 @@ func CreateVaultClusterAdminToken(ctx context.Context, client *Client, loc *shar

return resp.Payload, nil
}

// UpdateVaultCluster will make a call to the Vault service to enable or disable public IPs for the Vault cluster.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit

Suggested change
// UpdateVaultCluster will make a call to the Vault service to enable or disable public IPs for the Vault cluster.
// UpdateVaultClusterPublicIps will make a call to the Vault service to enable or disable public IPs for the Vault cluster.

@bcmdarroch bcmdarroch requested a review from a team as a code owner June 22, 2021 21:58
@bcmdarroch bcmdarroch merged commit cef0868 into main Jun 22, 2021
@bcmdarroch bcmdarroch deleted the vault-update branch June 22, 2021 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants