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" {
7070
7171Required:
7272
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.
7474- ` interval ` (Number) The interval in seconds at which to refresh this metadata item.
7575- ` key ` (String) The key of this metadata item.
7676
Original file line number Diff line number Diff line change @@ -157,10 +157,13 @@ func agentResource() *schema.Resource {
157157 Optional : true ,
158158 },
159159 "cmd" : {
160- Type : schema .TypeString ,
160+ Type : schema .TypeList ,
161161 Description : "The command that retrieves the value of this metadata item." ,
162162 ForceNew : true ,
163163 Required : true ,
164+ Elem : & schema.Schema {
165+ Type : schema .TypeString ,
166+ },
164167 },
165168 "interval" : {
166169 Type : schema .TypeInt ,
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ func TestAgent_Metadata(t *testing.T) {
130130 metadata {
131131 key = "process_count"
132132 display_name = "Process Count"
133- cmd = " ps aux | wc -l"
133+ cmd = ["sh", "-c", " ps aux | wc -l"]
134134 interval = 5
135135 }
136136 }
@@ -148,7 +148,10 @@ func TestAgent_Metadata(t *testing.T) {
148148 require .Equal (t , "1" , attr ["metadata.#" ])
149149 require .Equal (t , "process_count" , attr ["metadata.0.key" ])
150150 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" ])
152155 require .Equal (t , "5" , attr ["metadata.0.interval" ])
153156 return nil
154157 },
You can’t perform that action at this time.
0 commit comments