terraform-provider-vault icon indicating copy to clipboard operation
terraform-provider-vault copied to clipboard

Add data source for fetching the Vault address from the provider

Open tmatilai opened this issue 2 years ago • 2 comments

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

Add vault_address data source for fetching the URL of the Vault server configured for the provider.

The data source can be useful if the address is configured for the provider with the VAULT_ADDR environment variable, or if the URL is needed in a child module using the provider. In my use case for configuring redirect URLs of an OIDC IdP.

Release note for CHANGELOG:

Add `vault_address` data source for fetching the URL of the Vault server: ([#1566](https://github.com/hashicorp/terraform-provider-vault/pull/1566))

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccDataSourceAddress'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test -v -run=TestAccDataSourceAddress -timeout 30m ./...
?       github.com/hashicorp/terraform-provider-vault   [no test files]
?       github.com/hashicorp/terraform-provider-vault/cmd/coverage      [no test files]
?       github.com/hashicorp/terraform-provider-vault/cmd/generate      [no test files]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/codegen   (cached) [no tests to run]
?       github.com/hashicorp/terraform-provider-vault/generated [no test files]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/generated/datasources/transform/decode    (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/generated/datasources/transform/encode    (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/generated/resources/transform/alphabet    (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/generated/resources/transform/role        (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/generated/resources/transform/template    (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/generated/resources/transform/transformation      (cached) [no tests to run]
?       github.com/hashicorp/terraform-provider-vault/helper    [no test files]
?       github.com/hashicorp/terraform-provider-vault/internal/consts   [no test files]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/internal/identity/entity  (cached) [no tests to run]
?       github.com/hashicorp/terraform-provider-vault/internal/identity/group   [no test files]
?       github.com/hashicorp/terraform-provider-vault/internal/pki      [no test files]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/internal/provider (cached) [no tests to run]
?       github.com/hashicorp/terraform-provider-vault/schema    [no test files]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/testutil  (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-vault/util      (cached) [no tests to run]
2022/08/05 17:01:26 [INFO] Using Vault token with the following policies: admin, default
=== RUN   TestAccDataSourceAddress
--- PASS: TestAccDataSourceAddress (2.47s)
PASS
ok      github.com/hashicorp/terraform-provider-vault/vault     (cached)

tmatilai avatar Aug 05 '22 14:08 tmatilai

CLA assistant check
All committers have signed the CLA.

hashicorp-cla avatar Aug 05 '22 14:08 hashicorp-cla

Any chance that this could be considered/reviewed? 🥺 It would avoid passing the URL as a variable to child modules.

I can rebase onto current master when requested.

tmatilai avatar Nov 15 '23 08:11 tmatilai