Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
Use schema.ImportStatePassthroughContext. (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
linouk23 committed Nov 3, 2021
1 parent 61c15b1 commit 26f79b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions internal/provider/resource_environment.go
Expand Up @@ -32,7 +32,7 @@ func environmentResource() *schema.Resource {
UpdateContext: environmentUpdate,
DeleteContext: environmentDelete,
Importer: &schema.ResourceImporter{
StateContext: environmentImport,
StateContext: schema.ImportStatePassthroughContext,
},
Schema: map[string]*schema.Schema{
paramDisplayName: {
Expand Down Expand Up @@ -104,10 +104,6 @@ func environmentDelete(ctx context.Context, d *schema.ResourceData, meta interfa
return nil
}

func environmentImport(_ context.Context, d *schema.ResourceData, _ interface{}) ([]*schema.ResourceData, error) {
return []*schema.ResourceData{d}, nil
}

func executeEnvironmentRead(ctx context.Context, c *Client, environmentId string) (org.V2Environment, *http.Response, error) {
req := c.orgClient.EnvironmentsV2Api.GetV2Environment(c.orgApiContext(ctx), environmentId)
return req.Execute()
Expand Down
6 changes: 1 addition & 5 deletions internal/provider/resource_service_account.go
Expand Up @@ -32,7 +32,7 @@ func serviceAccountResource() *schema.Resource {
UpdateContext: serviceAccountUpdate,
DeleteContext: serviceAccountDelete,
Importer: &schema.ResourceImporter{
StateContext: serviceAccountImport,
StateContext: schema.ImportStatePassthroughContext,
},
Schema: map[string]*schema.Schema{
paramDisplayName: {
Expand Down Expand Up @@ -115,10 +115,6 @@ func serviceAccountDelete(ctx context.Context, d *schema.ResourceData, meta inte
return nil
}

func serviceAccountImport(_ context.Context, d *schema.ResourceData, _ interface{}) ([]*schema.ResourceData, error) {
return []*schema.ResourceData{d}, nil
}

func executeServiceAccountRead(ctx context.Context, c *Client, serviceAccountId string) (iam.V2ServiceAccount, *http.Response, error) {
req := c.iamClient.ServiceAccountsV2Api.GetV2ServiceAccount(c.iamApiContext(ctx), serviceAccountId)
return req.Execute()
Expand Down

0 comments on commit 26f79b5

Please sign in to comment.