-
Notifications
You must be signed in to change notification settings - Fork 137
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: create resource to manage oauth2 clients #488
Conversation
e266267
to
0633cc7
Compare
0633cc7
to
1ecfef2
Compare
ovh/data_me_api_oauth2_client.go
Outdated
Description: "Client ID for the oauth2 client, generated during the resource creation.", | ||
Required: true, | ||
}, | ||
"client_secret": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this field should be in the datasource as it can only be returned when creating an oAuth2 client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking we could use this field to specify a data source with an existing client_secret. Do you think this use case is enough? If not I can remove it from the data source and document it better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the proper way for this would be to import a resource instead. You could declare a custom import function that would be used like this: terraform import ovh_me_api_oauth2_client "$id|$client_secret"
or using a variable like this: terraform import -var "client_secret=$client_secret" ovh_me_api_oauth2_client
.
(See doc here: https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework/providers-plugin-framework-resource-import)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the quick answer, I just pushed an edit for the resources to be importable with a client_secret as you suggested, and removed the field from the data source:
terraform import ovh_me_api_oauth2_client 'client_id|client_secret'
Co-authored-by: Amstutz Arthur <[email protected]>
Co-authored-by: Amstutz Arthur <[email protected]>
… remove client_secret from data source
Description
This PR adds support for the OAuth2 clients service accounts. API Docs
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
make test
TF_ACC=1 go test -run '^TestAccMeApiOauth2.*$' $(go list ./... |grep -v 'vendor') -v
Test Configuration:
terraform version
: Terraform vx.y.zChecklist:
go mod vendor
if I added or modifygo.mod
file