Skip to content

Commit 1e41d6c

Browse files
authored
Minor fixes and improvements to aws.ec2.instance (#6670)
- Don't fail when the keypair has been deleted - Deprecate vpcArn - Add launchedAt and deprecate launchTime Signed-off-by: Tim Smith <tsmith84@gmail.com>
1 parent aa41039 commit 1e41d6c

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

providers/aws/resources/aws.lr

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4332,8 +4332,10 @@ private aws.ec2.instance @defaults("instanceId region state instanceType archite
43324332
iamInstanceProfile() aws.iam.instanceProfile
43334333
// Image that was used for the instance
43344334
image() aws.ec2.image
4335-
// Launch time of the instance
4335+
// Deprecated: use `launchedAt` instead
43364336
launchTime time
4337+
// Launch time of the instance
4338+
launchedAt time
43374339
// Private IP address for the instance
43384340
privateIp string
43394341
// Private DNS name for the instance
@@ -4342,7 +4344,7 @@ private aws.ec2.instance @defaults("instanceId region state instanceType archite
43424344
keypair() aws.ec2.keypair
43434345
// Time when the last state transition occurred
43444346
stateTransitionTime time
4345-
// ARN of the VPC associated with the instance
4347+
// Deprecated: use `vpc` instead
43464348
vpcArn string
43474349
// Hypervisor type of the instance: ovm or xen
43484350
hypervisor string

providers/aws/resources/aws.lr.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

providers/aws/resources/aws.lr.versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ aws.ec2.instance.instanceStatus 9.0.0
541541
aws.ec2.instance.instanceType 9.0.0
542542
aws.ec2.instance.keypair 9.0.0
543543
aws.ec2.instance.launchTime 9.0.0
544+
aws.ec2.instance.launchedAt 11.12.3
544545
aws.ec2.instance.networkInterfaces 11.1.0
545546
aws.ec2.instance.patchState 9.0.0
546547
aws.ec2.instance.platformDetails 9.0.0

providers/aws/resources/aws_ec2.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,11 @@ func initAwsEc2Keypair(runtime *plugin.Runtime, args map[string]*llx.RawData) (m
694694
if errors.As(err, &ae) {
695695
if ae.ErrorCode() == "InvalidKeyPair.NotFound" {
696696
log.Warn().Msgf("key %s does not exist in %s region", n, r)
697+
args["fingerprint"] = llx.StringData("")
698+
args["type"] = llx.StringData("")
699+
args["tags"] = llx.MapData(map[string]any{}, types.String)
700+
args["arn"] = llx.StringData("")
701+
args["createdAt"] = llx.NilData
697702
return args, nil, nil
698703
}
699704
}
@@ -713,6 +718,11 @@ func initAwsEc2Keypair(runtime *plugin.Runtime, args map[string]*llx.RawData) (m
713718

714719
return args, nil, nil
715720
}
721+
args["fingerprint"] = llx.StringData("")
722+
args["type"] = llx.StringData("")
723+
args["tags"] = llx.MapData(map[string]any{}, types.String)
724+
args["arn"] = llx.StringData("")
725+
args["createdAt"] = llx.NilData
716726
return args, nil, nil
717727
}
718728

@@ -1084,6 +1094,7 @@ func (a *mqlAwsEc2) gatherInstanceInfo(instances []ec2types.Instance, regionVal
10841094
"instanceLifecycle": llx.StringData(string(instance.InstanceLifecycle)),
10851095
"instanceType": llx.StringData(string(instance.InstanceType)),
10861096
"launchTime": llx.TimeDataPtr(instance.LaunchTime),
1097+
"launchedAt": llx.TimeDataPtr(instance.LaunchTime),
10871098
"platformDetails": llx.StringDataPtr(instance.PlatformDetails),
10881099
"privateDnsName": llx.StringDataPtr(instance.PrivateDnsName),
10891100
"privateIp": llx.StringDataPtr(instance.PrivateIpAddress),

0 commit comments

Comments
 (0)