Skip to content

Commit

Permalink
Improve security group defaults + ptr cleanup (#2787)
Browse files Browse the repository at this point in the history
Improve the defaults and cleanup some string conversions.

Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 authored Dec 11, 2023
1 parent f27877f commit dd70a3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion providers/aws/resources/aws.lr
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,7 @@ private aws.ec2.instance.device {
}

// Amazon EC2 security group
private aws.ec2.securitygroup @defaults("arn") {
private aws.ec2.securitygroup @defaults("id name region vpc.id") {
// Security group ARN
arn string
// Security group ID
Expand Down
10 changes: 5 additions & 5 deletions providers/aws/resources/aws_ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func (a *mqlAwsEc2) getSecurityGroups(conn *connection.AwsConnection) []*jobpool
"id": llx.StringData(convert.ToString(group.GroupId) + "-" + strconv.Itoa(p)),
"fromPort": llx.IntData(convert.ToInt64From32(permission.FromPort)),
"toPort": llx.IntData(convert.ToInt64From32(permission.ToPort)),
"ipProtocol": llx.StringData(convert.ToString(permission.IpProtocol)),
"ipProtocol": llx.StringDataPtr(permission.IpProtocol),
"ipRanges": llx.ArrayData(ipRanges, types.Any),
"ipv6Ranges": llx.ArrayData(ipv6Ranges, types.Any),
})
Expand Down Expand Up @@ -304,7 +304,7 @@ func (a *mqlAwsEc2) getSecurityGroups(conn *connection.AwsConnection) []*jobpool
"id": llx.StringData(convert.ToString(group.GroupId) + "-" + strconv.Itoa(p) + "-egress"),
"fromPort": llx.IntData(convert.ToInt64From32(permission.FromPort)),
"toPort": llx.IntData(convert.ToInt64From32(permission.ToPort)),
"ipProtocol": llx.StringData(convert.ToString(permission.IpProtocol)),
"ipProtocol": llx.StringDataPtr(permission.IpProtocol),
"ipRanges": llx.ArrayData(ipRanges, types.Any),
"ipv6Ranges": llx.ArrayData(ipv6Ranges, types.Any),
})
Expand All @@ -317,9 +317,9 @@ func (a *mqlAwsEc2) getSecurityGroups(conn *connection.AwsConnection) []*jobpool

args := map[string]*llx.RawData{
"arn": llx.StringData(fmt.Sprintf(securityGroupArnPattern, regionVal, conn.AccountId(), convert.ToString(group.GroupId))),
"id": llx.StringData(convert.ToString(group.GroupId)),
"name": llx.StringData(convert.ToString(group.GroupName)),
"description": llx.StringData(convert.ToString(group.Description)),
"id": llx.StringDataPtr(group.GroupId),
"name": llx.StringDataPtr(group.GroupName),
"description": llx.StringDataPtr(group.Description),
"tags": llx.MapData(Ec2TagsToMap(group.Tags), types.String),
"ipPermissions": llx.ArrayData(mqlIpPermissions, types.Resource("aws.ec2.securitygroup.ippermission")),
"ipPermissionsEgress": llx.ArrayData(mqlIpPermissionsEgress, types.Resource("aws.ec2.securitygroup.ippermission")),
Expand Down

0 comments on commit dd70a3f

Please sign in to comment.