Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/resources/inventory_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ resource "awx_inventory_source" "example" {
- `description` (String) The description of the inventory source.
- `enabled_value` (String) The value of the variable that determines if the inventory source is enabled.
- `enabled_var` (String) The variable that determines if the inventory source is enabled.
- `execution_environment_id` (Number) The selected execution environment that this inventory will be run in.
- `group_by` (String) [Obsolete] The group by for the inventory source.
- `host_filter` (String) The host filter for the inventory source.
- `instance_filters` (String) [Obsolete] The instance filters for the inventory source.
Expand Down
62 changes: 36 additions & 26 deletions internal/awx/resource_inventory_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ func resourceInventorySource() *schema.Resource {
Optional: true,
Description: "The verbosity for the inventory source. [0,1,2,3]",
},
"execution_environment_id": {
Type: schema.TypeInt,
Optional: true,
Description: "The selected execution environment that this inventory will be run in.",
},
// obsolete schema added so terraform doesn't break
// these don't do anything in later versions of AWX! Update your code.
"source_regions": {
Expand Down Expand Up @@ -138,19 +143,20 @@ func resourceInventorySourceCreate(ctx context.Context, d *schema.ResourceData,
client := m.(*awx.AWX)

payload := map[string]interface{}{
"name": d.Get("name").(string),
"description": d.Get("description").(string),
"enabled_var": d.Get("enabled_var").(string),
"enabled_value": d.Get("enabled_value").(string),
"overwrite": d.Get("overwrite").(bool),
"overwrite_vars": d.Get("overwrite_vars").(bool),
"update_on_launch": d.Get("update_on_launch").(bool),
"inventory": d.Get("inventory_id").(int),
"source": d.Get("source").(string),
"source_vars": d.Get("source_vars").(string),
"host_filter": d.Get("host_filter").(string),
"update_cache_timeout": d.Get("update_cache_timeout").(int),
"verbosity": d.Get("verbosity").(int),
"name": d.Get("name").(string),
"description": d.Get("description").(string),
"enabled_var": d.Get("enabled_var").(string),
"enabled_value": d.Get("enabled_value").(string),
"overwrite": d.Get("overwrite").(bool),
"overwrite_vars": d.Get("overwrite_vars").(bool),
"update_on_launch": d.Get("update_on_launch").(bool),
"inventory": d.Get("inventory_id").(int),
"source": d.Get("source").(string),
"source_vars": d.Get("source_vars").(string),
"host_filter": d.Get("host_filter").(string),
"update_cache_timeout": d.Get("update_cache_timeout").(int),
"verbosity": d.Get("verbosity").(int),
"execution_environment_id": d.Get("execution_environment_id").(int),
// obsolete schema added so terraform doesn't break
// these don't do anything in later versions of AWX! Update your code.
"source_regions": d.Get("source_regions").(string),
Expand Down Expand Up @@ -184,19 +190,20 @@ func resourceInventorySourceUpdate(ctx context.Context, d *schema.ResourceData,
}

payload := map[string]interface{}{
"name": d.Get("name").(string),
"description": d.Get("description").(string),
"enabled_var": d.Get("enabled_var").(string),
"enabled_value": d.Get("enabled_value").(string),
"overwrite": d.Get("overwrite").(bool),
"overwrite_vars": d.Get("overwrite_vars").(bool),
"update_on_launch": d.Get("update_on_launch").(bool),
"inventory": d.Get("inventory_id").(int),
"source": d.Get("source").(string),
"source_vars": d.Get("source_vars").(string),
"host_filter": d.Get("host_filter").(string),
"update_cache_timeout": d.Get("update_cache_timeout").(int),
"verbosity": d.Get("verbosity").(int),
"name": d.Get("name").(string),
"description": d.Get("description").(string),
"enabled_var": d.Get("enabled_var").(string),
"enabled_value": d.Get("enabled_value").(string),
"overwrite": d.Get("overwrite").(bool),
"overwrite_vars": d.Get("overwrite_vars").(bool),
"update_on_launch": d.Get("update_on_launch").(bool),
"inventory": d.Get("inventory_id").(int),
"source": d.Get("source").(string),
"source_vars": d.Get("source_vars").(string),
"host_filter": d.Get("host_filter").(string),
"update_cache_timeout": d.Get("update_cache_timeout").(int),
"verbosity": d.Get("verbosity").(int),
"execution_environment_id": d.Get("execution_environment_id").(int),
// obsolete schema added so terraform doesn't break
// these don't do anything in later versions of AWX! Update your code.
"source_regions": d.Get("source_regions").(string),
Expand Down Expand Up @@ -288,6 +295,9 @@ func setInventorySourceResourceData(d *schema.ResourceData, r *awx.InventorySour
if err := d.Set("verbosity", r.Verbosity); err != nil {
fmt.Println("Error setting verbosity", err)
}
if err := d.Set("execution_environment_id", r.ExecutionEnvironment); err != nil {
fmt.Println("Error setting execution_environment_id", err)
}
if err := d.Set("source_project_id", r.SourceProject); err != nil {
fmt.Println("Error setting source_project_id", err)
}
Expand Down