@@ -8,6 +8,9 @@ resource "awx_schedule" "default" {
88 name = "schedule-test"
99 rrule = "DTSTART;TZID=Europe/Paris:20211214T120000 RRULE:INTERVAL=1;FREQ=DAILY"
1010 unified_job_template_id = awx_job_template.baseconfig.id
11+ extra_data = <<EOL
12+ organization_name: testorg
13+ EOL
1114}
1215```
1316
@@ -58,6 +61,12 @@ func resourceSchedule() *schema.Resource {
5861 Type : schema .TypeInt ,
5962 Optional : true ,
6063 },
64+ "extra_data" : {
65+ Type : schema .TypeString ,
66+ Optional : true ,
67+ Default : "" ,
68+ Description : "Extra data to be pass for the schedule (YAML format)" ,
69+ },
6170 },
6271 }
6372}
@@ -74,6 +83,7 @@ func resourceScheduleCreate(ctx context.Context, d *schema.ResourceData, m inter
7483 "description" : d .Get ("description" ).(string ),
7584 "enabled" : d .Get ("enabled" ).(bool ),
7685 "inventory" : d .Get ("inventory" ).(int ),
86+ "extra_data" : unmarshalYaml (d .Get ("extra_data" ).(string )),
7787 }, map [string ]string {})
7888 if err != nil {
7989 log .Printf ("Fail to Create Schedule %v" , err )
@@ -110,7 +120,8 @@ func resourceScheduleUpdate(ctx context.Context, d *schema.ResourceData, m inter
110120 "unified_job_template" : d .Get ("unified_job_template_id" ).(int ),
111121 "description" : d .Get ("description" ).(string ),
112122 "enabled" : d .Get ("enabled" ).(bool ),
113- "inventory" : d .Get ("inventory" ).(int ),
123+ "inventory" : AtoipOr (d .Get ("inventory" ).(string ), nil ),
124+ "extra_data" : unmarshalYaml (d .Get ("extra_data" ).(string )),
114125 }, map [string ]string {})
115126 if err != nil {
116127 diags = append (diags , diag.Diagnostic {
@@ -167,6 +178,7 @@ func setScheduleResourceData(d *schema.ResourceData, r *awx.Schedule) *schema.Re
167178 d .Set ("description" , r .Description )
168179 d .Set ("enabled" , r .Enabled )
169180 d .Set ("inventory" , r .Inventory )
181+ d .Set ("extra_data" , marshalYaml (r .ExtraData ))
170182 d .SetId (strconv .Itoa (r .ID ))
171183 return d
172184}
0 commit comments