|
| 1 | +// |
| 2 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 3 | +// or more contributor license agreements. See the NOTICE file |
| 4 | +// distributed with this work for additional information |
| 5 | +// regarding copyright ownership. The ASF licenses this file |
| 6 | +// to you under the Apache License, Version 2.0 (the |
| 7 | +// "License"); you may not use this file except in compliance |
| 8 | +// with the License. You may obtain a copy of the License at |
| 9 | +// |
| 10 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +// |
| 12 | +// Unless required by applicable law or agreed to in writing, |
| 13 | +// software distributed under the License is distributed on an |
| 14 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | +// KIND, either express or implied. See the License for the |
| 16 | +// specific language governing permissions and limitations |
| 17 | +// under the License. |
| 18 | +// |
| 19 | + |
| 20 | +// Nested schema attributes arent validated |
| 21 | +// disk_offering, disk_hypervisor, disk_storage |
| 22 | +// ref: https://github.com/hashicorp/terraform-plugin-framework/issues/805 |
| 23 | + |
1 | 24 | package cloudstack |
2 | 25 |
|
3 | 26 | import ( |
@@ -85,15 +108,55 @@ func serviceOfferingMergeCommonSchema(s1 map[string]schema.Attribute) map[string |
85 | 108 | }, |
86 | 109 | Default: booldefault.StaticBool(false), |
87 | 110 | }, |
88 | | - "storage_tags": schema.StringAttribute{ |
89 | | - Description: "the tags for the service offering", |
90 | | - Optional: true, |
91 | | - }, |
92 | 111 | "zone_ids": schema.SetAttribute{ |
93 | 112 | Description: "The ID of the zone(s)", |
94 | 113 | Optional: true, |
95 | 114 | ElementType: types.StringType, |
96 | 115 | }, |
| 116 | + "disk_offering": schema.SingleNestedAttribute{ |
| 117 | + Optional: true, |
| 118 | + Attributes: map[string]schema.Attribute{ |
| 119 | + "cache_mode": schema.StringAttribute{ |
| 120 | + Description: "the cache mode to use for this disk offering. none, writeback or writethrough", |
| 121 | + Required: true, |
| 122 | + PlanModifiers: []planmodifier.String{ |
| 123 | + stringplanmodifier.RequiresReplace(), |
| 124 | + }, |
| 125 | + }, |
| 126 | + "disk_offering_strictness": schema.BoolAttribute{ |
| 127 | + Description: "True/False to indicate the strictness of the disk offering association with the compute offering. When set to true, override of disk offering is not allowed when VM is deployed and change disk offering is not allowed for the ROOT disk after the VM is deployed", |
| 128 | + Required: true, |
| 129 | + PlanModifiers: []planmodifier.Bool{ |
| 130 | + boolplanmodifier.RequiresReplace(), |
| 131 | + }, |
| 132 | + }, |
| 133 | + "provisioning_type": schema.StringAttribute{ |
| 134 | + Description: "provisioning type used to create volumes. Valid values are thin, sparse, fat.", |
| 135 | + Required: true, |
| 136 | + PlanModifiers: []planmodifier.String{ |
| 137 | + stringplanmodifier.RequiresReplace(), |
| 138 | + }, |
| 139 | + }, |
| 140 | + "root_disk_size": schema.Int64Attribute{ |
| 141 | + Description: "the Root disk size in GB.", |
| 142 | + Required: true, |
| 143 | + PlanModifiers: []planmodifier.Int64{ |
| 144 | + int64planmodifier.RequiresReplace(), |
| 145 | + }, |
| 146 | + }, |
| 147 | + "storage_type": schema.StringAttribute{ |
| 148 | + Description: "the storage type of the service offering. Values are local and shared.", |
| 149 | + Required: true, |
| 150 | + PlanModifiers: []planmodifier.String{ |
| 151 | + stringplanmodifier.RequiresReplace(), |
| 152 | + }, |
| 153 | + }, |
| 154 | + "storage_tags": schema.StringAttribute{ |
| 155 | + Description: "the tags for the service offering", |
| 156 | + Optional: true, |
| 157 | + }, |
| 158 | + }, |
| 159 | + }, |
97 | 160 | "disk_hypervisor": schema.SingleNestedAttribute{ |
98 | 161 | Optional: true, |
99 | 162 | Attributes: map[string]schema.Attribute{ |
@@ -141,46 +204,6 @@ func serviceOfferingMergeCommonSchema(s1 map[string]schema.Attribute) map[string |
141 | 204 | }, |
142 | 205 | }, |
143 | 206 | }, |
144 | | - "disk_offering": schema.SingleNestedAttribute{ |
145 | | - Optional: true, |
146 | | - Attributes: map[string]schema.Attribute{ |
147 | | - "cache_mode": schema.StringAttribute{ |
148 | | - Description: "the cache mode to use for this disk offering. none, writeback or writethrough", |
149 | | - Required: true, |
150 | | - PlanModifiers: []planmodifier.String{ |
151 | | - stringplanmodifier.RequiresReplace(), |
152 | | - }, |
153 | | - }, |
154 | | - "disk_offering_strictness": schema.BoolAttribute{ |
155 | | - Description: "True/False to indicate the strictness of the disk offering association with the compute offering. When set to true, override of disk offering is not allowed when VM is deployed and change disk offering is not allowed for the ROOT disk after the VM is deployed", |
156 | | - Required: true, |
157 | | - PlanModifiers: []planmodifier.Bool{ |
158 | | - boolplanmodifier.RequiresReplace(), |
159 | | - }, |
160 | | - }, |
161 | | - "provisioning_type": schema.StringAttribute{ |
162 | | - Description: "provisioning type used to create volumes. Valid values are thin, sparse, fat.", |
163 | | - Required: true, |
164 | | - PlanModifiers: []planmodifier.String{ |
165 | | - stringplanmodifier.RequiresReplace(), |
166 | | - }, |
167 | | - }, |
168 | | - "root_disk_size": schema.Int64Attribute{ |
169 | | - Description: "the Root disk size in GB.", |
170 | | - Required: true, |
171 | | - PlanModifiers: []planmodifier.Int64{ |
172 | | - int64planmodifier.RequiresReplace(), |
173 | | - }, |
174 | | - }, |
175 | | - "storage_type": schema.StringAttribute{ |
176 | | - Description: "the storage type of the service offering. Values are local and shared.", |
177 | | - Required: true, |
178 | | - PlanModifiers: []planmodifier.String{ |
179 | | - stringplanmodifier.RequiresReplace(), |
180 | | - }, |
181 | | - }, |
182 | | - }, |
183 | | - }, |
184 | 207 | "disk_storage": schema.SingleNestedAttribute{ |
185 | 208 | Optional: true, |
186 | 209 | Attributes: map[string]schema.Attribute{ |
|
0 commit comments