-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
New Data Source: aws_workspaces_bundle #3243
New Data Source: aws_workspaces_bundle #3243
Conversation
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.
Hi @atsushi-ishibashi 👋 Thanks for submitting this. I left you some initial feedback below. Can you please take a look and let us know if you have any questions or do not have time to implement the feedback? Thanks!
"name": *bundle.ComputeType.Name, | ||
} | ||
ct := []map[string]interface{}{r} | ||
d.Set("compute_type", ct) |
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.
When using d.Set()
with aggregate types (TypeList, TypeSet, TypeMap), we should perform error checking to prevent issues where the code is not properly able to set the Terraform state. e.g.
if err := d.Set("compute_type", ct); err != nil {
return fmt.Errorf("error setting compute_type: %s", err)
}
This also needs to be repeated for root_storage
and user_storage
below.
d.Set("owner", bundle.Owner) | ||
if bundle.ComputeType != nil { | ||
r := map[string]interface{}{ | ||
"name": *bundle.ComputeType.Name, |
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.
To prevent potential panics, we should prefer to use the SDK provided function for dereferencing values (e.g. aws.StringValue(bundle.ComputeType.Name)
) instead of directly dereferencing via *
This needs to be repeated for bundle.RootStorage.Capacity
and bundle.UserStorage.Capacity
below as well.
Get information on a Workspaces Bundle. | ||
--- | ||
|
||
# aws_workspaces_bundle |
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.
Most likely a change that occurred after the creation of this pull request, but can you please prepend the title with Data Source:
, e.g. Data Source: aws_workspaces_bundle
"bundle_id": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, |
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.
ForceNew
is not required for data sources and should be removed from this attribute and the documentation.
@@ -206,6 +207,7 @@ type AWSClient struct { | |||
athenaconn *athena.Athena | |||
dxconn *directconnect.DirectConnect | |||
mediastoreconn *mediastore.MediaStore | |||
wsconn *workspaces.WorkSpaces |
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.
Minor nitpick: to prevent any confusion with other services, we should probably name this workspacesconn
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 PR is being merged in with feedback addressed in f370c28 🚀
--- PASS: TestAccDataSourceAwsWorkspaceBundle_basic (8.84s)
``` --- PASS: TestAccDataSourceAwsWorkspaceBundle_basic (8.84s) ```
This has been released in version 1.40.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This may be useful for #1917