Skip to content

Commit ee0c87d

Browse files
committed
fix(resource): delete disk offering allocator_strategy and add virtual_router_offering public network uuid
1 parent 172d0e1 commit ee0c87d

File tree

7 files changed

+28
-19
lines changed

7 files changed

+28
-19
lines changed

docs/resources/disk_offer.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ output "zstack_disk_offer" {
3535

3636
### Optional
3737

38-
- `allocator_strategy` (String) The type of the allocator_strategy.
3938
- `description` (String) A description of the disk offering, providing additional context or details about the configuration.
4039

4140
### Read-Only

docs/resources/image.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ output "zstack_image" {
5555
- `boot_mode` (String) The boot mode supported by the image, such as 'Legacy' or 'UEFI'.
5656
- `description` (String) A description of the image, providing additional context or details.
5757
- `guest_os_type` (String) The guest operating system type that the image is optimized for.
58-
- `marketplace` (Boolean) Specifies whether the image is from a marketplace.
5958
- `media_type` (String) The type of media for the image. Examples include 'ISO' or 'Template' or DataVolumeTemplate.
6059
- `platform` (String) The platform that the image is intended for, such as 'Linux', 'Windows', or others.
6160
- `virtio` (Boolean) Indicates if the VirtIO drivers are required for the image.

docs/resources/virtual_router_offer.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ resource "zstack_virtual_router_offer" "test" {
2121
memory_size = 1024 # in megabytes, MB
2222
zone_uuid = "d29f4847a99f4dea83bc446c8fe6e64c"
2323
management_network_uuid = "50e8c0d69681447fbe347c8dae2b1bef"
24+
public_network_uuid = "50e8c0d69681447fbe347c8dae2b1bef"
2425
image_uuid = "93005c8a2a314a489635eca8c30794d4"
2526
}
2627
@@ -39,6 +40,7 @@ output "zstack_vroffer" {
3940
- `management_network_uuid` (String) The UUID of the management network associated with the virtual router offering. This is a mandatory field.
4041
- `memory_size` (Number) The amount of memory allocated to the virtual router offering. This is a mandatory field, in megabytes (MB)
4142
- `name` (String) The name of the virtual router offering. This is a mandatory field and must be unique.
43+
- `public_network_uuid` (String) The UUID of the public network associated with the virtual router offering. If not specified, it will share the same network UUID as the management network or vice versa, depending on the configuration.
4244
- `zone_uuid` (String) The UUID of the zone where the virtual router offering is deployed. This is a mandatory field.
4345

4446
### Optional

docs/resources/vpc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ output "zstack_vpc" {
3838

3939
### Required
4040

41-
- `description` (String) A description for the VPC network.
4241
- `l2_network_uuid` (String) The UUID of the L2 network associated with this VPC network.
4342
- `name` (String) The name of the VPC network.
4443
- `subnet_cidr` (Attributes) Details of the subnet CIDR to be configured in the VPC network. (see [below for nested schema](#nestedatt--subnet_cidr))
4544

4645
### Optional
4746

47+
- `description` (String) A description for the VPC network.
4848
- `dns` (String) Attach Dns Server for this VPC network.
4949
- `enable_ipam` (Boolean) Enable IP Address Management (IPAM) for this VPC network.
5050
- `virtual_router_uuid` (String) Attach virtual router for this VPC network.

examples/resources/virtual_router_offer/resource.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ resource "zstack_virtual_router_offer" "test" {
77
memory_size = 1024 # in megabytes, MB
88
zone_uuid = "d29f4847a99f4dea83bc446c8fe6e64c"
99
management_network_uuid = "50e8c0d69681447fbe347c8dae2b1bef"
10+
public_network_uuid = "50e8c0d69681447fbe347c8dae2b1bef"
1011
image_uuid = "93005c8a2a314a489635eca8c30794d4"
1112
}
1213

zstack/provider/resource_zstack_disk_offering.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ type diskOfferingResource struct {
2525
}
2626

2727
type diskOfferingResourceModel struct {
28-
Name types.String `tfsdk:"name"`
29-
Uuid types.String `tfsdk:"uuid"`
30-
Description types.String `tfsdk:"description"`
31-
DiskSize types.Int64 `tfsdk:"disk_size"`
32-
AllocatorStrategy types.String `tfsdk:"allocator_strategy"` // Allocation strategy
28+
Name types.String `tfsdk:"name"`
29+
Uuid types.String `tfsdk:"uuid"`
30+
Description types.String `tfsdk:"description"`
31+
DiskSize types.Int64 `tfsdk:"disk_size"`
32+
//AllocatorStrategy types.String `tfsdk:"allocator_strategy"` // Allocation strategy
3333
}
3434

3535
// Configure implements resource.ResourceWithConfigure.
@@ -67,10 +67,10 @@ func (r *diskOfferingResource) Create(ctx context.Context, req resource.CreateRe
6767
offerParam := param.CreateDiskOfferingParam{
6868
BaseParam: param.BaseParam{},
6969
Params: param.CreateDiskOfferingDetailParam{
70-
Name: plan.Name.ValueString(),
71-
Description: plan.Description.ValueStringPointer(),
72-
DiskSize: diskSizeBytes,
73-
AllocatorStrategy: plan.AllocatorStrategy.ValueStringPointer(),
70+
Name: plan.Name.ValueString(),
71+
Description: plan.Description.ValueStringPointer(),
72+
DiskSize: diskSizeBytes,
73+
//AllocatorStrategy: plan.AllocatorStrategy.ValueStringPointer(),
7474
},
7575
}
7676

@@ -87,7 +87,7 @@ func (r *diskOfferingResource) Create(ctx context.Context, req resource.CreateRe
8787
plan.Name = types.StringValue(disk_offer.Name)
8888
plan.Description = types.StringValue(disk_offer.Description)
8989
plan.DiskSize = types.Int64Value(utils.BytesToGB(int64(disk_offer.DiskSize)))
90-
plan.AllocatorStrategy = types.StringValue(disk_offer.AllocatorStrategy)
90+
// plan.AllocatorStrategy = types.StringValue(disk_offer.AllocatorStrategy)
9191

9292
diags = resp.State.Set(ctx, plan)
9393
resp.Diagnostics.Append(diags...)
@@ -143,7 +143,7 @@ func (r *diskOfferingResource) Read(ctx context.Context, req resource.ReadReques
143143
state.Description = types.StringValue(disk_offer.Description)
144144
state.Name = types.StringValue(disk_offer.Name)
145145
state.DiskSize = types.Int64Value(utils.BytesToGB(int64(disk_offer.DiskSize)))
146-
state.AllocatorStrategy = types.StringValue(disk_offer.AllocatorStrategy)
146+
//state.AllocatorStrategy = types.StringValue(disk_offer.AllocatorStrategy)
147147

148148
diags = resp.State.Set(ctx, &state)
149149
resp.Diagnostics.Append(diags...)
@@ -176,11 +176,13 @@ func (r *diskOfferingResource) Schema(_ context.Context, req resource.SchemaRequ
176176
Required: true,
177177
Description: "The amount of disk size allocated to the disk offering. This is a mandatory field, in gigabytes (GB).",
178178
},
179-
"allocator_strategy": schema.StringAttribute{
180-
Optional: true,
181-
Computed: true,
182-
Description: "The type of the allocator_strategy. ",
183-
},
179+
/*
180+
"allocator_strategy": schema.StringAttribute{
181+
Optional: true,
182+
Computed: true,
183+
Description: "The type of the allocator_strategy. ",
184+
},
185+
*/
184186
},
185187
}
186188
}

zstack/provider/resource_zstack_virtual_router_offering.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type virtualRouterOfferingResourceModel struct {
3131
CpuNum types.Int64 `tfsdk:"cpu_num"`
3232
MemorySize types.Int64 `tfsdk:"memory_size"`
3333
ManagementNetworkUuid types.String `tfsdk:"management_network_uuid"`
34+
PublicNetworkUuid types.String `tfsdk:"public_network_uuid"`
3435
ZoneUuid types.String `tfsdk:"zone_uuid"`
3536
ImageUuid types.String `tfsdk:"image_uuid"`
3637
IsDefault types.Bool `tfsdk:"is_default"`
@@ -77,6 +78,7 @@ func (r *virtualRouterOfferingResource) Create(ctx context.Context, req resource
7778
CpuNum: int(plan.CpuNum.ValueInt64()),
7879
MemorySize: utils.MBToBytes(plan.MemorySize.ValueInt64()), //plan.MemorySize.ValueInt64(),
7980
ManagementNetworkUuid: plan.ManagementNetworkUuid.ValueString(),
81+
PublicNetworkUuid: plan.PublicNetworkUuid.ValueString(),
8082
ZoneUuid: plan.ZoneUuid.ValueString(),
8183
ImageUuid: plan.ImageUuid.ValueString(),
8284
IsDefault: bool(plan.IsDefault.ValueBool()),
@@ -205,6 +207,10 @@ func (r *virtualRouterOfferingResource) Schema(_ context.Context, req resource.S
205207
Required: true,
206208
Description: "The UUID of the management network associated with the virtual router offering. This is a mandatory field.",
207209
},
210+
"public_network_uuid": schema.StringAttribute{
211+
Required: true,
212+
Description: "The UUID of the public network associated with the virtual router offering. If not specified, it will share the same network UUID as the management network or vice versa, depending on the configuration.",
213+
},
208214
"zone_uuid": schema.StringAttribute{
209215
Required: true,
210216
Description: "The UUID of the zone where the virtual router offering is deployed. This is a mandatory field.",

0 commit comments

Comments
 (0)