Skip to content

Commit 1c17368

Browse files
authored
Merge pull request #282 from BaruchBilanski/SLK-90103-CR-POLICY
bug(container_runtime_policy): data source - drift prevention
2 parents d0f76da + 350b952 commit 1c17368

File tree

3 files changed

+331
-93
lines changed

3 files changed

+331
-93
lines changed

aquasec/data_container_runtime_policy.go

Lines changed: 192 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,174 @@ func dataContainerRuntimePolicy() *schema.Resource {
855855
},
856856
},
857857
}, // list
858-
858+
"audit_brute_force_login": {
859+
Type: schema.TypeBool,
860+
Description: "Detects brute force login attempts",
861+
Computed: true,
862+
},
863+
"failed_kubernetes_checks": {
864+
Type: schema.TypeList,
865+
Description: "Failed Kubernetes checks configuration.",
866+
Elem: &schema.Resource{
867+
Schema: map[string]*schema.Schema{
868+
"enabled": {
869+
Type: schema.TypeBool,
870+
Description: "",
871+
Computed: true,
872+
},
873+
"failed_checks": {
874+
Type: schema.TypeList,
875+
Description: "",
876+
Elem: &schema.Schema{
877+
Type: schema.TypeString,
878+
},
879+
Computed: true,
880+
},
881+
},
882+
},
883+
Computed: true,
884+
},
885+
"enable_port_scan_protection": {
886+
Type: schema.TypeBool,
887+
Description: "",
888+
Computed: true,
889+
},
890+
"enable_crypto_mining_dns": {
891+
Type: schema.TypeBool,
892+
Description: "",
893+
Computed: true,
894+
},
895+
"enable_ip_reputation": {
896+
Type: schema.TypeBool,
897+
Description: "",
898+
Computed: true,
899+
},
900+
"default_security_profile": {
901+
Type: schema.TypeString,
902+
Description: "",
903+
Computed: true,
904+
},
905+
"registry": {
906+
Type: schema.TypeString,
907+
Description: "",
908+
Computed: true,
909+
},
910+
"type": {
911+
Type: schema.TypeString,
912+
Description: "",
913+
Computed: true,
914+
},
915+
"digest": {
916+
Type: schema.TypeString,
917+
Description: "",
918+
Computed: true,
919+
},
920+
"vpatch_version": {
921+
Type: schema.TypeString,
922+
Description: "",
923+
Computed: true,
924+
},
925+
"resource_name": {
926+
Type: schema.TypeString,
927+
Description: "",
928+
Computed: true,
929+
},
930+
"resource_type": {
931+
Type: schema.TypeString,
932+
Description: "",
933+
Computed: true,
934+
},
935+
"cve": {
936+
Type: schema.TypeString,
937+
Description: "",
938+
Computed: true,
939+
},
940+
"repo_name": {
941+
Type: schema.TypeString,
942+
Description: "",
943+
Computed: true,
944+
},
945+
"image_name": {
946+
Type: schema.TypeString,
947+
Description: "",
948+
Computed: true,
949+
},
950+
"exclude_application_scopes": {
951+
Type: schema.TypeList,
952+
Description: "List of excluded application scopes.",
953+
Computed: true,
954+
Elem: &schema.Schema{
955+
Type: schema.TypeString,
956+
Description: "Excluded application scope.",
957+
},
958+
},
959+
"permission": {
960+
Type: schema.TypeString,
961+
Description: "",
962+
Computed: true,
963+
},
964+
"is_audit_checked": {
965+
Type: schema.TypeBool,
966+
Description: "",
967+
Computed: true,
968+
},
969+
"enforce_scheduler_added_on": {
970+
Type: schema.TypeInt,
971+
Description: "",
972+
Computed: true,
973+
},
974+
"is_ootb_policy": {
975+
Type: schema.TypeBool,
976+
Description: "",
977+
Computed: true,
978+
},
979+
"is_auto_generated": {
980+
Type: schema.TypeBool,
981+
Description: "",
982+
Computed: true,
983+
},
984+
"runtime_mode": {
985+
Type: schema.TypeInt,
986+
Description: "",
987+
Computed: true,
988+
},
989+
"runtime_type": {
990+
Type: schema.TypeString,
991+
Description: "",
992+
Computed: true,
993+
},
994+
"drift_prevention": {
995+
Type: schema.TypeList,
996+
Description: "Drift prevention configuration.",
997+
Computed: true,
998+
Elem: &schema.Resource{
999+
Schema: map[string]*schema.Schema{
1000+
"enabled": {
1001+
Type: schema.TypeBool,
1002+
Description: "Whether drift prevention is enabled.",
1003+
Computed: true,
1004+
},
1005+
"exec_lockdown": {
1006+
Type: schema.TypeBool,
1007+
Description: "Whether to lockdown execution drift.",
1008+
Computed: true,
1009+
},
1010+
"image_lockdown": {
1011+
Type: schema.TypeBool,
1012+
Description: "Whether to lockdown image drift.",
1013+
Computed: true,
1014+
},
1015+
"exec_lockdown_white_list": {
1016+
Type: schema.TypeList,
1017+
Description: "List of items in the execution lockdown white list.",
1018+
Elem: &schema.Schema{
1019+
Type: schema.TypeString,
1020+
},
1021+
Computed: true,
1022+
},
1023+
},
1024+
},
1025+
},
8591026
},
8601027
}
8611028
}
@@ -928,6 +1095,30 @@ func dataContainerRuntimePolicyRead(ctx context.Context, d *schema.ResourceData,
9281095
d.Set("readonly_files", flattenReadonlyFiles(crp.ReadonlyFiles))
9291096
d.Set("allowed_registries", flattenAllowedRegistries(crp.AllowedRegistries))
9301097
d.Set("restricted_volumes", flattenRestrictedVolumes(crp.RestrictedVolumes))
1098+
d.Set("audit_brute_force_login", crp.AuditBruteForceLogin)
1099+
d.Set("failed_kubernetes_checks", flattenFailedKubernetesChecks(crp.FailedKubernetesChecks))
1100+
d.Set("enable_port_scan_protection", crp.EnablePortScanProtection)
1101+
d.Set("enable_crypto_mining_dns", crp.EnableCryptoMiningDns)
1102+
d.Set("enable_ip_reputation", crp.EnableIPReputation)
1103+
d.Set("default_security_profile", crp.DefaultSecurityProfile)
1104+
d.Set("registry", crp.Registry)
1105+
d.Set("type", crp.Type)
1106+
d.Set("digest", crp.Digest)
1107+
d.Set("vpatch_version", crp.VpatchVersion)
1108+
d.Set("resource_name", crp.ResourceName)
1109+
d.Set("resource_type", crp.ResourceType)
1110+
d.Set("cve", crp.Cve)
1111+
d.Set("repo_name", crp.RepoName)
1112+
d.Set("image_name", crp.ImageName)
1113+
d.Set("exclude_application_scopes", crp.ExcludeApplicationScopes)
1114+
d.Set("permission", crp.Permission)
1115+
d.Set("is_audit_checked", crp.IsAuditChecked)
1116+
d.Set("enforce_scheduler_added_on", crp.EnforceSchedulerAddedOn)
1117+
d.Set("is_ootb_policy", crp.IsOOTBPolicy)
1118+
d.Set("is_auto_generated", crp.IsAutoGenerated)
1119+
d.Set("runtime_mode", crp.RuntimeMode)
1120+
d.Set("runtime_type", crp.RuntimeType)
1121+
d.Set("drift_prevention", flattenDriftPrevention(crp.DriftPrevention))
9311122

9321123
d.SetId(name)
9331124
} else {

0 commit comments

Comments
 (0)