Skip to content

Conversation

yfodil
Copy link
Contributor

@yfodil yfodil commented Jun 5, 2025

Import can be done by identity now:

import {
  to       = scaleway_vpc.main
  identity = {
    id     = "11111111-1111-1111-1111-111111111111"
    region = "fr-par"
  }
}


resource "scaleway_vpc" "main" {}

@yfodil yfodil self-assigned this Jun 5, 2025
@yfodil yfodil added enhancement vpc Virtual Private Cloud (VPC) issues, bugs and feature requests labels Jun 5, 2025
@@ -21,7 +23,56 @@ func ResourceVPC() *schema.Resource {
UpdateContext: ResourceVPCUpdate,
DeleteContext: ResourceVPCDelete,
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
StateContext: func(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there a way to make a global function, since it'll basically be the same across all resources, right?

@yfodil yfodil marked this pull request as ready for review September 9, 2025 07:59
@yfodil yfodil requested review from a team and remyleone as code owners September 9, 2025 07:59
d *schema.ResourceData,
fallbackDefaultRegion func(*schema.ResourceData) (scw.Region, error),
) (scw.Region, string, error) {
if identity, err := d.Identity(); err == nil && identity != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you have a more flatten structure with returning early in case of an error? It would be helpful to generate logs here using tflog and passing the context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
baremetal enhancement vpc Virtual Private Cloud (VPC) issues, bugs and feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants