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 attributes to the aws_ec2_instance_type data source #40717

Conversation

bakeemawaytoys
Copy link
Contributor

@bakeemawaytoys bakeemawaytoys commented Dec 28, 2024

Description

Added the following attributes to the aws_ec2_instance_type data source to bring it up-to-date with the EC2 API. I tried to follow the data source's established conventions with respect to nullability, naming, and flattening attributes that are nested in the AWS API. One thing I'm not clear on is which type to use for attributes that are collections of strings. I went with sets instead of lists because ordering doesn't make sense nor is it explicitly guaranteed by the AWS API. Existing attributes tended be lists. I can change them to lists if consistency is more important.

As I was updating the documentation, I adjusted some of the descriptions of existing attributes to clarify their data types and/or their expected values. My intent is to reduce the need to cross-reference the data source's documentation with the AWS API documentation in order to understand the attribute values.

  • bandwidth_weightings
  • boot_modes
  • default_network_card_index
  • efa_maximum_interfaces
  • ena_srd_supported
  • inference_accelerators.#.memory_size
  • media_accelerators.#.count
  • media_accelerators.#.manufacturer
  • media_accelerators.#.memory_size
  • media_accelerators.#.name
  • network_cards.#.baseline_bandwidth
  • network_cards.#.index
  • network_cards.#.maximum_interfaces
  • network_cards.#.performance
  • network_cards.#.peak_bandwidth
  • neuron_devices.#.core_count
  • neuron_devices.#.core_version
  • neuron_devices.#.count
  • neuron_devices.#.memory_size
  • neuron_devices.#.name
  • nitro_enclaves_support
  • nitro_tpm_support
  • nitro_tpm_supported_versions
  • phc_support
  • supported_cpu_features
  • total_inference_memory
  • total_media_memory
  • total_neuron_device_memory

Relations

Closes #35640

References

AWS CLI documentation for the describe-instance-type command
AWS EC2 API documentation for the DescribeInstanceTypes action

Output from Acceptance Testing

% make testacc TESTS=TestAccEC2InstanceTypeDataSource  PKG=ec2 

