File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ resource "kubernetes_pod" "dev" {
70
70
71
71
Required:
72
72
73
- - ` cmd ` (String) The command that retrieves the value of this metadata item.
73
+ - ` cmd ` (List of String) The command that retrieves the value of this metadata item.
74
74
- ` interval ` (Number) The interval in seconds at which to refresh this metadata item.
75
75
- ` key ` (String) The key of this metadata item.
76
76
Original file line number Diff line number Diff line change @@ -157,10 +157,13 @@ func agentResource() *schema.Resource {
157
157
Optional : true ,
158
158
},
159
159
"cmd" : {
160
- Type : schema .TypeString ,
160
+ Type : schema .TypeList ,
161
161
Description : "The command that retrieves the value of this metadata item." ,
162
162
ForceNew : true ,
163
163
Required : true ,
164
+ Elem : & schema.Schema {
165
+ Type : schema .TypeString ,
166
+ },
164
167
},
165
168
"interval" : {
166
169
Type : schema .TypeInt ,
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ func TestAgent_Metadata(t *testing.T) {
130
130
metadata {
131
131
key = "process_count"
132
132
display_name = "Process Count"
133
- cmd = " ps aux | wc -l"
133
+ cmd = ["sh", "-c", " ps aux | wc -l"]
134
134
interval = 5
135
135
}
136
136
}
@@ -148,7 +148,10 @@ func TestAgent_Metadata(t *testing.T) {
148
148
require .Equal (t , "1" , attr ["metadata.#" ])
149
149
require .Equal (t , "process_count" , attr ["metadata.0.key" ])
150
150
require .Equal (t , "Process Count" , attr ["metadata.0.display_name" ])
151
- require .Equal (t , "ps aux | wc -l" , attr ["metadata.0.cmd" ])
151
+ require .Equal (t , "3" , attr ["metadata.0.cmd.#" ])
152
+ require .Equal (t , "sh" , attr ["metadata.0.cmd.0" ])
153
+ require .Equal (t , "-c" , attr ["metadata.0.cmd.1" ])
154
+ require .Equal (t , "ps aux | wc -l" , attr ["metadata.0.cmd.2" ])
152
155
require .Equal (t , "5" , attr ["metadata.0.interval" ])
153
156
return nil
154
157
},
You can’t perform that action at this time.
0 commit comments