diff --git a/internal/provider/navigator_run_resource.go b/internal/provider/navigator_run_resource.go index 348531d..928b8b9 100644 --- a/internal/provider/navigator_run_resource.go +++ b/internal/provider/navigator_run_resource.go @@ -440,11 +440,10 @@ func (r *NavigatorRunResource) Schema(ctx context.Context, req resource.SchemaRe } func (NavigatorRunResource) ShouldRun(plan *NavigatorRunResourceModel, state *NavigatorRunResourceModel) bool { - // skip ansible_navigator_binary, run_on_destroy, timeouts + // skip working_directory, ansible_navigator_binary, run_on_destroy, timeouts attributeChanges := []bool{ plan.Playbook.Equal(state.Playbook), plan.Inventory.Equal(state.Inventory), - plan.WorkingDirectory.Equal(state.WorkingDirectory), plan.ExecutionEnvironment.Equal(state.ExecutionEnvironment), plan.AnsibleOptions.Equal(state.AnsibleOptions), // TODO check nested attrs plan.Timezone.Equal(state.Timezone), diff --git a/internal/provider/navigator_run_resource_test.go b/internal/provider/navigator_run_resource_test.go index 38c2a94..8dbc030 100644 --- a/internal/provider/navigator_run_resource_test.go +++ b/internal/provider/navigator_run_resource_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-testing/config" - "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/knownvalue" "github.com/hashicorp/terraform-plugin-testing/plancheck" @@ -312,27 +311,6 @@ func TestAccNavigatorRunResource_pull_args(t *testing.T) { }) } -func TestAccNavigatorRunResource_relative_binary(t *testing.T) { - t.Parallel() - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testPreCheck(t) }, - ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, - Steps: []resource.TestStep{ - { - Config: testTerraformFile(t, filepath.Join("navigator_run_resource", "relative_binary")), - ConfigVariables: testConfigVariables(t, config.Variables{ - "working_directory": config.StringVariable(t.TempDir()), - }), - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttrSet(navigatorRunResource, "id"), - resource.TestCheckResourceAttrSet(navigatorRunResource, "command"), - ), - }, - }, - }) -} - func TestAccNavigatorRunResource_role(t *testing.T) { t.Parallel() @@ -377,10 +355,8 @@ func TestAccNavigatorRunResource_skip_run(t *testing.T) { ), }, { - Config: testTerraformFile(t, filepath.Join("navigator_run_resource", "skip_run_update")), - ConfigVariables: testConfigVariables(t, config.Variables{ - "ansible_navigator_binary": config.StringVariable(acctest.RandString(8)), - }), + Config: testTerraformFile(t, filepath.Join("navigator_run_resource", "skip_run_update")), + ConfigVariables: testDefaultConfigVariables(t), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectNonEmptyPlan(), diff --git a/internal/provider/testdata/navigator_run_resource/relative_binary.tf b/internal/provider/testdata/navigator_run_resource/relative_binary.tf deleted file mode 100644 index ec2aa34..0000000 --- a/internal/provider/testdata/navigator_run_resource/relative_binary.tf +++ /dev/null @@ -1,14 +0,0 @@ -resource "ansible_navigator_run" "test" { - ansible_navigator_binary = var.ansible_navigator_binary - playbook = <<-EOT - - hosts: localhost - become: false - EOT - inventory = "# localhost" - working_directory = var.working_directory -} - -variable "working_directory" { - type = string - nullable = false -} diff --git a/internal/provider/testdata/navigator_run_resource/skip_run.tf b/internal/provider/testdata/navigator_run_resource/skip_run.tf index a195fc4..549938c 100644 --- a/internal/provider/testdata/navigator_run_resource/skip_run.tf +++ b/internal/provider/testdata/navigator_run_resource/skip_run.tf @@ -10,10 +10,4 @@ resource "ansible_navigator_run" "test" { jq_filter = "now" } } - run_on_destroy = true - timeouts = { - create = "60m" - update = "60m" - delete = "60m" - } } diff --git a/internal/provider/testdata/navigator_run_resource/skip_run_update.tf b/internal/provider/testdata/navigator_run_resource/skip_run_update.tf index 23985a2..fd104b6 100644 --- a/internal/provider/testdata/navigator_run_resource/skip_run_update.tf +++ b/internal/provider/testdata/navigator_run_resource/skip_run_update.tf @@ -1,5 +1,5 @@ resource "ansible_navigator_run" "test" { - ansible_navigator_binary = var.ansible_navigator_binary + ansible_navigator_binary = "${path.module}/${var.ansible_navigator_binary}" playbook = <<-EOT - hosts: localhost become: false @@ -10,7 +10,8 @@ resource "ansible_navigator_run" "test" { jq_filter = "now" } } - run_on_destroy = false + working_directory = ".." + run_on_destroy = true timeouts = { create = "90m" update = "90m"