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

provider/vault: vault_auth_backend resource #10988

Merged
merged 1 commit into from
May 3, 2017

Conversation

Mongey
Copy link
Contributor

@Mongey Mongey commented Jan 2, 2017

mitchellh/mapstructure bump is needed to handle a conversion fromjson.Number to int in vault/api

@apparentlymart
Copy link
Contributor

Hi @Mongey! Thanks for implementing this.

Am I understanding correctly that this is for enabling Vault auth backends? If so, I'd like to suggest to call it vault_auth_backend rather than just vault_auth. It feels clearer to me to use a count noun here, so we can describe what this does as "enable an auth backend" rather than just "enable an auth".

One other bit of design feedback is that although by default Vault will mount a given auth backend at a path whose name matches the backend name, this is not actually required and it's possible to mount the same auth backend multiple times e.g. to support multiple different AWS accounts, or Github organizations. To support that, perhaps we could have an additional optional+computed path argument that gives the path name, with it defaulting to the same value as given in type if not specified.

I didn't have time yet to dig into the code in detail or test it but I will take a look at this more deeply soon.

@apparentlymart apparentlymart self-requested a review January 2, 2017 17:06
@Mongey
Copy link
Contributor Author

Mongey commented Jan 2, 2017

Thanks for the feedback @apparentlymart

If so, I'd like to suggest to call it vault_auth_backend rather than just vault_auth.

💯 I'll update

... it's possible to mount the same auth backend multiple times e.g. to support multiple different AWS accounts, or Github organizations.

Ah cool, I didn't really understand what the path arg was when I was implementing this.

To support that, perhaps we could have an additional optional+computed path argument that gives the path name, with it defaulting to the same value as given in type if not specified.

Makes sense, ^ mimics the behaviour of the vault cli auth-enable command.

@Mongey Mongey changed the title [WIP] provider/vault: vault_auth resource [WIP] provider/vault: vault_auth_backend resource Jan 2, 2017
@Mongey Mongey force-pushed the cm-vault-auth branch 6 times, most recently from 158c4a6 to 85fee47 Compare January 6, 2017 13:29
@Mongey Mongey changed the title [WIP] provider/vault: vault_auth_backend resource provider/vault: vault_auth_backend resource Jan 6, 2017
@jen20
Copy link
Contributor

jen20 commented Jan 23, 2017

Hi @Mongey! There are a few changes that need to be made to this before it can be merged. I'm going to go ahead and pull it down locally to fix it up, and then will open a new PR with the changes.

@jen20 jen20 self-assigned this Jan 23, 2017
@jason-riddle
Copy link
Contributor

Any update on this?

@Mongey
Copy link
Contributor Author

Mongey commented Mar 8, 2017

@stack72 / @apparentlymart 👀 This might need to be re-assigned 😓

@Mongey Mongey unassigned jen20 Mar 8, 2017
@stack72
Copy link
Contributor

stack72 commented Mar 8, 2017

Hi @Mongey

Apologies for this - yes @jen20 no longer works with us :(

Can you rebase it and I will start a review?

Paul

@Mongey
Copy link
Contributor Author

Mongey commented Mar 15, 2017

@stack72 🙇 rebased the conflict away

}
}

// If we fell out here then we didn't find our Auth in the list.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think if we fall out, we should log a message to let the user know that their state has been refreshed - because it wasn't found

@stack72
Copy link
Contributor

stack72 commented Mar 16, 2017

Hi @Mongey

So I just tested this and it works as expected :) When i ran your tests, I could see my Vault log as follows:

2017/03/16 10:41:04.499466 [INFO ] core: enabled credential backend: path=github/ type=github
2017/03/16 10:41:05.030997 [INFO ] core: disabled credential backend: path=github/
2017/03/16 10:41:05.033431 [INFO ] core: enabled credential backend: path=ldap/ type=ldap
2017/03/16 10:41:05.385489 [INFO ] core: disabled credential backend: path=ldap/

The tests are also green:

% make testacc TEST=./builtin/providers/vault                                                      ✭
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/03/16 12:40:55 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/vault -v  -timeout 120m
=== RUN   TestDataSourceGenericSecret
--- PASS: TestDataSourceGenericSecret (0.67s)
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestResourceAuth
--- PASS: TestResourceAuth (1.04s)
=== RUN   TestResourceGenericSecret
--- PASS: TestResourceGenericSecret (0.87s)
=== RUN   TestResourcePolicy
--- PASS: TestResourcePolicy (0.85s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/vault	3.450s

I left 1 minor nit - but that's not worth blocking the PR over :)

Paul

@stack72
Copy link
Contributor

stack72 commented Mar 16, 2017

Also, just a FYI, the failure in the build here is unrelated to this PR. The failure is as follows:

go test -timeout=30s -parallel=4 github.com/hashicorp/terraform/state/remote github.com/hashicorp/terraform/terraform 
ok  	github.com/hashicorp/terraform/state/remote	0.772s
map[string]dag.Vertex{}
"module.middle.module.inner.null"
map[string]dag.Vertex{}
"module.middle.null"
--- FAIL: TestContext2Plan_computedValueInMap (0.01s)
	context_plan_test.go:2994: err: 2 error(s) occurred:
		
		* module.test_mod.var.services: variable services in module test_mod should be type list, got map
		* shadow graph: module.test_mod.var.services: variable services in module test_mod should be type list, got map
map[string]dag.Vertex{}
"aws"
FAIL
FAIL	github.com/hashicorp/terraform/terraform	4.011s
make: *** [test] Error 123

Merging this for now and will speak to the team about the failure

@stack72
Copy link
Contributor

stack72 commented Mar 16, 2017

Actually, will speak to the team first - I believe the test failure is because of the updated vendoring

@apparentlymart apparentlymart removed their request for review April 17, 2017 18:30
@coen-hyde
Copy link

Any progress on this? I'm pretty excited about having more of Vault configured via Terraform. Avoids the custom provisioning scripts.

@Mongey
Copy link
Contributor Author

Mongey commented May 1, 2017

@stack72 looks like mapstructure got updated in another PR. Rebased

@stack72
Copy link
Contributor

stack72 commented May 3, 2017

This LGTM now @Mongey :) Nice work on this!

Paul

@stack72 stack72 merged commit eb4aa9e into hashicorp:master May 3, 2017
@Mongey Mongey deleted the cm-vault-auth branch May 3, 2017 22:20
@leighmhart
Copy link

Sounds interesting! Any docs for this?

@Mongey
Copy link
Contributor Author

Mongey commented May 16, 2017

@allandrick I can follow up with a PR. (This might help in the time being)

@ghost
Copy link

ghost commented Apr 12, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants