-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
ds/servicecatalog_portfolio: New data source #19500
Conversation
.changelog/19500.txt
Outdated
@@ -0,0 +1,3 @@ | |||
```release-notes:new-data-source |
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.
```release-notes:new-data-source | |
```release-note:new-data-source |
Provides information for a Service Catalog Portfolio. | ||
--- | ||
|
||
# Data source: aws_servicecatalog_portfolio |
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.
Nit: looks like the majority of our ds use the capital letter
# Data source: aws_servicecatalog_portfolio | |
# Data Source: aws_servicecatalog_portfolio |
|
||
The following arguments are required: | ||
|
||
* `id` - (Optional) Portfolio identifier. |
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.
* `id` - (Optional) Portfolio identifier. | |
* `id` - (Required) Portfolio identifier. |
output, err := conn.DescribePortfolio(input) | ||
|
||
if err != nil { | ||
return fmt.Errorf("error getting Service Catalog Portfolio: %w", err) |
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.
Could also be helpful to include the id here in cases users have multiple of these data sources
return fmt.Errorf("error getting Service Catalog Portfolio: %w", err) | |
return fmt.Errorf("error getting Service Catalog Portfolio (%s): %w", d.Get("id").(string), err) |
} | ||
|
||
if output == nil || output.PortfolioDetail == nil { | ||
return fmt.Errorf("error getting Service Catalog Portfolio: empty response") |
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.
similar comment as above
if err := d.Set("created_time", detail.CreatedTime.Format(time.RFC3339)); err != nil { | ||
log.Printf("[DEBUG] Error setting created_time: %s", err) | ||
} |
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.
not sure what the norm for these are, but just mentioning that i've also seen a non-error in-line usage e.g. aws.TimeValue(detail.CreatedTime).Format(time.RFC3339)
that could be used here in place. do you think we'll miss the debug log though?
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.
Just a couple small comments, otherwise LGTM
Output of acceptance test:
--- PASS: TestAccAWSServiceCatalogPortfolioDataSource_basic (18.49s)
af61985
to
d6c006a
Compare
This functionality has been released in v3.46.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Relates #15369
Relates #18074
Relates #1694
Output from acceptance testing (
us-west-2
):Output from acceptance testing (GovCloud):