Skip to content

Commit 6891c9e

Browse files
Chavo11fciava
andauthored
feat: adds the possibility to use source_id inside resource_inventory_source (#20)
Co-authored-by: f.ciavarella <f.ciavarella@reply.it>
1 parent df37a93 commit 6891c9e

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

awx/resource_inventory_source.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ func resourceInventorySource() *schema.Resource {
105105
Type: schema.TypeString,
106106
Optional: true,
107107
},
108+
"source_project_id": {
109+
Type: schema.TypeInt,
110+
Optional: true,
111+
},
112+
"source_path": {
113+
Type: schema.TypeString,
114+
Optional: true,
115+
},
108116
},
109117
Importer: &schema.ResourceImporter{
110118
State: schema.ImportStatePassthrough,
@@ -136,8 +144,8 @@ func resourceInventorySourceCreate(ctx context.Context, d *schema.ResourceData,
136144
"source_regions": d.Get("source_regions").(string),
137145
"instance_filters": d.Get("instance_filters").(string),
138146
"group_by": d.Get("group_by").(string),
139-
// "source_project": d.Get("source_project_id").(int),
140-
// "source_path": d.Get("source_path").(string),
147+
"source_project": d.Get("source_project_id").(int),
148+
"source_path": d.Get("source_path").(string),
141149
}, map[string]string{})
142150
if err != nil {
143151
return buildDiagCreateFail(diagElementInventorySourceTitle, err)
@@ -176,8 +184,8 @@ func resourceInventorySourceUpdate(ctx context.Context, d *schema.ResourceData,
176184
"source_regions": d.Get("source_regions").(string),
177185
"instance_filters": d.Get("instance_filters").(string),
178186
"group_by": d.Get("group_by").(string),
179-
// "source_project": d.Get("source_project_id").(int),
180-
// "source_path": d.Get("source_path").(string),
187+
"source_project": d.Get("source_project_id").(int),
188+
"source_path": d.Get("source_path").(string),
181189
}, nil)
182190
if err != nil {
183191
return buildDiagUpdateFail(diagElementInventorySourceTitle, id, err)
@@ -238,8 +246,8 @@ func setInventorySourceResourceData(d *schema.ResourceData, r *awx.InventorySour
238246
d.Set("source_regions", r.SourceRegions)
239247
d.Set("instance_filters", r.InstanceFilters)
240248
d.Set("group_by", r.GroupBy)
241-
// d.Set("source_project_id", r.SourceProject)
242-
// d.Set("source_path", r.SourcePath)
249+
d.Set("source_project_id", r.SourceProject)
250+
d.Set("source_path", r.SourcePath)
243251

244252
return d
245253
}

0 commit comments

Comments
 (0)