Skip to content

Commit

Permalink
Add ImportState func. (#14)
Browse files Browse the repository at this point in the history
Co-authored-by: xiaotongwong <[email protected]>
  • Loading branch information
WongXiaoTong and xiaotongwong authored Jul 3, 2023
1 parent ea29f27 commit 0453235
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions alicloud/resource_ram_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/cenkalti/backoff/v4"
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
Expand Down Expand Up @@ -272,6 +273,10 @@ func (r *ramPolicyResource) Delete(ctx context.Context, req resource.DeleteReque
}
}

func (r *ramPolicyResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
}

func (r *ramPolicyResource) createPolicy(plan *ramPolicyResourceModel) (policiesList []attr.Value, err error) {
formattedPolicy, err := r.getPolicyDocument(plan)
if err != nil {
Expand Down

0 comments on commit 0453235

Please sign in to comment.