Skip to content

Commit 8e5520f

Browse files
committed
Add support for execution_environment on awx_instance_source ressource
1 parent bafe535 commit 8e5520f

2 files changed

Lines changed: 36 additions & 26 deletions

File tree

docs/resources/inventory_source.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ resource "awx_inventory_source" "example" {
6262
- `description` (String) The description of the inventory source.
6363
- `enabled_value` (String) The value of the variable that determines if the inventory source is enabled.
6464
- `enabled_var` (String) The variable that determines if the inventory source is enabled.
65+
- `execution_environment_id` (Number) The selected execution environment that this inventory will be run in.
6566
- `group_by` (String) [Obsolete] The group by for the inventory source.
6667
- `host_filter` (String) The host filter for the inventory source.
6768
- `instance_filters` (String) [Obsolete] The instance filters for the inventory source.

internal/awx/resource_inventory_source.go

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ func resourceInventorySource() *schema.Resource {
100100
Optional: true,
101101
Description: "The verbosity for the inventory source. [0,1,2,3]",
102102
},
103+
"execution_environment_id": {
104+
Type: schema.TypeInt,
105+
Optional: true,
106+
},
103107
// obsolete schema added so terraform doesn't break
104108
// these don't do anything in later versions of AWX! Update your code.
105109
"source_regions": {
@@ -138,19 +142,20 @@ func resourceInventorySourceCreate(ctx context.Context, d *schema.ResourceData,
138142
client := m.(*awx.AWX)
139143

140144
payload := map[string]interface{}{
141-
"name": d.Get("name").(string),
142-
"description": d.Get("description").(string),
143-
"enabled_var": d.Get("enabled_var").(string),
144-
"enabled_value": d.Get("enabled_value").(string),
145-
"overwrite": d.Get("overwrite").(bool),
146-
"overwrite_vars": d.Get("overwrite_vars").(bool),
147-
"update_on_launch": d.Get("update_on_launch").(bool),
148-
"inventory": d.Get("inventory_id").(int),
149-
"source": d.Get("source").(string),
150-
"source_vars": d.Get("source_vars").(string),
151-
"host_filter": d.Get("host_filter").(string),
152-
"update_cache_timeout": d.Get("update_cache_timeout").(int),
153-
"verbosity": d.Get("verbosity").(int),
145+
"name": d.Get("name").(string),
146+
"description": d.Get("description").(string),
147+
"enabled_var": d.Get("enabled_var").(string),
148+
"enabled_value": d.Get("enabled_value").(string),
149+
"overwrite": d.Get("overwrite").(bool),
150+
"overwrite_vars": d.Get("overwrite_vars").(bool),
151+
"update_on_launch": d.Get("update_on_launch").(bool),
152+
"inventory": d.Get("inventory_id").(int),
153+
"source": d.Get("source").(string),
154+
"source_vars": d.Get("source_vars").(string),
155+
"host_filter": d.Get("host_filter").(string),
156+
"update_cache_timeout": d.Get("update_cache_timeout").(int),
157+
"verbosity": d.Get("verbosity").(int),
158+
"execution_environment_id": d.Get("execution_environment_id").(int),
154159
// obsolete schema added so terraform doesn't break
155160
// these don't do anything in later versions of AWX! Update your code.
156161
"source_regions": d.Get("source_regions").(string),
@@ -184,19 +189,20 @@ func resourceInventorySourceUpdate(ctx context.Context, d *schema.ResourceData,
184189
}
185190

186191
payload := map[string]interface{}{
187-
"name": d.Get("name").(string),
188-
"description": d.Get("description").(string),
189-
"enabled_var": d.Get("enabled_var").(string),
190-
"enabled_value": d.Get("enabled_value").(string),
191-
"overwrite": d.Get("overwrite").(bool),
192-
"overwrite_vars": d.Get("overwrite_vars").(bool),
193-
"update_on_launch": d.Get("update_on_launch").(bool),
194-
"inventory": d.Get("inventory_id").(int),
195-
"source": d.Get("source").(string),
196-
"source_vars": d.Get("source_vars").(string),
197-
"host_filter": d.Get("host_filter").(string),
198-
"update_cache_timeout": d.Get("update_cache_timeout").(int),
199-
"verbosity": d.Get("verbosity").(int),
192+
"name": d.Get("name").(string),
193+
"description": d.Get("description").(string),
194+
"enabled_var": d.Get("enabled_var").(string),
195+
"enabled_value": d.Get("enabled_value").(string),
196+
"overwrite": d.Get("overwrite").(bool),
197+
"overwrite_vars": d.Get("overwrite_vars").(bool),
198+
"update_on_launch": d.Get("update_on_launch").(bool),
199+
"inventory": d.Get("inventory_id").(int),
200+
"source": d.Get("source").(string),
201+
"source_vars": d.Get("source_vars").(string),
202+
"host_filter": d.Get("host_filter").(string),
203+
"update_cache_timeout": d.Get("update_cache_timeout").(int),
204+
"verbosity": d.Get("verbosity").(int),
205+
"execution_environment_id": d.Get("execution_environment_id").(int),
200206
// obsolete schema added so terraform doesn't break
201207
// these don't do anything in later versions of AWX! Update your code.
202208
"source_regions": d.Get("source_regions").(string),
@@ -288,6 +294,9 @@ func setInventorySourceResourceData(d *schema.ResourceData, r *awx.InventorySour
288294
if err := d.Set("verbosity", r.Verbosity); err != nil {
289295
fmt.Println("Error setting verbosity", err)
290296
}
297+
if err := d.Set("execution_environment_id", r.ExecutionEnvironment); err != nil {
298+
fmt.Println("Error setting execution_environment_id", err)
299+
}
291300
if err := d.Set("source_project_id", r.SourceProject); err != nil {
292301
fmt.Println("Error setting source_project_id", err)
293302
}

0 commit comments

Comments
 (0)