Skip to content

Commit b24596e

Browse files
authored
fix(function): fix missing fields in read (#2369)
1 parent 92c3c50 commit b24596e

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

docs/resources/function.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ In addition to all arguments above, the following attributes are exported:
9595

9696
~> **Important:** Functions' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111`
9797

98+
- `namespace_id` - The namespace ID the function is associated with.
9899
- `domain_name` - The native domain name of the function
99100
- `organization_id` - The organization ID the function is associated with.
100101
- `cpu_limit` - The CPU limit in mCPU for your function. More infos on resources [here](https://developers.scaleway.com/en/products/functions/api/#functions)

docs/resources/function_cron.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ The following arguments are required:
5252
- `args` - (Required) The key-value mapping to define arguments that will be passed to your function’s event object
5353
during
5454
- `name` - (Optional) The name of the cron. If not provided, the name is generated.
55+
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions)
56+
in where the job was created.
5557

5658
## Attributes Reference
5759

@@ -61,8 +63,6 @@ In addition to all arguments above, the following attributes are exported:
6163

6264
~> **Important:** Function CRONs' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111`
6365

64-
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions)
65-
in where the job was created.
6666
- `status` - The cron status.
6767

6868
## Import

scaleway/resource_function.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ func resourceScalewayFunction() *schema.Resource {
3232
SchemaVersion: 0,
3333
Schema: map[string]*schema.Schema{
3434
"namespace_id": {
35-
Type: schema.TypeString,
36-
Description: "The namespace ID associated with this function",
37-
Required: true,
38-
ForceNew: true,
35+
Type: schema.TypeString,
36+
Description: "The namespace ID associated with this function",
37+
Required: true,
38+
ForceNew: true,
39+
DiffSuppressFunc: diffSuppressFuncLocality,
3940
},
4041
"name": {
4142
Type: schema.TypeString,
@@ -293,6 +294,7 @@ func resourceScalewayFunctionRead(ctx context.Context, d *schema.ResourceData, m
293294
_ = d.Set("timeout", f.Timeout.Seconds)
294295
_ = d.Set("domain_name", f.DomainName)
295296
_ = d.Set("http_option", f.HTTPOption)
297+
_ = d.Set("namespace_id", f.NamespaceID)
296298

297299
return diags
298300
}

scaleway/resource_function_cron.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func resourceScalewayFunctionCronRead(ctx context.Context, d *schema.ResourceDat
127127

128128
_ = d.Set("args", args)
129129
_ = d.Set("status", cron.Status)
130-
130+
_ = d.Set("region", region.String())
131131
return nil
132132
}
133133

scaleway/resource_function_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ func TestAccScalewayFunction_Basic(t *testing.T) {
7272
resource.TestCheckResourceAttr("scaleway_function.main", "runtime", "node14"),
7373
resource.TestCheckResourceAttr("scaleway_function.main", "privacy", "private"),
7474
resource.TestCheckResourceAttr("scaleway_function.main", "handler", "handler.handle"),
75+
resource.TestCheckResourceAttrSet("scaleway_function.main", "namespace_id"),
76+
resource.TestCheckResourceAttrSet("scaleway_function.main", "region"),
7577
),
7678
},
7779
},

0 commit comments

Comments
 (0)