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

New Resource: vault_gcp_auth_backend_role #124

Merged

Conversation

angrylogic
Copy link
Contributor

This PR enables managment of Vault GCP Auth backend roles.

@petems
Copy link
Contributor

petems commented Jun 20, 2018

@angrylogic I've been using this fork for a bit, works well! 😄

Have you thought about extending it to also configure the GCP auth config as well? So actually giving it the credentials file: https://www.vaultproject.io/api/auth/gcp/index.html#configure

So doing this step but with Terraform:

vault auth enable 'gcp'
vault write auth/gcp/config credentials=@vault_auth_checker_credentials.json

Then, you could do the entire process of Vault in GCP with Terraform:

resource "vault_auth_backend" "gcp" {
    path = "gcp"
    type = "gcp"
}

resource "google_service_account_key" "vault_auth_checker_credentials" {
  service_account_id = "${google_service_account.vault_auth_checker.name}"
  public_key_type = "TYPE_X509_PEM_FILE"
}

resource "vault_auth_backend_gcp_config" gcp {
   credentials = "${base64decode(google_service_account_key.vault_auth_checker_credentials.private_key)}"
}

@fatmcgav
Copy link
Contributor

We're interested in this aswell... Any plans to get this merged?

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.

This looks great! Thank you for writing it.

Would you be willing to merge in and push the latest master branch? If the tests pass, with that one change I'd be happy to approve and merge this PR.


log.Printf("[DEBUG] Writing role %q to GCP auth backend", path)
_, err := client.Logical().Write(path, data)
d.SetId(path)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to move this up a line so it's not between the err and the err check?

@tyrannosaurus-becks tyrannosaurus-becks self-assigned this Sep 14, 2018
angrylogic and others added 2 commits September 17, 2018 17:07
This PR enables managment of Vault GCP Auth backend roles.
* Remove the explicit *schema.Schema calls.
* Move the SetId out from between the error checking.
@angrylogic angrylogic force-pushed the resource_gcp_auth_backend_role branch from a235a13 to 3df010a Compare September 17, 2018 21:10
@ghost ghost added the size/L label Sep 17, 2018
@angrylogic
Copy link
Contributor Author

@tyrannosaurus-becks -- rebased and addressed feedback in this one as well.

Tests passing for me:

$ go test -test.v -run TestGCPAuthBackendRole_basic
=== RUN   TestGCPAuthBackendRole_basic
--- PASS: TestGCPAuthBackendRole_basic (0.18s)
PASS
ok      github.com/terraform-providers/terraform-provider-vault/vault   0.300s

Thanks!

@ghost ghost added the size/L label Sep 17, 2018
@tyrannosaurus-becks tyrannosaurus-becks merged commit 2718e1e into hashicorp:master Sep 17, 2018
dandandy pushed a commit to dandandy/terraform-provider-vault that referenced this pull request Jun 17, 2021
…ckend_role

New Resource: vault_gcp_auth_backend_role
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.

5 participants