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

Jwt auth import #806

Merged
merged 5 commits into from
Jul 1, 2020
Merged

Jwt auth import #806

merged 5 commits into from
Jul 1, 2020

Conversation

catsby
Copy link
Contributor

@catsby catsby commented Jun 29, 2020

Fixes #295 . This resource uses path for the ID, but because(?) it's a ForceNew attribute it was never read from the API. Attempting to import uses an ID input, but the path that was used for the READ operation was empty so no data was found. This will set the path to the Id() value if path is not found, so the READ should succeed.

In order to import without changes needed, this PR also sets tune and type information.

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

Relates OR Closes #295

Release note for CHANGELOG:

- Update jwt_auth_backed to enable importing existing backends. 
- Update jwt_auth_backed to read `type` and `tune` information

Output from acceptance testing:

[terraform-provider-vault][jwt_auth_import](4)$ make testacc TESTARGS='-run=TestAccJWT'                                                                                         ✭
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccJWT -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   TestAccJWTAuthBackendRole_import
--- PASS: TestAccJWTAuthBackendRole_import (0.14s)
=== RUN   TestAccJWTAuthBackendRole_basic
--- PASS: TestAccJWTAuthBackendRole_basic (0.11s)
=== RUN   TestAccJWTAuthBackendRole_update
--- PASS: TestAccJWTAuthBackendRole_update (0.18s)
=== RUN   TestAccJWTAuthBackendRole_full
--- PASS: TestAccJWTAuthBackendRole_full (0.11s)
=== RUN   TestAccJWTAuthBackendRoleOIDC_full
--- PASS: TestAccJWTAuthBackendRoleOIDC_full (0.83s)
=== RUN   TestAccJWTAuthBackendRole_fullUpdate
--- PASS: TestAccJWTAuthBackendRole_fullUpdate (0.19s)
=== RUN   TestAccJWTAuthBackendRole_fullDeprecated
--- PASS: TestAccJWTAuthBackendRole_fullDeprecated (0.19s)
=== RUN   TestAccJWTAuthBackend
--- PASS: TestAccJWTAuthBackend (0.96s)
=== RUN   TestAccJWTAuthBackend_OIDC
--- PASS: TestAccJWTAuthBackend_OIDC (0.22s)
=== RUN   TestAccJWTAuthBackend_negative
--- PASS: TestAccJWTAuthBackend_negative (0.03s)
=== RUN   TestAccJWTAuthBackend_missingMandatory
--- PASS: TestAccJWTAuthBackend_missingMandatory (0.55s)
PASS
ok      github.com/terraform-providers/terraform-provider-vault/vault   3.773s


...

@ghost ghost added the size/S label Jun 29, 2020
Copy link
Member

@tvoran tvoran left a comment

Choose a reason for hiding this comment

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

Just some wondering about the log formatting, non-blocking.

vault/resource_jwt_auth_backend.go Outdated Show resolved Hide resolved
vault/auth_mount.go Outdated Show resolved Hide resolved
catsby and others added 2 commits July 1, 2020 06:47
@catsby catsby merged commit c3e2710 into master Jul 1, 2020
@jasonodonnell jasonodonnell deleted the jwt_auth_import branch July 27, 2020 14:48
dandandy pushed a commit to dandandy/terraform-provider-vault that referenced this pull request Jun 17, 2021
* Add authMountTuneGet function to return tune information of a mount

* refactor to use new authMountTuneGet function

* Add Import for JWT auth backend. Also set's path, type, and tune options on READ

* Update vault/auth_mount.go

Co-authored-by: Theron Voran <[email protected]>

* Update vault/resource_jwt_auth_backend.go

Co-authored-by: Theron Voran <[email protected]>

Co-authored-by: Theron Voran <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vault_jwt_auth_backend doesn't support importing
3 participants