-
Notifications
You must be signed in to change notification settings - Fork 134
feat(vpc): add support for ResourceIdentity #3143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
internal/services/vpc/vpc.go
Outdated
@@ -21,7 +23,56 @@ func ResourceVPC() *schema.Resource { | |||
UpdateContext: ResourceVPCUpdate, | |||
DeleteContext: ResourceVPCDelete, | |||
Importer: &schema.ResourceImporter{ | |||
StateContext: schema.ImportStatePassthroughContext, | |||
StateContext: func( |
There was a problem hiding this comment.
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?
d *schema.ResourceData, | ||
fallbackDefaultRegion func(*schema.ResourceData) (scw.Region, error), | ||
) (scw.Region, string, error) { | ||
if identity, err := d.Identity(); err == nil && identity != nil { |
There was a problem hiding this comment.
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.
Import can be done by identity now: