Skip to content

Commit

Permalink
Fixing kube-enforcer group creation issue:
Browse files Browse the repository at this point in the history
Error: {"message":"Currently container runtime is not supported, supported container runtime is only docker for kube enforcer","code":400}
  • Loading branch information
yossig-aquasec committed May 22, 2022
1 parent bc6414b commit 6c8d565
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HOSTNAME := github.com
NAMESPACE := aquasec
NAME := aquasec
BINARY := terraform-provider-${NAME}
VERSION := 0.8.10
VERSION := 0.8.11
OS_ARCH := $(shell go env GOOS)_$(shell go env GOARCH)

default: build
Expand Down
15 changes: 10 additions & 5 deletions aquasec/resource_enforcer_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,16 @@ func expandEnforcerGroup(d *schema.ResourceData) client.EnforcerGroup {
enforcerType, ok := d.GetOk("type")
if ok {
enforcerGroup.Type = enforcerType.(string)
if enforcerType != "agent" {
enforcerGroup.RuntimeType = "docker"
} else {
runtimeType, ok := d.GetOk("runtime_type")
if ok {
enforcerGroup.RuntimeType = runtimeType.(string)
} else {
enforcerGroup.RuntimeType = "docker"
}
}
}

admissionControl, ok := d.GetOk("admission_control")
Expand Down Expand Up @@ -677,11 +687,6 @@ func expandEnforcerGroup(d *schema.ResourceData) client.EnforcerGroup {
enforcerGroup.RiskExplorerAutoDiscovery = riskExplorerAutoDiscovery.(bool)
}

runtimeType, ok := d.GetOk("runtime_type")
if ok {
enforcerGroup.RuntimeType = runtimeType.(string)
}

syncHostImages, ok := d.GetOk("sync_host_images")
if ok {
enforcerGroup.SyncHostImages = syncHostImages.(bool)
Expand Down

0 comments on commit 6c8d565

Please sign in to comment.