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

d/aws_ec2_instance_type maximum_network_cards #35840

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/35840.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
data-source/aws_ec2_instance_type: Add `maximum_network_cards` attribute
```
5 changes: 5 additions & 0 deletions internal/service/ec2/ec2_instance_type_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ func DataSourceInstanceType() *schema.Resource {
Type: schema.TypeInt,
Computed: true,
},
"maximum_network_cards": {
Type: schema.TypeInt,
Computed: true,
},
"maximum_network_interfaces": {
Type: schema.TypeInt,
Computed: true,
Expand Down Expand Up @@ -388,6 +392,7 @@ func dataSourceInstanceTypeRead(ctx context.Context, d *schema.ResourceData, met
d.Set("ipv6_supported", v.NetworkInfo.Ipv6Supported)
d.Set("maximum_ipv4_addresses_per_interface", v.NetworkInfo.Ipv4AddressesPerInterface)
d.Set("maximum_ipv6_addresses_per_interface", v.NetworkInfo.Ipv6AddressesPerInterface)
d.Set("maximum_network_cards", v.NetworkInfo.MaximumNetworkCards)
d.Set("maximum_network_interfaces", v.NetworkInfo.MaximumNetworkInterfaces)
d.Set("memory_size", v.MemoryInfo.SizeInMiB)
d.Set("network_performance", v.NetworkInfo.NetworkPerformance)
Expand Down
11 changes: 7 additions & 4 deletions internal/service/ec2/ec2_instance_type_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func TestAccEC2InstanceTypeDataSource_basic(t *testing.T) {
resource.TestCheckResourceAttr(dataSourceName, "ipv6_supported", "true"),
resource.TestCheckResourceAttr(dataSourceName, "maximum_ipv4_addresses_per_interface", "10"),
resource.TestCheckResourceAttr(dataSourceName, "maximum_ipv6_addresses_per_interface", "10"),
resource.TestCheckResourceAttr(dataSourceName, "maximum_network_cards", "1"),
resource.TestCheckResourceAttr(dataSourceName, "maximum_network_interfaces", "3"),
resource.TestCheckResourceAttr(dataSourceName, "memory_size", "8192"),
resource.TestCheckResourceAttr(dataSourceName, "network_performance", "Up to 10 Gigabit"),
Expand Down Expand Up @@ -115,10 +116,12 @@ func TestAccEC2InstanceTypeDataSource_gpu(t *testing.T) {
Config: testAccInstanceTypeDataSourceConfig_gpu,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(dataSourceName, "gpus.#", "1"),
resource.TestCheckResourceAttr(dataSourceName, "gpus.0.count", "1"),
resource.TestCheckResourceAttr(dataSourceName, "gpus.0.count", "8"),
resource.TestCheckResourceAttr(dataSourceName, "gpus.0.manufacturer", "NVIDIA"),
resource.TestCheckResourceAttr(dataSourceName, "gpus.0.memory_size", "8192"),
resource.TestCheckResourceAttr(dataSourceName, "gpus.0.name", "M60"),
resource.TestCheckResourceAttr(dataSourceName, "gpus.0.memory_size", "81920"),
resource.TestCheckResourceAttr(dataSourceName, "gpus.0.name", "H100"),
resource.TestCheckResourceAttr(dataSourceName, "maximum_network_cards", "32"),
resource.TestCheckResourceAttr(dataSourceName, "maximum_network_interfaces", "64"),
),
},
},
Expand Down Expand Up @@ -163,7 +166,7 @@ data "aws_ec2_instance_type" "test" {

const testAccInstanceTypeDataSourceConfig_gpu = `
data "aws_ec2_instance_type" "test" {
instance_type = "g3.4xlarge"
instance_type = "p5.48xlarge"
}
`

Expand Down
1 change: 1 addition & 0 deletions website/docs/d/ec2_instance_type.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ This data source exports the following attributes in addition to the arguments a
* `ipv6_supported` - `true` if IPv6 is supported.
* `maximum_ipv4_addresses_per_interface` - The maximum number of IPv4 addresses per network interface.
* `maximum_ipv6_addresses_per_interface` - The maximum number of IPv6 addresses per network interface.
* `maximum_network_cards` - The maximum number of physical network cards that can be allocated to the instance.
* `maximum_network_interfaces` - The maximum number of network interfaces for the instance type.
* `memory_size` - Size of the instance memory, in MiB.
* `network_performance` - Describes the network performance.
Expand Down
Loading