Skip to content

Commit dd5a7c3

Browse files
authored
🐛 aws code deploy fixes (#5600)
Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
1 parent 891156b commit dd5a7c3

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

providers/aws/resources/aws.lr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3754,7 +3754,7 @@ private aws.codedeploy.deployment @defaults("deploymentId status applicationName
37543754
// Deployment overview (counts for Pending, InProgress, Succeeded, Failed, Skipped, Ready)
37553755
deploymentOverview() dict
37563756
// Whether this deployment is a rollback
3757-
isRollback bool
3757+
isRollback() bool
37583758
// Rollback information if this deployment is a rollback or was rolled back
37593759
rollbackInfo() dict
37603760
}

providers/aws/resources/aws.lr.go

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

providers/aws/resources/aws_codedeploy.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,15 @@ func (dg *mqlAwsCodedeployDeploymentGroup) onPremisesInstanceTagFilters() ([]int
286286

287287
func (dg *mqlAwsCodedeployDeploymentGroup) lastSuccessfulDeployment() (*mqlAwsCodedeployDeployment, error) {
288288
if dg.sdkData.LastSuccessfulDeployment == nil || dg.sdkData.LastSuccessfulDeployment.DeploymentId == nil {
289+
dg.LastSuccessfulDeployment = plugin.TValue[*mqlAwsCodedeployDeployment]{State: plugin.StateIsSet | plugin.StateIsNull}
289290
return nil, nil
290291
}
291292
return getDeploymentResource(dg.MqlRuntime, dg.Region.Data, &dg.ApplicationName.Data, &dg.DeploymentGroupName.Data, dg.sdkData.LastSuccessfulDeployment.DeploymentId)
292293
}
293294

294295
func (dg *mqlAwsCodedeployDeploymentGroup) lastAttemptedDeployment() (*mqlAwsCodedeployDeployment, error) {
295296
if dg.sdkData.LastAttemptedDeployment == nil || dg.sdkData.LastAttemptedDeployment.DeploymentId == nil {
297+
dg.LastAttemptedDeployment = plugin.TValue[*mqlAwsCodedeployDeployment]{State: plugin.StateIsSet | plugin.StateIsNull}
296298
return nil, nil
297299
}
298300
return getDeploymentResource(dg.MqlRuntime, dg.Region.Data, &dg.ApplicationName.Data, &dg.DeploymentGroupName.Data, dg.sdkData.LastAttemptedDeployment.DeploymentId)
@@ -320,10 +322,7 @@ func (dg *mqlAwsCodedeployDeploymentGroup) loadBalancerInfo() (interface{}, erro
320322
}
321323

322324
func (d *mqlAwsCodedeployDeployment) id() (string, error) {
323-
// Deployments are identified by their ID, which is unique within an AWS account and region.
324-
// Construct a synthetic ARN-like ID for uniqueness if needed, or use DeploymentId.
325-
// Using DeploymentId as it's the primary identifier returned by the API for a specific deployment.
326-
return d.DeploymentId.Data, nil
325+
return d.Arn.Data, nil
327326
}
328327

329328
type mqlAwsCodedeployDeploymentInternal struct {
@@ -382,9 +381,9 @@ func listDeployments(runtime *plugin.Runtime, region string, appName, dgName *st
382381
var nextToken *string
383382
for {
384383
listInput := &codedeploy.ListDeploymentsInput{
385-
ApplicationName: appName,
386-
// DeploymentGroupName: dgName,
387-
NextToken: nextToken,
384+
ApplicationName: appName,
385+
DeploymentGroupName: dgName,
386+
NextToken: nextToken,
388387
}
389388
// Potentially filter by IncludeOnlyStatuses for active ones if desired
390389
// listInput.IncludeOnlyStatuses = []codedeploytypes.DeploymentStatus{DeploymentStatusInProgress, DeploymentStatusQueued, DeploymentStatusReady}

0 commit comments

Comments
 (0)