-
Notifications
You must be signed in to change notification settings - Fork 11
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
SCALRCORE-19663 Scalr Provider > Environment data source > Filtering by name #101
Conversation
…esource to obtain environment via terraform.
…ccounts and environment names in those accounts may be the same
* `name` - (Optional) Name of the environment. | ||
* `account_id` - (Optional) ID of the environment account, in the format `acc-<RANDOM STRING>` | ||
|
||
Arguments `id` and `name` are booth optional, but you need to specify at leas one of them to obtain scalr_environment. |
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.
*both and *at least and scalr_evironment
write with monospace font.
All our documentation (and UI in general) doesn't use personalized approach (idk how to name this), therefore try to avoid you
, your
, etc.
scalr/helpers.go
Outdated
return nil, fmt.Errorf("Environment with name '%s' not found", *options.Name) | ||
|
||
case numberOfMatch > 1: | ||
// todo: update the error message. |
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.
don't forget :)
|
||
return environment, nil | ||
switch numberOfMatch := len(matchedEnvironments); { |
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.
Strange switch case
. In theory, numberOfMatch
can not be equal to zero, this case handles code above.
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.
This situation is possible when we have for example 3 environments with names name1
, name2
, and name3
. For example, we are looking for an environment with the name name
. Because of the implementation of the filter on the backend side, we will receive all those environments but neither of them is the right one.
You forgot to update |
scalr/helpers.go
Outdated
var environment *scalr.Environment | ||
type GetEnvironmentByNameOptions struct { | ||
Name *string | ||
Account *string `json:",omitempty"` |
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.
No need to specify json:",omitempty"
, this struct will not be serialized to JSON format
…utes for scalr_environment data resource
Changelog
Documentation
State