Skip to content

Commit a3610de

Browse files
authored
Merge branch 'master' into feat/add_support_for_registar_domain
2 parents 14a6a06 + c4b3921 commit a3610de

20 files changed

+10425
-2401
lines changed

docs/resources/container.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ The following arguments are supported:
9999

100100
- `deploy` - (Optional) Boolean indicating whether the container is in a production environment.
101101

102+
- `local_storage_limit` - Local storage limit of the container (in MB)
103+
102104
Note that if you want to use your own configuration, you must consult our configuration [restrictions](https://www.scaleway.com/en/docs/serverless-containers/reference-content/containers-limitations/#configuration-restrictions) section.
103105

104106
## Attributes Reference

docs/resources/mongodb_instance.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,30 @@ resource "scaleway_mongodb_instance" "main" {
2525
}
2626
```
2727

28+
### Private Network
29+
30+
```terraform
31+
resource scaleway_vpc_private_network pn01 {
32+
name = "my_private_network"
33+
region = "fr-par"
34+
}
35+
36+
resource "scaleway_mongodb_instance" "main" {
37+
name = "test-mongodb-basic1"
38+
version = "7.0.12"
39+
node_type = "MGDB-PLAY2-NANO"
40+
node_number = 1
41+
user_name = "my_initial_user"
42+
password = "thiZ_is_v&ry_s3cret"
43+
volume_size_in_gb = 5
44+
45+
private_network {
46+
pn_id = "${scaleway_vpc_private_network.pn02.id}"
47+
}
48+
49+
}
50+
```
51+
2852

2953
### Restore From Snapshot
3054

@@ -51,6 +75,8 @@ The following arguments are supported:
5175
- `volume_type` - (Optional) Volume type of the instance.
5276
- `volume_size_in_gb` - (Optional) Volume size in GB.
5377
- `snapshot_id` - (Optional) Snapshot ID to restore the MongoDB® instance from.
78+
- `private_network` - (Optional) Private Network endpoints of the Database Instance.
79+
- `pn_id` - (Required) The ID of the Private Network.
5480
- `public_network` - (Optional) Public network specs details.
5581

5682
## Attributes Reference
@@ -60,6 +86,11 @@ In addition to all arguments above, the following attributes are exported:
6086
- `id` - The ID of the MongoDB® instance.
6187
- `created_at` - The date and time of the creation of the MongoDB® instance.
6288
- `updated_at` - The date and time of the last update of the MongoDB® instance.
89+
- `private_network` - Private Network endpoints of the Database Instance.
90+
- `id` - The ID of the endpoint.
91+
- `ips` - List of IP addresses for your endpoint.
92+
- `port` - TCP port of the endpoint.
93+
- `dns_records` - List of DNS records for your endpoint.
6394

6495
## Import
6596

internal/services/applesilicon/server.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ func ResourceServer() *schema.Resource {
135135
Computed: true,
136136
Description: "The VPC status of the server",
137137
},
138+
"password": {
139+
Type: schema.TypeString,
140+
Computed: true,
141+
Sensitive: true,
142+
Description: "The password of the server",
143+
},
144+
"username": {
145+
Type: schema.TypeString,
146+
Computed: true,
147+
Description: "The username of the server",
148+
},
138149

139150
// Common
140151
"zone": zonal.Schema(),
@@ -225,6 +236,8 @@ func ResourceAppleSiliconServerRead(ctx context.Context, d *schema.ResourceData,
225236
_ = d.Set("zone", res.Zone.String())
226237
_ = d.Set("organization_id", res.OrganizationID)
227238
_ = d.Set("project_id", res.ProjectID)
239+
_ = d.Set("password", res.SudoPassword)
240+
_ = d.Set("username", res.SSHUsername)
228241

229242
listPrivateNetworks, err := privateNetworkAPI.ListServerPrivateNetworks(&applesilicon.PrivateNetworkAPIListServerPrivateNetworksRequest{
230243
Zone: res.Zone,

internal/services/cockpit/cockpit.go

Lines changed: 38 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -25,53 +25,54 @@ func ResourceCockpit() *schema.Resource {
2525
Type: schema.TypeString,
2626
Optional: true,
2727
Default: "free",
28-
Description: "Name or ID of the plan",
28+
Description: "[DEPRECATED] The plan field is deprecated. Any modification or selection will have no effect.",
29+
Deprecated: "The 'plan' attribute is deprecated and no longer has any effect. Future updates will remove this attribute entirely.",
2930
},
3031
"plan_id": {
3132
Type: schema.TypeString,
3233
Computed: true,
33-
Description: "The plan ID of the cockpit",
34-
Deprecated: "Please use Name only",
34+
Description: "[DEPRECATED] The plan ID of the cockpit. This field is no longer relevant.",
35+
Deprecated: "The 'plan_id' attribute is deprecated and will be removed in a future release.",
3536
},
3637
"endpoints": {
3738
Type: schema.TypeList,
3839
Computed: true,
39-
Description: "Endpoints",
40-
Deprecated: "Please use `scaleway_cockpit_source` instead",
40+
Description: "[DEPRECATED] Endpoints list. Please use 'scaleway_cockpit_source' instead.",
41+
Deprecated: "Use 'scaleway_cockpit_source' instead of 'endpoints'. This field will be removed in future releases.",
4142
Elem: &schema.Resource{
4243
Schema: map[string]*schema.Schema{
4344
"metrics_url": {
4445
Type: schema.TypeString,
4546
Computed: true,
46-
Description: "The metrics URL",
47+
Description: "The metrics URL.",
4748
},
4849
"logs_url": {
4950
Type: schema.TypeString,
5051
Computed: true,
51-
Description: "The logs URL",
52+
Description: "The logs URL.",
5253
},
5354
"alertmanager_url": {
5455
Type: schema.TypeString,
5556
Computed: true,
56-
Description: "The alertmanager URL",
57+
Description: "The alertmanager URL.",
5758
},
5859
"grafana_url": {
5960
Type: schema.TypeString,
6061
Computed: true,
61-
Description: "The grafana URL",
62+
Description: "The grafana URL.",
6263
},
6364
"traces_url": {
6465
Type: schema.TypeString,
6566
Computed: true,
66-
Description: "The traces URL",
67+
Description: "The traces URL.",
6768
},
6869
},
6970
},
7071
},
7172
"push_url": {
7273
Type: schema.TypeList,
7374
Computed: true,
74-
Description: "Push_url",
75+
Description: "[DEPRECATED] Push_url",
7576
Deprecated: "Please use `scaleway_cockpit_source` instead",
7677
Elem: &schema.Resource{
7778
Schema: map[string]*schema.Schema{
@@ -93,48 +94,22 @@ func ResourceCockpit() *schema.Resource {
9394
}
9495

9596
func ResourceCockpitCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
96-
api, err := NewGlobalAPI(m)
97-
if err != nil {
98-
return diag.FromErr(err)
99-
}
100-
10197
projectID := d.Get("project_id").(string)
102-
103-
if targetPlanI, ok := d.GetOk("plan"); ok {
104-
targetPlan := targetPlanI.(string)
105-
106-
plans, err := api.ListPlans(&cockpit.GlobalAPIListPlansRequest{}, scw.WithContext(ctx), scw.WithAllPages()) //nolint:staticcheck
107-
if err != nil {
108-
return diag.FromErr(err)
109-
}
110-
111-
var planName string
112-
113-
for _, plan := range plans.Plans {
114-
if plan.Name.String() == targetPlan {
115-
planName = plan.Name.String()
116-
117-
break
118-
}
119-
}
120-
121-
if planName == "" {
122-
return diag.Errorf("plan %s not found", targetPlan)
123-
}
124-
125-
_, err = api.SelectPlan(&cockpit.GlobalAPISelectPlanRequest{ //nolint:staticcheck
126-
ProjectID: projectID,
127-
PlanName: cockpit.PlanName(planName),
128-
}, scw.WithContext(ctx))
98+
if projectID == "" {
99+
_, err := getDefaultProjectID(ctx, m)
129100
if err != nil {
130101
return diag.FromErr(err)
131102
}
132103
}
133104

105+
d.SetId(projectID)
106+
134107
return ResourceCockpitRead(ctx, d, m)
135108
}
136109

137110
func ResourceCockpitRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
111+
var diags diag.Diagnostics
112+
138113
api, err := NewGlobalAPI(m)
139114
if err != nil {
140115
return diag.FromErr(err)
@@ -153,15 +128,14 @@ func ResourceCockpitRead(ctx context.Context, d *schema.ResourceData, m interfac
153128
}
154129
}
155130

156-
res, err := api.GetCurrentPlan(&cockpit.GlobalAPIGetCurrentPlanRequest{ //nolint:staticcheck
157-
ProjectID: projectID,
158-
}, scw.WithContext(ctx))
159-
if err != nil {
160-
return diag.FromErr(err)
161-
}
131+
diags = append(diags, diag.Diagnostic{
132+
Severity: diag.Warning,
133+
Summary: "Deprecated attribute: 'plan'",
134+
Detail: "The 'plan' attribute is deprecated and will be removed in a future version. Any changes to this attribute will have no effect.",
135+
})
162136

163-
_ = d.Set("plan", res.Name.String())
164-
_ = d.Set("plan_id", res.Name.String())
137+
_ = d.Set("plan", d.Get("plan"))
138+
_ = d.Set("plan_id", "")
165139

166140
dataSourcesRes, err := regionalAPI.ListDataSources(&cockpit.RegionalAPIListDataSourcesRequest{
167141
Region: region,
@@ -203,54 +177,26 @@ func ResourceCockpitRead(ctx context.Context, d *schema.ResourceData, m interfac
203177
_ = d.Set("endpoints", endpoints)
204178
_ = d.Set("push_url", createCockpitPushURLList(endpoints))
205179

206-
return nil
180+
return diags
207181
}
208182

209183
func ResourceCockpitUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
210-
api, err := NewGlobalAPI(m)
211-
if err != nil {
212-
return diag.FromErr(err)
213-
}
214-
215-
projectID := d.Id()
216-
184+
diags := diag.Diagnostics{}
217185
if d.HasChange("plan") {
218-
targetPlan := cockpit.PlanNameFree.String()
219-
if targetPlanI, ok := d.GetOk("plan"); ok {
220-
targetPlan = targetPlanI.(string)
221-
}
222-
223-
plans, err := api.ListPlans(&cockpit.GlobalAPIListPlansRequest{}, scw.WithContext(ctx), scw.WithAllPages()) //nolint:staticcheck
224-
if err != nil {
225-
return diag.FromErr(err)
226-
}
227-
228-
var planName string
229-
230-
for _, plan := range plans.Plans {
231-
if plan.Name.String() == targetPlan {
232-
planName = plan.Name.String()
233-
234-
break
235-
}
236-
}
237-
238-
if planName == "" {
239-
return diag.Errorf("plan %s not found", targetPlan)
240-
}
241-
242-
_, err = api.SelectPlan(&cockpit.GlobalAPISelectPlanRequest{ //nolint:staticcheck
243-
ProjectID: projectID,
244-
PlanName: cockpit.PlanName(planName),
245-
}, scw.WithContext(ctx))
246-
if err != nil {
247-
return diag.FromErr(err)
248-
}
186+
diags = append(diags, diag.Diagnostic{
187+
Severity: diag.Warning,
188+
Summary: "Deprecated attribute update: 'plan'",
189+
Detail: "Updating 'plan' has no effect as it is deprecated and will be removed in a future version.",
190+
})
249191
}
250192

251-
return ResourceCockpitRead(ctx, d, m)
193+
diags = append(diags, ResourceCockpitRead(ctx, d, m)...)
194+
195+
return diags
252196
}
253197

254-
func ResourceCockpitDelete(_ context.Context, _ *schema.ResourceData, _ interface{}) diag.Diagnostics {
198+
func ResourceCockpitDelete(_ context.Context, d *schema.ResourceData, _ interface{}) diag.Diagnostics {
199+
d.SetId("")
200+
255201
return nil
256202
}

0 commit comments

Comments
 (0)