Skip to content

Commit 3f116bb

Browse files
authored
Merge branch 'master' into feat/add-secret-data-wo
2 parents 7967cce + 3eee796 commit 3f116bb

28 files changed

+19942
-18374
lines changed

.github/workflows/documentation.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,14 @@ jobs:
6161
go-version: stable
6262
- name: Install Terraform
6363
uses: hashicorp/setup-terraform@v3
64-
- run: go tool tfplugindocs validate
65-
- run: rm -fr ./docs
66-
- run: go tool tfplugindocs generate
64+
- run: make docs
6765
- run: git diff --exit-code docs
66+
67+
terraform_fmt:
68+
runs-on: ubuntu-latest
69+
steps:
70+
- uses: actions/checkout@v6
71+
- name: Install Terraform
72+
uses: hashicorp/setup-terraform@v3
73+
- name: Run terraform fmt on examples folder
74+
run: terraform fmt -recursive -check -diff examples

GNUmakefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ tfproviderdocs:
6464
tfproviderlintx:
6565
go tool tfproviderlintx -XR001=false -XS002=false ./...
6666

67-
docs:
67+
format_examples:
68+
terraform fmt -recursive examples
69+
70+
docs: format_examples
6871
go tool tfplugindocs validate
6972
rm -fr ./docs
7073
go tool tfplugindocs generate

docs/resources/apple_silicon_server.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ page_title: "Scaleway: scaleway_apple_silicon"
55

66
# Resource: scaleway_apple_silicon_server
77

8-
Creates and manages Scaleway Apple silicon. For more information,
9-
see the [API documentation](https://www.scaleway.com/en/developers/api/apple-silicon/).
8+
The [`scaleway_apple_silicon_server`](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/apple_silicon_server) resource creates and manages Scaleway Apple silicon servers.
9+
10+
For more information, see the [API documentation](https://www.scaleway.com/en/developers/api/apple-silicon/).
1011

1112
## Example Usage
1213

examples/instance-servers/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ resource "scaleway_instance_ip" "ip" {
1111
}
1212

1313
resource "scaleway_instance_server" "server" {
14-
count = var.server_count
15-
type = "PLAY2-MICRO"
16-
image = "ubuntu_jammy"
14+
count = var.server_count
15+
type = "PLAY2-MICRO"
16+
image = "ubuntu_jammy"
1717
ip_ids = [scaleway_instance_ip.ip[count.index].id]
1818
}

internal/locality/regional/schemas_framework.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package regional
22

33
import (
44
"github.com/hashicorp/terraform-plugin-framework/action/schema"
5+
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
56
"github.com/scaleway/scaleway-sdk-go/scw"
7+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
68
)
79

810
// AllRegions returns all valid Scaleway regions as strings
@@ -16,9 +18,17 @@ func AllRegions() []string {
1618
}
1719

1820
// SchemaAttribute returns a Plugin Framework schema attribute for a region field
19-
func SchemaAttribute() schema.StringAttribute {
21+
func SchemaAttribute(description ...string) schema.StringAttribute {
22+
desc := "The region you want to attach the resource to"
23+
if len(description) > 0 {
24+
desc = description[0]
25+
}
26+
2027
return schema.StringAttribute{
2128
Optional: true,
22-
Description: "The region you want to attach the resource to",
29+
Description: desc,
30+
Validators: []validator.String{
31+
verify.IsStringOneOfWithWarning(AllRegions()),
32+
},
2333
}
2434
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package zonal
2+
3+
import (
4+
"github.com/hashicorp/terraform-plugin-framework/action/schema"
5+
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
6+
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
7+
)
8+
9+
// SchemaAttribute returns a Plugin Framework schema attribute for a zone field
10+
func SchemaAttribute(description string) schema.StringAttribute {
11+
return schema.StringAttribute{
12+
Optional: true,
13+
Description: description,
14+
Validators: []validator.String{
15+
verify.IsStringOneOfWithWarning(AllZones()),
16+
},
17+
}
18+
}

internal/services/baremetal/server.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -382,31 +382,32 @@ func ResourceServerCreate(ctx context.Context, d *schema.ResourceData, m any) di
382382
req.UserData = &cloudInitStr
383383
}
384384

385-
partitioningSchema := baremetal.Schema{}
386-
387385
if file, ok := d.GetOk("partitioning"); ok || !d.Get("install_config_afterward").(bool) {
388386
if diags := validateInstallConfig(ctx, d, m); len(diags) > 0 {
389387
return diags
390388
}
391389

390+
req.Install = &baremetal.CreateServerRequestInstall{
391+
OsID: zonal.ExpandID(d.Get("os")).ID,
392+
Hostname: d.Get("hostname").(string),
393+
SSHKeyIDs: types.ExpandStrings(d.Get("ssh_key_ids")),
394+
User: types.ExpandStringPtr(d.Get("user")),
395+
Password: types.ExpandStringPtr(d.Get("password")),
396+
ServicePassword: types.ExpandStringPtr(d.Get("service_password")),
397+
ServiceUser: types.ExpandStringPtr(d.Get("service_user")),
398+
}
399+
400+
partitioningSchema := baremetal.Schema{}
401+
392402
if file != "" {
393403
todecode, _ := file.(string)
394404

395405
err = json.Unmarshal([]byte(todecode), &partitioningSchema)
396406
if err != nil {
397407
return diag.FromErr(err)
398408
}
399-
}
400409

401-
req.Install = &baremetal.CreateServerRequestInstall{
402-
OsID: zonal.ExpandID(d.Get("os")).ID,
403-
Hostname: d.Get("hostname").(string),
404-
SSHKeyIDs: types.ExpandStrings(d.Get("ssh_key_ids")),
405-
User: types.ExpandStringPtr(d.Get("user")),
406-
Password: types.ExpandStringPtr(d.Get("password")),
407-
PartitioningSchema: &partitioningSchema,
408-
ServicePassword: types.ExpandStringPtr(d.Get("service_password")),
409-
ServiceUser: types.ExpandStringPtr(d.Get("service_user")),
410+
req.Install.PartitioningSchema = &partitioningSchema
410411
}
411412
}
412413

internal/services/baremetal/testdata/data-source-server-basic.cassette.yaml

Lines changed: 1425 additions & 1327 deletions
Large diffs are not rendered by default.

internal/services/baremetal/testdata/server-add-another-private-network.cassette.yaml

Lines changed: 1817 additions & 1425 deletions
Large diffs are not rendered by default.

internal/services/baremetal/testdata/server-add-option.cassette.yaml

Lines changed: 1199 additions & 1787 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)