Skip to content

Commit 6869420

Browse files
authored
fix: workflow job template & schedule inventory option default value (#2)
1 parent 71d8d99 commit 6869420

2 files changed

Lines changed: 9 additions & 16 deletions

File tree

awx/resource_workflow_job_template.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ func resourceWorkflowJobTemplate() *schema.Resource {
7373
Default: false,
7474
},
7575
"inventory_id": {
76-
Type: schema.TypeInt,
76+
Type: schema.TypeString,
7777
Optional: true,
78-
Description: "Inventory applied as a prompt, assuming job template prompts for inventory.",
78+
Description: "Inventory applied as a prompt, assuming job template prompts for inventory. (id, default=``)",
79+
Default: "",
7980
},
8081
"limit": {
8182
Type: schema.TypeString,
@@ -113,15 +114,6 @@ func resourceWorkflowJobTemplate() *schema.Resource {
113114
Default: "",
114115
},
115116
},
116-
//Importer: &schema.ResourceImporter{
117-
// State: schema.ImportStatePassthrough,
118-
//},
119-
//
120-
//Timeouts: &schema.ResourceTimeout{
121-
// Create: schema.DefaultTimeout(1 * time.Minute),
122-
// Update: schema.DefaultTimeout(1 * time.Minute),
123-
// Delete: schema.DefaultTimeout(1 * time.Minute),
124-
//},
125117
}
126118
}
127119

@@ -134,7 +126,7 @@ func resourceWorkflowJobTemplateCreate(ctx context.Context, d *schema.ResourceDa
134126
"name": d.Get("name").(string),
135127
"description": d.Get("description").(string),
136128
"organization": d.Get("organization_id").(int),
137-
"inventory": d.Get("inventory_id").(int),
129+
"inventory": AtoipOr(d.Get("inventory_id").(string), nil),
138130
"extra_vars": d.Get("variables").(string),
139131
"survey_enabled": d.Get("survey_enabled").(bool),
140132
"allow_simultaneous": d.Get("allow_simultaneous").(bool),
@@ -180,7 +172,7 @@ func resourceWorkflowJobTemplateUpdate(ctx context.Context, d *schema.ResourceDa
180172
"name": d.Get("name").(string),
181173
"description": d.Get("description").(string),
182174
"organization": d.Get("organization_id").(int),
183-
"inventory": d.Get("inventory_id").(int),
175+
"inventory": AtoipOr(d.Get("inventory_id").(string), nil),
184176
"extra_vars": d.Get("variables").(string),
185177
"survey_enabled": d.Get("survey_enabled").(bool),
186178
"allow_simultaneous": d.Get("allow_simultaneous").(bool),

awx/resource_workflow_job_template_schedule.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ func resourceWorkflowJobTemplateSchedule() *schema.Resource {
6262
Default: true,
6363
},
6464
"inventory": {
65-
Type: schema.TypeInt,
66-
Optional: true,
65+
Type: schema.TypeString,
66+
Optional: true,
67+
Description: "Inventory applied as a prompt, assuming job template prompts for inventory (id, default=``)",
6768
},
6869
},
6970
}
@@ -81,7 +82,7 @@ func resourceWorkflowJobTemplateScheduleCreate(ctx context.Context, d *schema.Re
8182
"rrule": d.Get("rrule").(string),
8283
"description": d.Get("description").(string),
8384
"enabled": d.Get("enabled").(bool),
84-
"inventory": d.Get("inventory").(int),
85+
"inventory": AtoipOr(d.Get("inventory").(string), nil),
8586
}, map[string]string{})
8687
if err != nil {
8788
log.Printf("Fail to Create Schedule for WorkflowJobTemplate %d: %v", workflowJobTemplateID, err)

0 commit comments

Comments
 (0)