Skip to content

Commit 8b40c6a

Browse files
committed
last adjustments
1 parent dc39f07 commit 8b40c6a

File tree

4 files changed

+533
-3587
lines changed

4 files changed

+533
-3587
lines changed

docs/resources/k8s_acl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The following arguments are supported:
6868

6969
- `no_ip_allowed` - (Optional) If set to true, no IP will be allowed and the cluster will be in full-isolation.
7070

71-
~> **Important:** This field cannot be set to true if the `acl_rules` is defined.
71+
~> **Important:** This field cannot be set to true if the `acl_rules` block is defined.
7272

7373
- `acl_rules` - (Optional) A list of ACLs (structure is described below)
7474

internal/services/k8s/acl.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func ResourceACL() *schema.Resource {
6666
"scaleway_ranges": {
6767
Type: schema.TypeBool,
6868
Optional: true,
69-
Description: "Allow access to cluster from all Scaleway ranges as defined in https://www.scaleway.com/en/docs/console/account/reference-content/scaleway-network-information/#ip-ranges-used-by-scaleway. Only one rule with this field set to true can be added.",
69+
Description: "Allow access to cluster from all Scaleway ranges",
7070
},
7171
"description": {
7272
Type: schema.TypeString,
@@ -169,7 +169,7 @@ func ResourceACLUpdate(ctx context.Context, d *schema.ResourceData, m interface{
169169
return diag.FromErr(err)
170170
}
171171

172-
if d.HasChange("acl_rules") || d.HasChange("no_ip_allowed") {
172+
if d.HasChanges("acl_rules", "no_ip_allowed") {
173173
acls, err := expandACL(d.Get("acl_rules").([]interface{}))
174174
if err != nil {
175175
return diag.FromErr(err)
@@ -201,21 +201,20 @@ func ResourceACLDelete(ctx context.Context, d *schema.ResourceData, m interface{
201201
return diag.FromErr(err)
202202
}
203203

204-
rulesToSet := []*k8s.ACLRuleRequest(nil)
205-
206204
allowedIPs, err := types.ExpandIPNet("0.0.0.0/0")
207205
if err != nil {
208206
return diag.FromErr(err)
209207
}
210-
rulesToSet = append(rulesToSet, &k8s.ACLRuleRequest{
211-
IP: &allowedIPs,
212-
Description: "Automatically generated after scaleway_k8s_acl resource deletion",
213-
})
214208

215209
req := &k8s.SetClusterACLRulesRequest{
216210
Region: region,
217211
ClusterID: clusterID,
218-
ACLs: rulesToSet,
212+
ACLs: []*k8s.ACLRuleRequest{
213+
{
214+
IP: &allowedIPs,
215+
Description: "Automatically generated after scaleway_k8s_acl resource deletion",
216+
},
217+
},
219218
}
220219

221220
_, err = api.SetClusterACLRules(req, scw.WithContext(ctx))

0 commit comments

Comments
 (0)