Skip to content

Commit

Permalink
🐛 fix v8 compat issues (#2089)
Browse files Browse the repository at this point in the history
Fixes #2088

Signed-off-by: Dominik Richter <[email protected]>
  • Loading branch information
arlimus authored Oct 5, 2023
1 parent f601fb7 commit 8cc9bca
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 13 deletions.
2 changes: 2 additions & 0 deletions providers/aws/resources/aws.lr
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,8 @@ private aws.ecr.repository {
images() []aws.ecr.image
// Region where the image is stored
region string
// Repository option to scan on image push
imageScanOnPush bool
}

// AWS Elastic Container Registry Image
Expand Down
12 changes: 12 additions & 0 deletions providers/aws/resources/aws.lr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions providers/aws/resources/aws.lr.manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,8 @@ resources:
The `aws.ecr.repository` resource can be used to assess the Amazon Elastic Container Registry repositories.
fields:
arn: {}
imageScanOnPush:
min_mondoo_version: 8.19.0
images: {}
name: {}
public: {}
Expand Down
31 changes: 19 additions & 12 deletions providers/aws/resources/aws_ecr.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,20 @@ func (a *mqlAwsEcr) getPrivateRepositories(conn *connection.AwsConnection) []*jo
return nil, err
}
for i := range repoResp.Repositories {
imageScanOnPush := false
r := repoResp.Repositories[i]
if r.ImageScanningConfiguration != nil {
imageScanOnPush = r.ImageScanningConfiguration.ScanOnPush
}
mqlRepoResource, err := CreateResource(a.MqlRuntime, "aws.ecr.repository",
map[string]*llx.RawData{
"arn": llx.StringData(convert.ToString(r.RepositoryArn)),
"name": llx.StringData(convert.ToString(r.RepositoryName)),
"uri": llx.StringData(convert.ToString(r.RepositoryUri)),
"registryId": llx.StringData(convert.ToString(r.RegistryId)),
"public": llx.BoolData(false),
"region": llx.StringData(region),
"arn": llx.StringData(convert.ToString(r.RepositoryArn)),
"name": llx.StringData(convert.ToString(r.RepositoryName)),
"uri": llx.StringData(convert.ToString(r.RepositoryUri)),
"registryId": llx.StringData(convert.ToString(r.RegistryId)),
"public": llx.BoolData(false),
"region": llx.StringData(region),
"imageScanOnPush": llx.BoolData(imageScanOnPush),
})
if err != nil {
return nil, err
Expand Down Expand Up @@ -276,14 +281,16 @@ func (a *mqlAwsEcr) publicRepositories() ([]interface{}, error) {
}
for i := range repoResp.Repositories {
r := repoResp.Repositories[i]

mqlRepoResource, err := CreateResource(a.MqlRuntime, "aws.ecr.repository",
map[string]*llx.RawData{
"arn": llx.StringData(convert.ToString(r.RepositoryArn)),
"name": llx.StringData(convert.ToString(r.RepositoryName)),
"uri": llx.StringData(convert.ToString(r.RepositoryUri)),
"registryId": llx.StringData(convert.ToString(r.RegistryId)),
"public": llx.BoolData(true),
"region": llx.StringData("us-east-1"),
"arn": llx.StringData(convert.ToString(r.RepositoryArn)),
"name": llx.StringData(convert.ToString(r.RepositoryName)),
"uri": llx.StringData(convert.ToString(r.RepositoryUri)),
"registryId": llx.StringData(convert.ToString(r.RegistryId)),
"public": llx.BoolData(true),
"region": llx.StringData("us-east-1"),
"imageScanOnPush": llx.BoolData(false),
})
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion providers/ms365/resources/ms365.lr.manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ resources:
serviceprincipals: {}
settings: {}
users: {}
min_mondoo_version: latest
min_mondoo_version: 5.15.0
microsoft.application:
fields:
appId: {}
Expand Down
3 changes: 3 additions & 0 deletions providers/terraform/resources/terraform.lr
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ terraform {
outputs() []terraform.block
}

// Terraform resources are all blocks with a type set to resource
terraform.resources {
[]terraform.block
// List all Terraform resources or search by name
init(filter any)
// Filter applied to this list of Terraform resources. May be a string or regex.
filter any
}

Expand Down
11 changes: 11 additions & 0 deletions providers/vcd/resources/externalnetworks.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ func (v *mqlVcdExternalNetwork) id() (string, error) {
if v.Name.Error != nil {
return "", v.Name.Error
}

// FIXME: DEPRECATED, remove in v10.0. The ID field will be removed and
// this request won't be necessary anymore. vv
urn := v.GetUrn()
if urn == nil {
v.Id = plugin.TValue[string]{State: plugin.StateIsSet | plugin.StateIsNull}
} else {
v.Id = *urn
}
// ^^

return "vcd.externalNetwork/" + v.Name.Data, nil
}

Expand Down
2 changes: 2 additions & 0 deletions providers/vcd/resources/vcd.lr
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ vcd.networkPool {

// VMware Cloud Director External Network
private vcd.externalNetwork @defaults("name") {
// URN of the network. Deprecated: Please use the urn field instead.
id string
// Unique name for the network
name string
// URN of the network
Expand Down
12 changes: 12 additions & 0 deletions providers/vcd/resources/vcd.lr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8cc9bca

Please sign in to comment.