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

[feat]: support provider auth with string parameters #45

Closed
ericsyh opened this issue Apr 29, 2024 · 3 comments
Closed

[feat]: support provider auth with string parameters #45

ericsyh opened this issue Apr 29, 2024 · 3 comments
Assignees

Comments

@ericsyh
Copy link
Member

ericsyh commented Apr 29, 2024

Background

For now, the sn terraform provider only supports key_file_path as the provider auth, but for some secture scenarios using the file path means users need to store the file in some places and may have leak risks. So, ideally should support the provider auth with string parametres and support the env parameters to pass.

Solution

We can support sn provider auth with client_id and client_secret.

Usage with provider parameters

provider "streamnative" {
    client_id = "5HITm7RKuV8JlwzAk83lkm4M"
    client_secret = "JJusCALj8xxxxxxxxdAxxxxxxxrEZdC7LyF1AYv5co"
} 

Usage with env parameters

% export STREAMNATIVE_CLIENT_ID="5HITm7RKuV8JlwzAk83lkm4M"
% export STREAMNATIVE_CLIENT_SECRET="JJusCALj8xxxxxxxxdAxxxxxxxrEZdC7LyF1AYv5co"
terraform plan
@saurabh31090
Copy link

saurabh31090 commented Apr 30, 2024

Hi @ericsyh Even after removing the key_file_path from both the provider block and the variable file, when I execute the terraform plan command, it continues to prompt for the key_file_path. Subsequently, when I provide the name of a dummy file, an error occurs indicating that the file's code is incorrect.

Provider block
terraform {
required_providers {
streamnative = {
source = "streamnative/streamnative"
version = "0.2.0"
}

}
}

provider "streamnative" {
client_id = "var.STREAMNATIVE_CLIENT_ID"
client_secret = "var.STREAMNATIVE_CLIENT_SECRET"
client_email = "var.STREAMNATIVE_CLIENT_EMAIL"
}

@ericsyh
Copy link
Member Author

ericsyh commented Apr 30, 2024

Even after removing the key_file_path from both the provider block and the variable file, when I execute the terraform plan command, it continues to prompt for the key_file_path. Subsequently, when I provide the name of a dummy file, an error occurs indicating that the file's code is incorrect.

@saurabh31090 this is a feature plan to implement but not yet supported.

@urfreespace
Copy link
Member

already supported with this PR: #47 @ericsyh PTAL

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

No branches or pull requests

4 participants