Skip to content
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

Conversation

teraken0509
Copy link
Contributor

@teraken0509 teraken0509 commented Jan 10, 2019

Reference #7077

Changes proposed in this pull request:

  • Add aws_docdb_subnet_group resource

Output from acceptance testing:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSDocDBSubnetGroup_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -parallel 20 -run=TestAccAWSDocDBSubnetGroup_ -timeout 120m
=== RUN   TestAccAWSDocDBSubnetGroup_basic
=== PAUSE TestAccAWSDocDBSubnetGroup_basic
=== RUN   TestAccAWSDocDBSubnetGroup_disappears
=== PAUSE TestAccAWSDocDBSubnetGroup_disappears
=== RUN   TestAccAWSDocDBSubnetGroup_namePrefix
=== PAUSE TestAccAWSDocDBSubnetGroup_namePrefix
=== RUN   TestAccAWSDocDBSubnetGroup_generatedName
=== PAUSE TestAccAWSDocDBSubnetGroup_generatedName
=== RUN   TestAccAWSDocDBSubnetGroup_updateDescription
=== PAUSE TestAccAWSDocDBSubnetGroup_updateDescription
=== CONT  TestAccAWSDocDBSubnetGroup_basic
=== CONT  TestAccAWSDocDBSubnetGroup_generatedName
=== CONT  TestAccAWSDocDBSubnetGroup_updateDescription
=== CONT  TestAccAWSDocDBSubnetGroup_namePrefix
=== CONT  TestAccAWSDocDBSubnetGroup_disappears
--- PASS: TestAccAWSDocDBSubnetGroup_disappears (47.81s)
--- PASS: TestAccAWSDocDBSubnetGroup_namePrefix (52.62s)
--- PASS: TestAccAWSDocDBSubnetGroup_generatedName (52.97s)
--- PASS: TestAccAWSDocDBSubnetGroup_basic (53.05s)
--- PASS: TestAccAWSDocDBSubnetGroup_updateDescription (80.22s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws    80.284s

@ghost ghost added size/XL Managed by automation to categorize the size of a PR. provider Pertains to the provider itself, rather than any interaction with AWS. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. documentation Introduces or discusses updates to documentation. labels Jan 10, 2019
@bflad bflad added new-resource Introduces a new resource. service/docdb Issues and PRs that pertain to the docdb service. labels Jan 10, 2019
Copy link
Contributor

@bflad bflad left a 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. :shipit:


var subnetGroups []*docdb.DBSubnetGroup
if err := conn.DescribeDBSubnetGroupsPages(&describeOpts, func(resp *docdb.DescribeDBSubnetGroupsOutput, lastPage bool) bool {
for _, v := range resp.DBSubnetGroups {
Copy link
Contributor

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 👍

Copy link
Contributor Author

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))
Copy link
Contributor

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. 👍

Copy link
Contributor Author

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())
Copy link
Contributor

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))

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Jan 10, 2019
@teraken0509
Copy link
Contributor Author

@bflad
Thanks.
I fixed your reviews.

Copy link
Contributor

@bflad bflad left a 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)

@bflad bflad added this to the v1.56.0 milestone Jan 11, 2019
@bflad bflad merged commit 0645585 into hashicorp:master Jan 11, 2019
bflad added a commit that referenced this pull request Jan 11, 2019
@bflad
Copy link
Contributor

bflad commented Jan 16, 2019

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.

@teraken0509 teraken0509 deleted the feature/add-support-docdb-subnet-group-resource branch March 5, 2020 14:03
@ghost
Copy link

ghost commented Mar 5, 2020

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!

@ghost ghost locked and limited conversation to collaborators Mar 5, 2020
@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Mar 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. new-resource Introduces a new resource. provider Pertains to the provider itself, rather than any interaction with AWS. service/docdb Issues and PRs that pertain to the docdb service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants