diff --git a/VERSION b/VERSION index 6a5e98a7..18fa8e74 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v1.2.1 +v1.3.0 diff --git a/docs/resources/execution_environment.md b/docs/resources/execution_environment.md index 31932208..a27fbe09 100644 --- a/docs/resources/execution_environment.md +++ b/docs/resources/execution_environment.md @@ -19,6 +19,7 @@ resource "awx_execution_environment" "example" { credential = awx_credential.example.id description = "Example Execution Environment" organization = awx_organization.example.id + pull = "always" } ``` @@ -35,6 +36,7 @@ resource "awx_execution_environment" "example" { - `credential` (String) The credential used to access the execution environment. - `description` (String) The description of the execution environment. - `organization` (String) The organization that the execution environment belongs to. +- `pull` (String) Pull image before running? ### Read-Only diff --git a/examples/resources/awx_execution_environment/resource.tf b/examples/resources/awx_execution_environment/resource.tf index 3c21047f..719dbce1 100644 --- a/examples/resources/awx_execution_environment/resource.tf +++ b/examples/resources/awx_execution_environment/resource.tf @@ -4,4 +4,5 @@ resource "awx_execution_environment" "example" { credential = awx_credential.example.id description = "Example Execution Environment" organization = awx_organization.example.id + pull = "always" } diff --git a/internal/awx/resource_execution_environment.go b/internal/awx/resource_execution_environment.go index b3045c68..e33d3bab 100644 --- a/internal/awx/resource_execution_environment.go +++ b/internal/awx/resource_execution_environment.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" awx "github.com/josh-silvas/terraform-provider-awx/tools/goawx" "github.com/josh-silvas/terraform-provider-awx/tools/utils" ) @@ -52,6 +53,13 @@ func resourceExecutionEnvironment() *schema.Resource { Default: "", Description: "The credential used to access the execution environment.", }, + "pull": { + Type: schema.TypeString, + Optional: true, + Default: "", + Description: "Pull image before running?", + ValidateFunc: validation.StringInSlice([]string{"", "always", "missing", "never"}, false), + }, }, } } @@ -67,6 +75,7 @@ func resourceExecutionEnvironmentsCreate(ctx context.Context, d *schema.Resource "description": d.Get("description").(string), "organization": utils.AtoiDefault(d.Get("organization").(string), nil), "credential": utils.AtoiDefault(d.Get("credential").(string), nil), + "pull": d.Get("pull").(string), }, map[string]string{}) if err != nil { log.Printf("Fail to Create ExecutionEnvironment %v", err) @@ -102,6 +111,7 @@ func resourceExecutionEnvironmentsUpdate(ctx context.Context, d *schema.Resource "description": d.Get("description").(string), "organization": utils.AtoiDefault(d.Get("organization").(string), nil), "credential": utils.AtoiDefault(d.Get("credential").(string), nil), + "pull": d.Get("pull").(string), }, map[string]string{}); err != nil { return utils.DiagUpdate(diagExecutionEnvironmentTitle, id, err) } @@ -157,6 +167,9 @@ func setExecutionEnvironmentsResourceData(d *schema.ResourceData, r *awx.Executi if err := d.Set("credential", r.Credential); err != nil { fmt.Println("Error setting credential", err) } + if err := d.Set("pull", r.Pull); err != nil { + fmt.Println("Error setting pull", err) + } d.SetId(strconv.Itoa(r.ID)) return d }