Skip to content

Commit

Permalink
renamed nomad_job purge_on_delete to purge_on_destroy to better match
Browse files Browse the repository at this point in the history
Terraform nomenclature
  • Loading branch information
cgbaker committed Jul 13, 2020
1 parent e51831a commit 2e6aee8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## 1.4.9 (Unreleased)

IMPROVEMENTS:
* resource/nomad_job: added `purge_on_delete` option ([#127](https://github.com/terraform-providers/terraform-provider-nomad/issues/127))
* resource/nomad_job: added `purge_on_destroy` option ([#127](https://github.com/terraform-providers/terraform-provider-nomad/issues/127)][[#130](https://github.com/terraform-providers/terraform-provider-nomad/issues/130))
* data source/nomad_namespace: added new data source to fetch info a Nomad namespace ([#126](https://github.com/terraform-providers/terraform-provider-nomad/issues/126))
* data source/nomad_acl_tokens: added new data source to fetch Nomad ACL tokens ([#128](https://github.com/terraform-providers/terraform-provider-nomad/issues/128))

Expand Down
6 changes: 3 additions & 3 deletions nomad/resource_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ func resourceJob() *schema.Resource {
},
},

"purge_on_delete": {
Description: "Whether to purge the job when the resource is deleted.",
"purge_on_destroy": {
Description: "Whether to purge the job when the resource is destroyed.",
Optional: true,
Type: schema.TypeBool,
},
Expand Down Expand Up @@ -418,7 +418,7 @@ func resourceJobDeregister(d *schema.ResourceData, meta interface{}) error {
if opts.Namespace == "" {
opts.Namespace = "default"
}
purge := d.Get("purge_on_delete").(bool)
purge := d.Get("purge_on_destroy").(bool)
_, _, err := client.Jobs().Deregister(id, purge, opts)
if err != nil {
return fmt.Errorf("error deregistering job: %s", err)
Expand Down
12 changes: 6 additions & 6 deletions nomad/resource_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,20 +401,20 @@ func TestResourceJob_parameterizedJob(t *testing.T) {
})
}

func TestResourceJob_purgeOnDelete(t *testing.T) {
func TestResourceJob_purgeOnDestroy(t *testing.T) {
r.Test(t, r.TestCase{
Providers: testProviders,
PreCheck: func() { testAccPreCheck(t) },
Steps: []r.TestStep{
// create the resource
{
Config: testResourceJob_purgeOnDelete,
Config: testResourceJob_purgeOnDestroy,
Check: testResourceJob_initialCheck(t),
},
// make sure it is purged once deleted
// make sure it is purged once deregistered
{
Destroy: true,
Config: testResourceJob_purgeOnDelete,
Config: testResourceJob_purgeOnDestroy,
Check: func(s *terraform.State) error {
providerConfig := testProvider.Meta().(ProviderConfig)
client := providerConfig.client
Expand Down Expand Up @@ -751,9 +751,9 @@ resource "nomad_job" "test" {
}
`

var testResourceJob_purgeOnDelete = `
var testResourceJob_purgeOnDestroy = `
resource "nomad_job" "test" {
purge_on_delete = true
purge_on_destroy = true
jobspec = <<EOT
job "foo" {
datacenters = ["dc1"]
Expand Down
6 changes: 3 additions & 3 deletions website/docs/r/job.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ The following arguments are supported:
- `deregister_on_destroy` `(boolean: true)` - Determines if the job will be
deregistered when this resource is destroyed in Terraform.

- `purge_on_destroy` `(boolean: false)` - Set this to true if you want the job to
be purged when the resource is destroyed.

- `deregister_on_id_change` `(boolean: true)` - Determines if the job will be
deregistered if the ID of the job in the jobspec changes.

Expand All @@ -107,6 +110,3 @@ The following arguments are supported:

- `json` `(boolean: false)` - Set this to true if your jobspec is structured with
JSON instead of the default HCL.

- `purge_on_delete` `(boolean: false)` - Set this to true if you want the job to
be purged when the resource is deleted.

0 comments on commit 2e6aee8

Please sign in to comment.