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

Added vault_database_secret_backend_static_role resource #577

Conversation

martinssipenko
Copy link
Contributor

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

Description

This change provides new resource to manage Vaults database secret engine static roles.

https://www.vaultproject.io/api/secret/databases/index.html#create-static-role

Release note for CHANGELOG:

Adds a resource for the "/database/static-roles/{name}" endpoint (#577).

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccDatabaseSecretBackendStaticRole'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccDatabaseSecretBackendStaticRole -timeout 120m
?     github.com/terraform-providers/terraform-provider-vault [no test files]
?     github.com/terraform-providers/terraform-provider-vault/cmd/coverage  [no test files]
testing: warning: no tests to run
PASS
ok    github.com/terraform-providers/terraform-provider-vault/util  (cached) [no tests to run]
=== RUN   TestAccDatabaseSecretBackendStaticRole_import
--- PASS: TestAccDatabaseSecretBackendStaticRole_import (0.22s)
=== RUN   TestAccDatabaseSecretBackendStaticRole_basic
--- PASS: TestAccDatabaseSecretBackendStaticRole_basic (0.30s)
PASS
ok    github.com/terraform-providers/terraform-provider-vault/vault 0.544s

@tyrannosaurus-becks tyrannosaurus-becks self-assigned this Oct 29, 2019
Copy link
Contributor

@tyrannosaurus-becks tyrannosaurus-becks left a comment

Choose a reason for hiding this comment

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

@martinssipenko this looks great, thank you for contributing this. Just a couple minor discussion topics.

@martinssipenko
Copy link
Contributor Author

After trying to change rotation_statements to be optional, I now get the following error when running acceptance test. @tyrannosaurus-becks perhaps you can help me out here?

make testacc TESTARGS='-run=TestAccDatabaseSecretBackendStaticRole'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccDatabaseSecretBackendStaticRole -timeout 120m
?   	github.com/terraform-providers/terraform-provider-vault	[no test files]
?   	github.com/terraform-providers/terraform-provider-vault/cmd/coverage	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-vault/util	(cached) [no tests to run]
=== RUN   TestAccDatabaseSecretBackendStaticRole_import
--- FAIL: TestAccDatabaseSecretBackendStaticRole_import (3.70s)
    testing.go:569: Step 0 error: errors during apply:
        
        Error: error creating static role "staticrole-2970162460807754599" for backend "tf-test-db-6356817738787049945": Error making API request.
        
        URL: PUT http://127.0.0.1:8200/v1/tf-test-db-6356817738787049945/static-roles/staticrole-2970162460807754599
        Code: 500. Errors:
        
        * 1 error occurred:
        	* error setting credentials: empty rotation statements
        
        
        
          on /var/folders/md/52wjnhf54x50bjskcyvbpjkm0000gn/T/tf-test162060127/main.tf line 17:
          (source code not available)
        
        
=== RUN   TestAccDatabaseSecretBackendStaticRole_basic
--- FAIL: TestAccDatabaseSecretBackendStaticRole_basic (3.27s)
    testing.go:569: Step 0 error: errors during apply:
        
        Error: error creating static role "staticrole-3847025391580588612" for backend "tf-test-db-795078128907647134": Error making API request.
        
        URL: PUT http://127.0.0.1:8200/v1/tf-test-db-795078128907647134/static-roles/staticrole-3847025391580588612
        Code: 500. Errors:
        
        * 1 error occurred:
        	* error setting credentials: empty rotation statements
        
        
        
          on /var/folders/md/52wjnhf54x50bjskcyvbpjkm0000gn/T/tf-test018150633/main.tf line 17:
          (source code not available)
        
        
FAIL
FAIL	github.com/terraform-providers/terraform-provider-vault/vault	7.519s
make: *** [testacc] Error 1

* master:
  Update vault/data_source_aws_access_credentials.go
  Document data attribute
  changes from feedback
  wait longer for AWS creds to propagate
  Correct bad markdown
* master:
  fix code blocks formatting and vault_azure_secret_* links titles (hashicorp#588)
  Update CHANGELOG.md
  Add information about Vault 1.2 for `token_*` fields (hashicorp#565)
  Fix grammar
  Add missing docs for `identity_group_policies`
  Fix missing quote that breaks documentation rendering.
  repushing
  Adding sidebar link to crl_config
  Add whitelines to address hanging "```"
  Added pull request template
@martinssipenko
Copy link
Contributor Author

Changed acceptance tests to use MySQL, after which they pass:

make testacc TESTARGS='-run=TestAccDatabaseSecretBackendStaticRole'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccDatabaseSecretBackendStaticRole -timeout 120m
?   	github.com/terraform-providers/terraform-provider-vault	[no test files]
?   	github.com/terraform-providers/terraform-provider-vault/cmd/coverage	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/terraform-providers/terraform-provider-vault/util	(cached) [no tests to run]
=== RUN   TestAccDatabaseSecretBackendStaticRole_import
--- PASS: TestAccDatabaseSecretBackendStaticRole_import (0.21s)
=== RUN   TestAccDatabaseSecretBackendStaticRole_basic
--- PASS: TestAccDatabaseSecretBackendStaticRole_basic (0.28s)
PASS
ok  	github.com/terraform-providers/terraform-provider-vault/vault	1.013s

Copy link
Contributor

@tyrannosaurus-becks tyrannosaurus-becks left a comment

Choose a reason for hiding this comment

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

Thank you! Perfect!

@tyrannosaurus-becks tyrannosaurus-becks merged commit f01318a into hashicorp:master Oct 31, 2019
@martinssipenko martinssipenko deleted the vault_database_secret_backend_static_role branch October 31, 2019 16:18
dandandy pushed a commit to dandandy/terraform-provider-vault that referenced this pull request Jun 17, 2021
…ecret_backend_static_role

Added vault_database_secret_backend_static_role resource
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.

2 participants