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

Add bootstrap field to Consul backend resources #1571

Merged
merged 12 commits into from Aug 11, 2022

Conversation

robmonte
Copy link
Member

@robmonte robmonte commented Aug 8, 2022

This change adds a new field named bootstrap to Consul backend resources. This will be to designate when a Consul resource is the holder of the Consul ACL bootstrap token. This field has some rules when used in combination with the token field.

If a resource is used to bootstrap Consul by not providing a token, then bootstrap must be set to true:

resource "vault_consul_secret_backend" "consul" {
  path        = "consul"
  address     = "http://127.0.0.1:8500"
  bootstrap = true
}

When creating a backend resource, the absence of both bootstrap = true and a token generates the following error:

Error: field `bootstrap` must be set to true when `token` is unspecified

When creating a backend resource, the presence of both bootstrap = true and a token will give a different error:

Error: field `bootstrap` must be set to false when `token` is specified

Release note for CHANGELOG:

BUG FIXES:
* Add 'bootstrap' field to Consul backend resources to help users identify them easier

Output from acceptance testing:

❯ make testacc TESTARGS='-run=^TestConsulSecretBackend'            
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test -v -run=^TestConsulSecretBackend -timeout 30m ./...

2022/08/10 23:08:54 [INFO] Using Vault token with the following policies: root
=== RUN   TestConsulSecretBackendRole
--- PASS: TestConsulSecretBackendRole (2.77s)
=== RUN   TestConsulSecretBackendRoleNameFromPath
--- PASS: TestConsulSecretBackendRoleNameFromPath (0.00s)
=== RUN   TestConsulSecretBackendRoleBackendFromPath
--- PASS: TestConsulSecretBackendRoleBackendFromPath (0.00s)
=== RUN   TestConsulSecretBackend
--- PASS: TestConsulSecretBackend (4.29s)
=== RUN   TestConsulSecretBackend_Bootstrap
--- PASS: TestConsulSecretBackend_Bootstrap (4.30s)
PASS
ok      github.com/hashicorp/terraform-provider-vault/vault     11.771s

 

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

@github-actions github-actions bot added the size/M label Aug 8, 2022
@robmonte robmonte requested review from vinay-gopalan, benashz and a team and removed request for a team August 9, 2022 18:46
vault/resource_consul_secret_backend.go Outdated Show resolved Hide resolved
vault/resource_consul_secret_backend.go Outdated Show resolved Hide resolved
vault/resource_consul_secret_backend.go Outdated Show resolved Hide resolved
@benashz benashz added this to the 3.8.2 milestone Aug 10, 2022
Copy link
Contributor

@benashz benashz left a comment

Choose a reason for hiding this comment

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

A few nits, suggestions to address then 👍

vault/resource_consul_secret_backend.go Outdated Show resolved Hide resolved
vault/resource_consul_secret_backend.go Show resolved Hide resolved
vault/resource_consul_secret_backend.go Outdated Show resolved Hide resolved
vault/resource_consul_secret_backend.go Outdated Show resolved Hide resolved
vault/resource_consul_secret_backend_test.go Outdated Show resolved Hide resolved
vault/resource_consul_secret_backend_test.go Outdated Show resolved Hide resolved
vault/resource_consul_secret_backend_test.go Outdated Show resolved Hide resolved
website/docs/r/consul_secret_backend.html.md Show resolved Hide resolved
website/docs/r/consul_secret_backend.html.md Outdated Show resolved Hide resolved
website/docs/r/consul_secret_backend.html.md Outdated Show resolved Hide resolved
vault/resource_consul_secret_backend_test.go Outdated Show resolved Hide resolved
vault/resource_consul_secret_backend_test.go Outdated Show resolved Hide resolved
vault/resource_consul_secret_backend_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@benashz benashz left a comment

Choose a reason for hiding this comment

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

LGTM!

@vinay-gopalan vinay-gopalan merged commit b36a844 into main Aug 11, 2022
@vinay-gopalan vinay-gopalan deleted the VAULT-7497-consul-bootstrap-resource branch August 11, 2022 20:56
marcboudreau pushed a commit to marcboudreau/terraform-provider-vault that referenced this pull request Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants