Skip to content

Commit be40879

Browse files
committed
address review comments part 2
1 parent ac95602 commit be40879

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

sysdig/resource_sysdig_secure_rule_stateful.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,11 @@ func resourceSysdigSecureStatefulRule() *schema.Resource {
5050
},
5151
"source": {
5252
Type: schema.TypeString,
53-
Optional: false,
5453
Required: true,
5554
ValidateDiagFunc: validateDiagFunc(validateStatefulRuleSource),
5655
},
5756
"ruletype": {
5857
Type: schema.TypeString,
59-
Optional: false,
6058
Required: true,
6159
ValidateDiagFunc: validateDiagFunc(validateStatefulRuleType),
6260
},
@@ -67,7 +65,6 @@ func resourceSysdigSecureStatefulRule() *schema.Resource {
6765
},
6866
"exceptions": {
6967
Type: schema.TypeList,
70-
Optional: false,
7168
Required: true,
7269
Elem: &schema.Resource{
7370
Schema: map[string]*schema.Schema{
@@ -195,7 +192,12 @@ func resourceSysdigRuleStatefulUpdate(ctx context.Context, d *schema.ResourceDat
195192
}
196193

197194
rule.Version = d.Get("version").(int)
198-
rule.ID, _ = strconv.Atoi(d.Id())
195+
id, err := strconv.Atoi(d.Id())
196+
if err != nil {
197+
return diag.FromErr(err)
198+
}
199+
200+
rule.ID = id
199201

200202
_, err = client.UpdateStatefulRule(ctx, rule)
201203
if err != nil {

sysdig/resource_sysdig_secure_rule_stateful_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func ruleStatefulAppend() string {
3333
ruletype = "STATEFUL_SEQUENCE"
3434
append = true
3535
exceptions {
36-
values = jsonencode([["abc", ["docker.io/library/busybox"]]])
36+
values = jsonencode([["12345", ["docker.io/library/busybox"]]])
3737
name = "user_accountid"
3838
}
3939
}`

0 commit comments

Comments
 (0)