Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/data-sources/instance_servers.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ In addition to all above arguments, the following attributes are exported:
- `zone` - The [zone](../guides/regions_and_zones.md#zones) in which the server is.
- `name` - The name of the server.
- `boot_type` - The boot Type of the server. Possible values are: `local`, `bootscript` or `rescue`.
- `bootscript_id` - The ID of the bootscript.
- `type` - The commercial type of the server.
- `security_group_id` - The [security group](https://developers.scaleway.com/en/products/instance/api/#security-groups-8d7f89) the server is attached to.
- `enable_ipv6` - Determines if IPv6 is enabled for the server.
Expand Down
2 changes: 0 additions & 2 deletions docs/resources/instance_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ attached to the server. Updates to this field will trigger a stop/start of the s

- `replace_on_type_change` - (Defaults to false) If true, the server will be replaced if `type` is changed. Otherwise, the server will migrate.

- `bootscript_id` (Deprecated) - The ID of the bootscript to use (set boot_type to `bootscript`).

- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the server should be created.

- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the server is associated with.
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/nats-io/jwt/v2 v2.7.0
github.com/nats-io/nats.go v1.37.0
github.com/robfig/cron/v3 v3.0.1
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241016121547-71e46305b9a0
github.com/stretchr/testify v1.9.0
golang.org/x/crypto v0.27.0
gopkg.in/dnaeon/go-vcr.v3 v3.2.0
Expand Down Expand Up @@ -110,7 +110,7 @@ require (
golang.org/x/net v0.26.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/appengine v1.6.8 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXq
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30 h1:yoKAVkEVwAqbGbR8n87rHQ1dulL25rKloGadb3vm770=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30/go.mod h1:sH0u6fq6x4R5M7WxkoQFY/o7UaiItec0o1LinLCJNq8=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241016121547-71e46305b9a0 h1:bykODWS911XOzQZ+WfJ2NmWmFcB0Iuod5+brNIUeNqE=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241016121547-71e46305b9a0/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg=
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
Expand Down Expand Up @@ -361,8 +361,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down
3 changes: 2 additions & 1 deletion internal/services/iam/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ func ResourceUser() *schema.Resource {

func resourceIamUserCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
api := NewAPI(m)
email := d.Get("email").(string)
user, err := api.CreateUser(&iam.CreateUserRequest{
OrganizationID: d.Get("organization_id").(string),
Email: d.Get("email").(string),
Email: &email,
}, scw.WithContext(ctx))
if err != nil {
return diag.FromErr(err)
Expand Down
26 changes: 1 addition & 25 deletions internal/services/instance/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,6 @@ func ResourceInstanceServerCreate(ctx context.Context, d *schema.ResourceData, m
req.EnableIPv6 = scw.BoolPtr(enableIPv6.(bool)) //nolint:staticcheck
}

if bootScriptID, ok := d.GetOk("bootscript_id"); ok {
req.Bootscript = types.ExpandStringPtr(bootScriptID) //nolint:staticcheck
}

if bootType, ok := d.GetOk("boot_type"); ok {
bootType := instanceSDK.BootType(bootType.(string))
req.BootType = &bootType
Expand All @@ -438,10 +434,6 @@ func ResourceInstanceServerCreate(ctx context.Context, d *schema.ResourceData, m

if ipIDs, ok := d.GetOk("ip_ids"); ok {
req.PublicIPs = types.ExpandSliceIDsPtr(ipIDs)
// If server has multiple IPs, routed ip must be enabled per default
if types.GetBool(d, "routed_ip_enabled") == nil {
req.RoutedIPEnabled = scw.BoolPtr(true)
}
}

if placementGroupID, ok := d.GetOk("placement_group_id"); ok {
Expand Down Expand Up @@ -617,11 +609,6 @@ func ResourceInstanceServerRead(ctx context.Context, d *schema.ResourceData, m i
_ = d.Set("name", server.Name)
_ = d.Set("boot_type", server.BootType)

// Bootscript is deprecated
if server.Bootscript != nil { //nolint:staticcheck
_ = d.Set("bootscript_id", server.Bootscript.ID) //nolint:staticcheck
}

_ = d.Set("type", server.CommercialType)
if len(server.Tags) > 0 {
_ = d.Set("tags", server.Tags)
Expand All @@ -632,7 +619,7 @@ func ResourceInstanceServerRead(ctx context.Context, d *schema.ResourceData, m i
_ = d.Set("enable_dynamic_ip", server.DynamicIPRequired)
_ = d.Set("organization_id", server.Organization)
_ = d.Set("project_id", server.Project)
_ = d.Set("routed_ip_enabled", server.RoutedIPEnabled)
_ = d.Set("routed_ip_enabled", server.RoutedIPEnabled) //nolint:staticcheck

// Image could be empty in an import context.
image := regional.ExpandID(d.Get("image").(string))
Expand Down Expand Up @@ -923,17 +910,6 @@ func ResourceInstanceServerUpdate(ctx context.Context, d *schema.ResourceData, m
}
}

if d.HasChanges("bootscript_id") {
serverShouldUpdate = true
updateRequest.Bootscript = types.ExpandStringPtr(d.Get("bootscript_id").(string))
if !isStopped {
warnings = append(warnings, diag.Diagnostic{
Severity: diag.Warning,
Summary: "instanceSDK may need to be rebooted to use the new bootscript",
})
}
}

////
// Update server user data
////
Expand Down
32 changes: 0 additions & 32 deletions internal/services/instance/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -956,38 +956,6 @@ func serverHasNewVolume(_ *acctest.TestTools, n string) resource.TestCheckFunc {
}
}

// bootscript are marked as deprecated
func TestAccServer_Bootscript(t *testing.T) {
t.Skip("Creation of bootscript server is no longer supported")
tt := acctest.NewTestTools(t)
defer tt.Cleanup()
// Quick tip to get all the different bootscript:
// curl -sH "X-Auth-Token: $(scw config get secret-key)" https://api.scaleway.com/instance/v1/zones/fr-par-1/bootscripts | jq -r '.bootscripts[] | [.id, .architecture, .title] | @tsv'
bootscript := "7decf961-d3e9-4711-93c7-b16c254e99b9"
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t) },
ProviderFactories: tt.ProviderFactories,
CheckDestroy: instancechecks.IsServerDestroyed(tt),
Steps: []resource.TestStep{
{
Config: fmt.Sprintf(`
resource "scaleway_instance_server" "base" {
type = "DEV1-S"
image = "ubuntu_focal"
boot_type = "bootscript"
bootscript_id = "%s"
routed_ip_enabled = false
}
`, bootscript),
Check: resource.ComposeTestCheckFunc(
isServerPresent(tt, "scaleway_instance_server.base"),
resource.TestCheckResourceAttr("scaleway_instance_server.base", "bootscript_id", bootscript),
),
},
},
})
}

func TestAccServer_AlterTags(t *testing.T) {
tt := acctest.NewTestTools(t)
defer tt.Cleanup()
Expand Down
5 changes: 1 addition & 4 deletions internal/services/instance/servers_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@ func DataSourceInstanceServersRead(ctx context.Context, d *schema.ResourceData,
rawServer["zone"] = string(zone)
rawServer["name"] = server.Name
rawServer["boot_type"] = server.BootType
if server.Bootscript != nil { //nolint:staticcheck
rawServer["bootscript_id"] = server.Bootscript.ID //nolint:staticcheck
}
rawServer["type"] = server.CommercialType
if len(server.Tags) > 0 {
rawServer["tags"] = server.Tags
Expand All @@ -197,7 +194,7 @@ func DataSourceInstanceServersRead(ctx context.Context, d *schema.ResourceData,
rawServer["enable_ipv6"] = server.EnableIPv6 //nolint:staticcheck
}
rawServer["enable_dynamic_ip"] = server.DynamicIPRequired
rawServer["routed_ip_enabled"] = server.RoutedIPEnabled
rawServer["routed_ip_enabled"] = server.RoutedIPEnabled //nolint:staticcheck
rawServer["organization_id"] = server.Organization
rawServer["project_id"] = server.Project
if server.Image != nil {
Expand Down
468 changes: 234 additions & 234 deletions internal/services/instance/testdata/server-ips-removed.cassette.yaml

Large diffs are not rendered by default.

690 changes: 345 additions & 345 deletions internal/services/instance/testdata/server-ips.cassette.yaml

Large diffs are not rendered by default.

Loading
Loading