@@ -143,12 +143,14 @@ func resourceInventorySourceCreate(ctx context.Context, d *schema.ResourceData,
143143 "source_regions" : d .Get ("source_regions" ).(string ),
144144 "instance_filters" : d .Get ("instance_filters" ).(string ),
145145 "group_by" : d .Get ("group_by" ).(string ),
146- "source_project" : d .Get ("source_project_id" ).(int ),
147146 "source_path" : d .Get ("source_path" ).(string ),
148147 }
149148 if _ , ok := d .GetOk ("credential_id" ); ok {
150149 createInventorySourceData ["credential" ] = d .Get ("credential_id" ).(int )
151150 }
151+ if _ , ok := d .GetOk ("source_project_id" ); ok {
152+ createInventorySourceData ["source_project" ] = d .Get ("source_project_id" ).(int )
153+ }
152154
153155 result , err := awxService .CreateInventorySource (createInventorySourceData , map [string ]string {})
154156 if err != nil {
@@ -168,7 +170,7 @@ func resourceInventorySourceUpdate(ctx context.Context, d *schema.ResourceData,
168170 return diags
169171 }
170172
171- _ , err := awxService . UpdateInventorySource ( id , map [string ]interface {}{
173+ updateInventorySourceData := map [string ]interface {}{
172174 "name" : d .Get ("name" ).(string ),
173175 "description" : d .Get ("description" ).(string ),
174176 "enabled_var" : d .Get ("enabled_var" ).(string ),
@@ -177,7 +179,6 @@ func resourceInventorySourceUpdate(ctx context.Context, d *schema.ResourceData,
177179 "overwrite_vars" : d .Get ("overwrite_vars" ).(bool ),
178180 "update_on_launch" : d .Get ("update_on_launch" ).(bool ),
179181 "inventory" : d .Get ("inventory_id" ).(int ),
180- "credential" : d .Get ("credential_id" ).(int ),
181182 "source" : d .Get ("source" ).(string ),
182183 "source_vars" : d .Get ("source_vars" ).(string ),
183184 "host_filter" : d .Get ("host_filter" ).(string ),
@@ -188,9 +189,16 @@ func resourceInventorySourceUpdate(ctx context.Context, d *schema.ResourceData,
188189 "source_regions" : d .Get ("source_regions" ).(string ),
189190 "instance_filters" : d .Get ("instance_filters" ).(string ),
190191 "group_by" : d .Get ("group_by" ).(string ),
191- "source_project" : d .Get ("source_project_id" ).(int ),
192192 "source_path" : d .Get ("source_path" ).(string ),
193- }, nil )
193+ }
194+ if _ , ok := d .GetOk ("credential_id" ); ok {
195+ updateInventorySourceData ["credential" ] = d .Get ("credential_id" ).(int )
196+ }
197+ if _ , ok := d .GetOk ("source_project_id" ); ok {
198+ updateInventorySourceData ["source_project" ] = d .Get ("source_project_id" ).(int )
199+ }
200+
201+ _ , err := awxService .UpdateInventorySource (id , updateInventorySourceData , nil )
194202 if err != nil {
195203 return buildDiagUpdateFail (diagElementInventorySourceTitle , id , err )
196204 }
0 commit comments