Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Feature Request - Allow usernames and passwords too in provider #15

Closed
vikas027 opened this issue Jul 1, 2017 · 3 comments
Closed

Feature Request - Allow usernames and passwords too in provider #15

vikas027 opened this issue Jul 1, 2017 · 3 comments

Comments

@vikas027
Copy link

vikas027 commented Jul 1, 2017

Terraform Version

0.9.8

Problem

As of now, the provider takes Rancher Access and Secret Keys. This is good, but an assumption is that we already have a Rancher Master running.

I am building out Rancher Masters (on AWS) with Local Auth enabled through terraform and I cannot use this provider unless I find out the keys using curl (by providing a username and a password). I could have figured out the keys dynamically if I would have a functionality to capture variables from provisioners/scripts.

Probable Solution

Terraform provider finds the access and secret keys itself and use it to interact with Rancher Master.

Workaround

I am not sure if there is any. Is there one?

References

@mcanevet
Copy link
Contributor

@vikas027 I can't figure out how you can have access to API keys without explicitly generate a pair. What Cattle API endpoint would you use to get API keys from user/password credentials?

@vikas027
Copy link
Author

@mcanevet I would do something like this to generate a token

  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  --data "{\"code\":\"${rancher_user}:${rancher_password}\",\"authProvider\":\"localauthconfig\"}" | jq -r .jwt

and this to generate API Keys

  -H "Authorization: Bearer ${TOKEN}" \
  -H 'Accept: application/json' \
  -X POST  --data {"type":"apikey"} | jq -r '. | .publicValue , .secretValue'

It would be great if we can do this at the backend by just providing the Rancher username and password to terraform.

@mcanevet
Copy link
Contributor

@vikas027 I'm not sure this is a common usage of Terraform...
All the provider I'm using takes API keys and not use/password credentials.
I don't know why this provider should be different.
I'm closing this as WONTFIX now.
Feel free to comment or provider a PR for this feature.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants