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

New Datasource: aws_network_interface #2316

Merged
merged 2 commits into from
Dec 4, 2017

Conversation

atsushi-ishibashi
Copy link
Contributor

#2306

make testacc TEST=./aws TESTARGS='-run=TestAccDataSourceAwsNetworkInterface_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccDataSourceAwsNetworkInterface_basic -timeout 120m
=== RUN   TestAccDataSourceAwsNetworkInterface_basic
--- PASS: TestAccDataSourceAwsNetworkInterface_basic (65.61s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	66.025s

@radeksimko radeksimko added the new-data-source Introduces a new data source. label Nov 16, 2017
page_title: "AWS: aws_network_interface"
sidebar_current: "docs-aws-datasource-network-interface"
description: |-
Get information on anNetwork Interface resource.

Choose a reason for hiding this comment

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

on a Network Interface

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Hey @atsushi-ishibashi
thanks for the PR.

I left you some comments there, the most important ones about schema (List vs Set). Let me know what you think. The code looks otherwise good and tests are passing.

Required: true,
},
"association": &schema.Schema{
Type: schema.TypeSet,
Copy link
Member

Choose a reason for hiding this comment

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

Since there's only ever going to be a single association I think this field should be TypeList so it's possible to reference it like data.aws_network_interface.name.association.0.public_ip etc.

},
},
"attachment": &schema.Schema{
Type: schema.TypeSet,
Copy link
Member

Choose a reason for hiding this comment

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

Since there's only ever going to be a single attachment I think this field should be TypeList so it's possible to reference it like data.aws_network_interface.name.attachment.0.instance_id etc.

Computed: true,
},
"private_ips": &schema.Schema{
Type: schema.TypeSet,
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to keep this list of IPs Set? It looks like a field people would like to reference and Set would prevent them in doing so due to computed index. That said I'm not sure if the ordering of IPs has any meaning - i.e. if they're sorted by networking interfaces (primary first, then others)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used Set because I thought the ordering has no meaning.
I agree with your suggestion👍

return fmt.Errorf("no matching network interface found")
}
if len(resp.NetworkInterfaces) > 1 {
return fmt.Errorf("multiple network interfaces matched")
Copy link
Member

Choose a reason for hiding this comment

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

Do you mind improving the error message here to also include the ID we looked for? e.g. multiple network interfaces matched %s", d.Id()

@radeksimko radeksimko added the waiting-response Maintainers are waiting on response from community or contributor. label Dec 2, 2017
@atsushi-ishibashi
Copy link
Contributor Author

make testacc TEST=./aws TESTARGS='-run=TestAccDataSourceAwsNetworkInterface_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccDataSourceAwsNetworkInterface_basic -timeout 120m
=== RUN   TestAccDataSourceAwsNetworkInterface_basic
--- PASS: TestAccDataSourceAwsNetworkInterface_basic (95.81s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	95.852s

@radeksimko radeksimko removed the waiting-response Maintainers are waiting on response from community or contributor. label Dec 4, 2017
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@radeksimko radeksimko merged commit 401dc01 into hashicorp:master Dec 4, 2017
mdlavin pushed a commit to mdlavin/terraform-provider-aws that referenced this pull request Dec 9, 2017
* New Datasource: aws_network_interface

* Reflect reviews
@ghost
Copy link

ghost commented Apr 10, 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 Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-data-source Introduces a new data source.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants