diff --git a/docs/resources/volume.md b/docs/resources/volume.md index 1867382..0650c80 100644 --- a/docs/resources/volume.md +++ b/docs/resources/volume.md @@ -19,9 +19,9 @@ Manages a storage volume resource - `name` (String) Resource name - `project` (String) Associated project name or ID +- `region` (String) Associated region name or ID - `size` (Number) The volume size (expressed in GB) - `type` (String) The volume type (valid options: 'os', 'iso', 'raw') -- `zone` (String) Associated zone name or ID ### Optional diff --git a/go.mod b/go.mod index 3c03c42..5923c78 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 require ( github.com/3th1nk/cidr v0.2.0 github.com/AfterShip/email-verifier v1.4.0 - github.com/dalet-oss/kowabunga-api v0.30.0 + github.com/dalet-oss/kowabunga-api v0.31.0 github.com/hashicorp/terraform-plugin-docs v0.16.0 github.com/hashicorp/terraform-plugin-framework v1.4.2 github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 diff --git a/go.sum b/go.sum index 364d9fd..2dbf71f 100644 --- a/go.sum +++ b/go.sum @@ -28,8 +28,8 @@ github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7N github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= -github.com/dalet-oss/kowabunga-api v0.30.0 h1:FJw2lmOT6MCXtIn6oolLdTrb2K79ssoK9GqvVQElSzs= -github.com/dalet-oss/kowabunga-api v0.30.0/go.mod h1:AoV+X1yaCm4mxSnY+z5tfRPQqpYURioy/bXp5bB/pQc= +github.com/dalet-oss/kowabunga-api v0.31.0 h1:1dXvdONKIvvOZgMKH/9vxK/MmhcPPFUmpKyevE/dIM0= +github.com/dalet-oss/kowabunga-api v0.31.0/go.mod h1:AoV+X1yaCm4mxSnY+z5tfRPQqpYURioy/bXp5bB/pQc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/internal/provider/kowabunga_volume_resource.go b/internal/provider/kowabunga_volume_resource.go index dd4dd38..07141d9 100644 --- a/internal/provider/kowabunga_volume_resource.go +++ b/internal/provider/kowabunga_volume_resource.go @@ -35,7 +35,7 @@ type VolumeResourceModel struct { Name types.String `tfsdk:"name"` Desc types.String `tfsdk:"desc"` Project types.String `tfsdk:"project"` - Zone types.String `tfsdk:"zone"` + Region types.String `tfsdk:"region"` Pool types.String `tfsdk:"pool"` Template types.String `tfsdk:"template"` Type types.String `tfsdk:"type"` @@ -62,8 +62,8 @@ func (r *VolumeResource) Schema(ctx context.Context, req resource.SchemaRequest, MarkdownDescription: "Associated project name or ID", Required: true, }, - KeyZone: schema.StringAttribute{ - MarkdownDescription: "Associated zone name or ID", + KeyRegion: schema.StringAttribute{ + MarkdownDescription: "Associated region name or ID", Required: true, }, KeyPool: schema.StringAttribute{ @@ -133,8 +133,8 @@ func (r *VolumeResource) Create(ctx context.Context, req resource.CreateRequest, errorCreateGeneric(resp, err) return } - // find parent zone - zoneId, err := getZoneID(ctx, r.Data, data.Zone.ValueString()) + // find parent region + regionId, err := getRegionID(ctx, r.Data, data.Region.ValueString()) if err != nil { errorCreateGeneric(resp, err) return @@ -147,7 +147,7 @@ func (r *VolumeResource) Create(ctx context.Context, req resource.CreateRequest, // create a new volume m := volumeResourceToModel(data) - api := r.Data.K.ProjectAPI.CreateProjectZoneVolume(ctx, projectId, zoneId).Volume(m) + api := r.Data.K.ProjectAPI.CreateProjectRegionVolume(ctx, projectId, regionId).Volume(m) if poolId != "" { api = api.PoolId(poolId) }