-
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
Add support docdb subnet group resource #7106
Add support docdb subnet group resource #7106
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.
@kterada0509 great work! Few little things then this will be ready.
|
||
var subnetGroups []*docdb.DBSubnetGroup | ||
if err := conn.DescribeDBSubnetGroupsPages(&describeOpts, func(resp *docdb.DescribeDBSubnetGroupsOutput, lastPage bool) bool { | ||
for _, v := range resp.DBSubnetGroups { |
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 believe this can be simplified to subnetGroups = append(subnetGroups, resp.DBSubnetGroups...)
and will be flagged shortly when we enable the gosimple
linter 👍
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.
Fixed.
}) | ||
|
||
if err != nil { | ||
log.Printf("[DEBUG] Error retrieving tags for ARN: %s", aws.StringValue(subnetGroup.DBSubnetGroupArn)) |
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.
We should return an error instead of logging a debug message here. 👍
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.
Fixed.
tags := tagsFromMapDocDB(d.Get("tags").(map[string]interface{})) | ||
|
||
subnetIdsSet := d.Get("subnet_ids").(*schema.Set) | ||
subnetIds := make([]*string, subnetIdsSet.Len()) |
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: We have a helper function to simplify Type: schema.TypeSet
-> []*string
:
subnetIds := expandStringSet(d.Get("subnet_ids").(*schema.Set))
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.
Fixed.
} | ||
ns := n.(*schema.Set) | ||
|
||
var sIds []*string |
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: Same here, we can use expandStringSet()
to simplify this logic
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.
Fixed.
@bflad |
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.
LGTM, thanks @kterada0509! 🚀
--- PASS: TestAccAWSDocDBSubnetGroup_disappears (7.86s)
--- PASS: TestAccAWSDocDBSubnetGroup_namePrefix (8.08s)
--- PASS: TestAccAWSDocDBSubnetGroup_basic (8.11s)
--- PASS: TestAccAWSDocDBSubnetGroup_generatedName (8.19s)
--- PASS: TestAccAWSDocDBSubnetGroup_updateDescription (12.58s)
This has been released in version 1.56.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! |
Reference #7077
Changes proposed in this pull request:
aws_docdb_subnet_group
resourceOutput from acceptance testing: