Skip to content

Commit 54501e8

Browse files
committed
add
1 parent a6c3404 commit 54501e8

File tree

2 files changed

+117
-111
lines changed

2 files changed

+117
-111
lines changed

tencentcloud/services/cvm/resource_tc_cvm_action_timer.go

Lines changed: 112 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -48,52 +48,54 @@ func ResourceTencentCloudCvmActionTimer() *schema.Resource {
4848
ForceNew: true,
4949
Description: "Execution time, expressed according to ISO8601 standard and using UTC time. The format is YYYY-MM-DDThh:mm:ssZ. For example, 2018-05-29T11:26:40Z, the execution time must be 5 minutes longer than the current time.",
5050
},
51-
//"externals": {
52-
// Type: schema.TypeList,
53-
// MaxItems: 1,
54-
// Optional: true,
55-
// Description: "Extended data.",
56-
// Elem: &schema.Resource{
57-
// Schema: map[string]*schema.Schema{
58-
// "release_address": {
59-
// Type: schema.TypeBool,
60-
// Optional: true,
61-
// Description: "Whether to release address of this instance.",
62-
// },
63-
// "unsupport_networks": {
64-
// Type: schema.TypeSet,
65-
// Elem: &schema.Schema{Type: schema.TypeString},
66-
// Optional: true,
67-
// Description: "Unsupported network type, Value range: BASIC - Basic Network; VPC1.0 - Private Network VPC1.0.",
68-
// },
69-
// "storage_block_attr": {
70-
// Type: schema.TypeList,
71-
// MaxItems: 1,
72-
// Optional: true,
73-
// Description: "HDD local storage properties.",
74-
// Elem: &schema.Resource{
75-
// Schema: map[string]*schema.Schema{
76-
// "type": {
77-
// Type: schema.TypeString,
78-
// Optional: true,
79-
// Description: "HDD local storage type, Value is: LOCAL_PRO.",
80-
// },
81-
// "min_size": {
82-
// Type: schema.TypeInt,
83-
// Optional: true,
84-
// Description: "Minimum capacity for HDD local storage.",
85-
// },
86-
// "max_size": {
87-
// Type: schema.TypeInt,
88-
// Optional: true,
89-
// Description: "Maximum capacity of HDD local storage.",
90-
// },
91-
// },
92-
// },
93-
// },
94-
// },
95-
// },
96-
//},
51+
"externals": {
52+
Type: schema.TypeList,
53+
MaxItems: 1,
54+
Optional: true,
55+
ForceNew: true,
56+
Description: "Extended data.",
57+
Elem: &schema.Resource{
58+
Schema: map[string]*schema.Schema{
59+
"release_address": {
60+
Type: schema.TypeBool,
61+
Optional: true,
62+
ForceNew: true,
63+
Description: "Whether to release address of this instance.",
64+
},
65+
//"unsupport_networks": {
66+
// Type: schema.TypeSet,
67+
// Elem: &schema.Schema{Type: schema.TypeString},
68+
// Optional: true,
69+
// Description: "Unsupported network type, Value range: BASIC - Basic Network; VPC1.0 - Private Network VPC1.0.",
70+
//},
71+
//"storage_block_attr": {
72+
// Type: schema.TypeList,
73+
// MaxItems: 1,
74+
// Optional: true,
75+
// Description: "HDD local storage properties.",
76+
// Elem: &schema.Resource{
77+
// Schema: map[string]*schema.Schema{
78+
// "type": {
79+
// Type: schema.TypeString,
80+
// Optional: true,
81+
// Description: "HDD local storage type, Value is: LOCAL_PRO.",
82+
// },
83+
// "min_size": {
84+
// Type: schema.TypeInt,
85+
// Optional: true,
86+
// Description: "Minimum capacity for HDD local storage.",
87+
// },
88+
// "max_size": {
89+
// Type: schema.TypeInt,
90+
// Optional: true,
91+
// Description: "Maximum capacity of HDD local storage.",
92+
// },
93+
// },
94+
// },
95+
//},
96+
},
97+
},
98+
},
9799
},
98100
},
99101
},
@@ -125,41 +127,41 @@ func resourceTencentCloudCvmActionTimerCreate(d *schema.ResourceData, meta inter
125127
actionTimer.ActionTime = helper.String(v.(string))
126128
}
127129

128-
//if externalsMap, ok := helper.InterfaceToMap(dMap, "externals"); ok {
129-
// externals := cvm.Externals{}
130-
// if v, ok := externalsMap["release_address"]; ok {
131-
// externals.ReleaseAddress = helper.Bool(v.(bool))
132-
// }
133-
//
134-
// if v, ok := externalsMap["unsupport_networks"]; ok {
135-
// unsupportNetworksSet := v.(*schema.Set).List()
136-
// for i := range unsupportNetworksSet {
137-
// if unsupportNetworksSet[i] != nil {
138-
// unsupportNetworks := unsupportNetworksSet[i].(string)
139-
// externals.UnsupportNetworks = append(externals.UnsupportNetworks, &unsupportNetworks)
140-
// }
141-
// }
142-
// }
143-
//
144-
// if storageBlockAttrMap, ok := helper.InterfaceToMap(externalsMap, "storage_block_attr"); ok {
145-
// storageBlock := cvm.StorageBlock{}
146-
// if v, ok := storageBlockAttrMap["type"]; ok {
147-
// storageBlock.Type = helper.String(v.(string))
148-
// }
149-
//
150-
// if v, ok := storageBlockAttrMap["min_size"]; ok {
151-
// storageBlock.MinSize = helper.IntInt64(v.(int))
152-
// }
153-
//
154-
// if v, ok := storageBlockAttrMap["max_size"]; ok {
155-
// storageBlock.MaxSize = helper.IntInt64(v.(int))
156-
// }
157-
//
158-
// externals.StorageBlockAttr = &storageBlock
159-
// }
160-
//
161-
// actionTimer.Externals = &externals
162-
//}
130+
if externalsMap, ok := helper.InterfaceToMap(dMap, "externals"); ok {
131+
externals := cvm.Externals{}
132+
if v, ok := externalsMap["release_address"]; ok {
133+
externals.ReleaseAddress = helper.Bool(v.(bool))
134+
}
135+
136+
//if v, ok := externalsMap["unsupport_networks"]; ok {
137+
// unsupportNetworksSet := v.(*schema.Set).List()
138+
// for i := range unsupportNetworksSet {
139+
// if unsupportNetworksSet[i] != nil {
140+
// unsupportNetworks := unsupportNetworksSet[i].(string)
141+
// externals.UnsupportNetworks = append(externals.UnsupportNetworks, &unsupportNetworks)
142+
// }
143+
// }
144+
//}
145+
//
146+
//if storageBlockAttrMap, ok := helper.InterfaceToMap(externalsMap, "storage_block_attr"); ok {
147+
// storageBlock := cvm.StorageBlock{}
148+
// if v, ok := storageBlockAttrMap["type"]; ok {
149+
// storageBlock.Type = helper.String(v.(string))
150+
// }
151+
//
152+
// if v, ok := storageBlockAttrMap["min_size"]; ok {
153+
// storageBlock.MinSize = helper.IntInt64(v.(int))
154+
// }
155+
//
156+
// if v, ok := storageBlockAttrMap["max_size"]; ok {
157+
// storageBlock.MaxSize = helper.IntInt64(v.(int))
158+
// }
159+
//
160+
// externals.StorageBlockAttr = &storageBlock
161+
//}
162+
163+
actionTimer.Externals = &externals
164+
}
163165

164166
request.ActionTimer = &actionTimer
165167
}
@@ -222,36 +224,35 @@ func resourceTencentCloudCvmActionTimerRead(d *schema.ResourceData, meta interfa
222224
actionTimerMap["action_time"] = InstanceActionTimer.ActionTime
223225
}
224226