make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2InstanceTypeDataSource'  -timeout 360m
2025/01/04 11:32:42 Initializing Terraform AWS Provider...
=== RUN   TestAccEC2InstanceTypeDataSource_basic
=== PAUSE TestAccEC2InstanceTypeDataSource_basic
=== RUN   TestAccEC2InstanceTypeDataSource_metal
=== PAUSE TestAccEC2InstanceTypeDataSource_metal
=== RUN   TestAccEC2InstanceTypeDataSource_gpu
=== PAUSE TestAccEC2InstanceTypeDataSource_gpu
=== RUN   TestAccEC2InstanceTypeDataSource_fpga
=== PAUSE TestAccEC2InstanceTypeDataSource_fpga
=== RUN   TestAccEC2InstanceTypeDataSource_neuron
=== PAUSE TestAccEC2InstanceTypeDataSource_neuron
=== RUN   TestAccEC2InstanceTypeDataSource_media_accelerator
=== PAUSE TestAccEC2InstanceTypeDataSource_media_accelerator
=== CONT  TestAccEC2InstanceTypeDataSource_basic
=== CONT  TestAccEC2InstanceTypeDataSource_fpga
=== CONT  TestAccEC2InstanceTypeDataSource_media_accelerator
=== CONT  TestAccEC2InstanceTypeDataSource_neuron
=== CONT  TestAccEC2InstanceTypeDataSource_gpu
=== CONT  TestAccEC2InstanceTypeDataSource_metal
--- PASS: TestAccEC2InstanceTypeDataSource_basic (7.70s)
--- PASS: TestAccEC2InstanceTypeDataSource_media_accelerator (7.71s)
--- PASS: TestAccEC2InstanceTypeDataSource_fpga (7.73s)
--- PASS: TestAccEC2InstanceTypeDataSource_neuron (7.77s)
--- PASS: TestAccEC2InstanceTypeDataSource_metal (7.77s)
--- PASS: TestAccEC2InstanceTypeDataSource_gpu (7.77s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ec2        11.975s

Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. service/ec2 Issues and PRs that pertain to the ec2 service. needs-triage Waiting for first response or review from a maintainer. labels Dec 28, 2024
@bakeemawaytoys bakeemawaytoys force-pushed the f-aws_ec2_instance_type-add-missing-attributes branch 6 times, most recently from 71e547f to 54a4d16 Compare January 4, 2025 17:33
@bakeemawaytoys bakeemawaytoys marked this pull request as ready for review January 4, 2025 17:57
@bakeemawaytoys bakeemawaytoys requested a review from a team as a code owner January 4, 2025 17:57
@bakeemawaytoys bakeemawaytoys force-pushed the f-aws_ec2_instance_type-add-missing-attributes branch from 54a4d16 to c419741 Compare January 7, 2025 23:55
@justinretzolk justinretzolk added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 9, 2025
Added the following attributes to the `aws_ec2_instance_type` data source to bring it up-to-date with the EC2 API.

* `bandwidth_weightings`
* `boot_modes`
* `default_network_card_index`
* `efa_maximum_interfaces`
* `inference_accelerators.#.memory_size`
* `media_accelerators.#.count`
* `media_accelerators.#.manufacturer`
* `media_accelerators.#.memory_size`
* `media_accelerators.#.name`
* `network_cards.#.baseline_bandwidth`
* `network_cards.#.index`
* `network_cards.#.maximum_interfaces`
* `network_cards.#.performance`
* `network_cards.#.peak_bandwidth`
* `neuron_devices.#.core_count`
* `neuron_devices.#.count`
* `neuron_devices.#.memory_size`
* `neuron_devices.#.name`
* `neuron_devices.#.version`
* `nitro_enclaves_support`
* `nitro_tpm_support`
* `nitro_tpm_supported_versions`
* `phc_support`
* `srd_supported`
* `supported_cpu_features`
* `total_inference_memory`
* `total_media_memory`
* `total_neuron_device_memory`
@bakeemawaytoys bakeemawaytoys force-pushed the f-aws_ec2_instance_type-add-missing-attributes branch from c419741 to a2e9697 Compare January 10, 2025 20:32
@ewbankkit ewbankkit self-assigned this Jan 12, 2025
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jan 12, 2025
ewbankkit
ewbankkit previously approved these changes Jan 12, 2025
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccEC2InstanceTypeDataSource_' PKG=ec2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/ec2/... -v -count 1 -parallel 20  -run=TestAccEC2InstanceTypeDataSource_ -timeout 360m -vet=off
2025/01/12 17:00:29 Initializing Terraform AWS Provider...
=== RUN   TestAccEC2InstanceTypeDataSource_basic
=== PAUSE TestAccEC2InstanceTypeDataSource_basic
=== RUN   TestAccEC2InstanceTypeDataSource_metal
=== PAUSE TestAccEC2InstanceTypeDataSource_metal
=== RUN   TestAccEC2InstanceTypeDataSource_gpu
=== PAUSE TestAccEC2InstanceTypeDataSource_gpu
=== RUN   TestAccEC2InstanceTypeDataSource_fpga
=== PAUSE TestAccEC2InstanceTypeDataSource_fpga
=== RUN   TestAccEC2InstanceTypeDataSource_neuron
=== PAUSE TestAccEC2InstanceTypeDataSource_neuron
=== RUN   TestAccEC2InstanceTypeDataSource_media_accelerator
=== PAUSE TestAccEC2InstanceTypeDataSource_media_accelerator
=== CONT  TestAccEC2InstanceTypeDataSource_basic
=== CONT  TestAccEC2InstanceTypeDataSource_fpga
=== CONT  TestAccEC2InstanceTypeDataSource_media_accelerator
=== CONT  TestAccEC2InstanceTypeDataSource_neuron
=== CONT  TestAccEC2InstanceTypeDataSource_gpu
=== CONT  TestAccEC2InstanceTypeDataSource_metal
--- PASS: TestAccEC2InstanceTypeDataSource_media_accelerator (10.55s)
--- PASS: TestAccEC2InstanceTypeDataSource_metal (10.56s)
--- PASS: TestAccEC2InstanceTypeDataSource_gpu (10.57s)
--- PASS: TestAccEC2InstanceTypeDataSource_fpga (10.57s)
--- PASS: TestAccEC2InstanceTypeDataSource_basic (10.57s)
--- PASS: TestAccEC2InstanceTypeDataSource_neuron (10.57s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	16.631s

Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@ewbankkit
Copy link
Contributor

@bakeemawaytoys Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit a891a66 into hashicorp:main Jan 13, 2025
43 checks passed
@github-actions github-actions bot added this to the v5.84.0 milestone Jan 13, 2025
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jan 16, 2025
Copy link

This functionality has been released in v5.84.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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement]: aws_ec2_instance_type does not have attribues for NetworkInfo.NetworkCards value
4 participants