Skip to content

Commit

Permalink
Updated tables as per EC2 package version updated (#2078)
Browse files Browse the repository at this point in the history
  • Loading branch information
ParthaI authored Aug 6, 2024
1 parent 82c3b98 commit a7c3e79
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
18 changes: 15 additions & 3 deletions aws/table_aws_ec2_instance_availability.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/ec2"
"github.com/aws/aws-sdk-go-v2/service/ec2/types"

"github.com/turbot/steampipe-plugin-sdk/v5/query_cache"
"github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto"
"github.com/turbot/steampipe-plugin-sdk/v5/plugin"
"github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform"
Expand All @@ -27,6 +28,11 @@ func tableAwsInstanceAvailability(_ context.Context) *plugin.Table {
Name: "instance_type",
Require: plugin.Optional,
},
{
Name: "location_type",
Require: plugin.Optional,
CacheMatch: query_cache.CacheMatchExact,
},
},
},
Columns: []*plugin.Column{
Expand Down Expand Up @@ -93,17 +99,23 @@ func listAwsAvailableInstanceTypes(ctx context.Context, d *plugin.QueryData, h *
}

input := &ec2.DescribeInstanceTypeOfferingsInput{
MaxResults: aws.Int32(maxLimit),
LocationType: types.LocationTypeRegion,
MaxResults: aws.Int32(maxLimit),
}

var filters []types.Filter
filters = append(filters, types.Filter{Name: aws.String("location"), Values: []string{*region.RegionName}})

if d.EqualsQualString("location_type") != "" {
input.LocationType = types.LocationType(d.EqualsQualString("location_type"))
} else {
input.LocationType = types.LocationTypeRegion
filters = append(filters, types.Filter{Name: aws.String("location"), Values: []string{*region.RegionName}})
}

equalQuals := d.EqualsQuals
if equalQuals["instance_type"] != nil {
filters = append(filters, types.Filter{Name: aws.String("instance-type"), Values: []string{equalQuals["instance_type"].GetStringValue()}})
}

input.Filters = filters

paginator := ec2.NewDescribeInstanceTypeOfferingsPaginator(svc, input, func(o *ec2.DescribeInstanceTypeOfferingsPaginatorOptions) {
Expand Down
36 changes: 36 additions & 0 deletions aws/table_aws_ec2_instance_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ func tableAwsInstanceType(_ context.Context) *plugin.Table {
Type: proto.ColumnType_BOOL,
Hydrate: describeInstanceType,
},
{
Name: "nitro_enclaves_support",
Description: "Indicates whether instance storage is supported.",
Type: proto.ColumnType_STRING,
Hydrate: describeInstanceType,
},
{
Name: "nitro_tpm_support",
Description: "Indicates whether NitroTPM is supported.",
Type: proto.ColumnType_STRING,
Hydrate: describeInstanceType,
},
{
Name: "hypervisor",
Description: "The hypervisor for the instance type.",
Expand Down Expand Up @@ -167,6 +179,30 @@ func tableAwsInstanceType(_ context.Context) *plugin.Table {
Type: proto.ColumnType_JSON,
Hydrate: describeInstanceType,
},
{
Name: "fpga_info",
Description: "Describes the FPGA accelerator settings for the instance type.",
Type: proto.ColumnType_JSON,
Hydrate: describeInstanceType,
},
{
Name: "inference_accelerator_info",
Description: "Describes the Inference accelerator settings for the instance type.",
Type: proto.ColumnType_JSON,
Hydrate: describeInstanceType,
},
{
Name: "nitro_tpm_info",
Description: "Describes the supported NitroTPM versions for the instance type.",
Type: proto.ColumnType_JSON,
Hydrate: describeInstanceType,
},
{
Name: "supported_boot_modes",
Description: "The supported boot modes.",
Type: proto.ColumnType_JSON,
Hydrate: describeInstanceType,
},
{
Name: "title",
Description: resourceInterfaceDescription("title"),
Expand Down

0 comments on commit a7c3e79

Please sign in to comment.