225-
//actionTimerMap["externals"] = []interface{}{}
226-
//if InstanceActionTimer.Externals != nil {
227-
// externalsMap := map[string]interface{}{}
228-
// if InstanceActionTimer.Externals.ReleaseAddress != nil {
229-
// externalsMap["release_address"] = InstanceActionTimer.Externals.ReleaseAddress
230-
// }
231-
//
232-
// if InstanceActionTimer.Externals.UnsupportNetworks != nil {
233-
// externalsMap["unsupport_networks"] = InstanceActionTimer.Externals.UnsupportNetworks
234-
// }
235-
//
236-
// if InstanceActionTimer.Externals.StorageBlockAttr != nil {
237-
// storageBlockAttrMap := map[string]interface{}{}
238-
// if InstanceActionTimer.Externals.StorageBlockAttr.Type != nil {
239-
// storageBlockAttrMap["type"] = InstanceActionTimer.Externals.StorageBlockAttr.Type
240-
// }
241-
//
242-
// if InstanceActionTimer.Externals.StorageBlockAttr.MinSize != nil {
243-
// storageBlockAttrMap["min_size"] = InstanceActionTimer.Externals.StorageBlockAttr.MinSize
244-
// }
245-
//
246-
// if InstanceActionTimer.Externals.StorageBlockAttr.MaxSize != nil {
247-
// storageBlockAttrMap["max_size"] = InstanceActionTimer.Externals.StorageBlockAttr.MaxSize
248-
// }
249-
//
250-
// externalsMap["storage_block_attr"] = []interface{}{storageBlockAttrMap}
251-
// }
252-
//
253-
// actionTimerMap["externals"] = []interface{}{externalsMap}
254-
//}
227+
if InstanceActionTimer.Externals != nil {
228+
externalsMap := map[string]interface{}{}
229+
if InstanceActionTimer.Externals.ReleaseAddress != nil {
230+
externalsMap["release_address"] = InstanceActionTimer.Externals.ReleaseAddress
231+
}
232+
233+
//if InstanceActionTimer.Externals.UnsupportNetworks != nil {
234+
// externalsMap["unsupport_networks"] = InstanceActionTimer.Externals.UnsupportNetworks
235+
//}
236+
//
237+
//if InstanceActionTimer.Externals.StorageBlockAttr != nil {
238+
// storageBlockAttrMap := map[string]interface{}{}
239+
// if InstanceActionTimer.Externals.StorageBlockAttr.Type != nil {
240+
// storageBlockAttrMap["type"] = InstanceActionTimer.Externals.StorageBlockAttr.Type
241+
// }
242+
//
243+
// if InstanceActionTimer.Externals.StorageBlockAttr.MinSize != nil {
244+
// storageBlockAttrMap["min_size"] = InstanceActionTimer.Externals.StorageBlockAttr.MinSize
245+
// }
246+
//
247+
// if InstanceActionTimer.Externals.StorageBlockAttr.MaxSize != nil {
248+
// storageBlockAttrMap["max_size"] = InstanceActionTimer.Externals.StorageBlockAttr.MaxSize
249+
// }
250+
//
251+
// externalsMap["storage_block_attr"] = []interface{}{storageBlockAttrMap}
252+
//}
253+
254+
actionTimerMap["externals"] = []interface{}{externalsMap}
255+
}
255256

256257
_ = d.Set("action_timer", []interface{}{actionTimerMap})
257258

website/docs/r/cvm_action_timer.html.markdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,13 @@ The following arguments are supported:
8383
The `action_timer` object supports the following:
8484

8585
* `action_time` - (Optional, String, ForceNew) Execution time, expressed according to ISO8601 standard and using UTC time. The format is YYYY-MM-DDThh:mm:ssZ. For example, 2018-05-29T11:26:40Z, the execution time must be 5 minutes longer than the current time.
86+
* `externals` - (Optional, List, ForceNew) Extended data.
8687
* `timer_action` - (Optional, String, ForceNew) Timer action, currently only supports destroying one value: TerminateInstances.
8788

89+
The `externals` object of `action_timer` supports the following:
90+
91+
* `release_address` - (Optional, Bool, ForceNew) Whether to release address of this instance.
92+
8893
## Attributes Reference
8994

9095
In addition to all arguments above, the following attributes are exported:

0 commit comments

Comments
 (0)