Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking-Change: Facing Issue with Terraform Apply on AWS macie classification job #20726

Open
amol621984 opened this issue Aug 30, 2021 · 7 comments
Labels
bug Addresses a defect in current functionality. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. service/macie2 Issues and PRs that pertain to the macie2 service.

Comments

@amol621984
Copy link

amol621984 commented Aug 30, 2021

Description

  • aws macie classifciation job
provider "registry.terraform.io/hashicorp/aws" {
  version = "3.53.0"

Output

Getting below error on terraform apply, even though I am not trying to update job_status on macie job. The job type is daily scheduled.
I tried adding job_status parameter, but that did not seem to resolve the issue.
image

Error: error updating Macie ClassificationJob (9fa9a6a37bf535a04075761203005f8b): InvalidParameter: 1 validation error(s) found.
│ - missing required field, UpdateClassificationJobInput.JobStatus.
│ 
│ 
│   with aws_macie2_classification_job.scan-dd-log-archive,
│   on main.tf line 9, in resource "aws_macie2_classification_job" "scan-dd-log-archive":
│    9: resource "aws_macie2_classification_job" "scan-dd-log-archive" {
│ 
╵

code snippet

resource "aws_macie2_classification_job" "scan-dd-log-archive" {
  job_type    = "SCHEDULED"
  name        = "dd_log_archive_daily_1pct"
  initial_run = "true"
  description = "Scan Venmo DataDog Log Archive Bucket"
  s3_job_definition {
    bucket_definitions {
      account_id = var.dd_log_archive_bucket.account_id
      buckets    = [var.dd_log_archive_bucket.name]
    }
  }
  #job_status  = "RUNNING"
  sampling_percentage = 1
  schedule_frequency {
    daily_schedule = "true"
  }
  
}

References

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/macie2_classification_job

https://docs.aws.amazon.com/macie/latest/user/discovery-jobs.html

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/macie2 Issues and PRs that pertain to the macie2 service. labels Aug 30, 2021
@amol621984
Copy link
Author

Terraform doc shows only below options. But that doesn't seem to solve the issue.
image

@amol621984 amol621984 changed the title Facing Issue with Terraform Apply on AWS macie classification job Breaking-Change: Facing Issue with Terraform Apply on AWS macie classification job Aug 30, 2021
@breathingdust breathingdust added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 1, 2021
@ghost
Copy link

ghost commented May 3, 2022

I face the same issue as well. Same scenario and job_status parameter is not helping. :(

@justinretzolk justinretzolk added the good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. label Aug 25, 2022
@hayata-yamamoto
Copy link

I've also face this error. Replacing resource could resolve my issue.

terraform apply -replace="resource.path"

@marinalimeira
Copy link

I am having this error too. I can't update the list of buckets to be analysed in a job.

I did some investigation on why this might be happening, and the problem is in the resourceClassificationJobUpdate function of the Terraform resource:

if d.HasChange("job_status") {
status := d.Get("job_status").(string)
if status == macie2.JobStatusCancelled {
return diag.FromErr(fmt.Errorf("error updating Macie ClassificationJob (%s): %s", d.Id(), fmt.Sprintf("%s cannot be set", macie2.JobStatusCancelled)))
}
input.JobStatus = aws.String(status)
}

The JobStatus is a required field, according to the AWS SDK documentation..
It does look it's related to the error, since it happens when JobStatus is not set.

@w564791
Copy link

w564791 commented May 13, 2024

i have the same issue

@CameronBeeler
Copy link

I'm experiencing the same issue precisely. Even with the job_status attribute as "RUNNING", the error persists in TF Apply.

@dcloud9
Copy link

dcloud9 commented Aug 1, 2024

Same for me. I needed to switch job_status from/to RUNNING (i.e. Active (Idle)) and USER_PAUSED everytime apply is needed, doesn't make sense.

│ Error: updating Macie ClassificationJob (f24a3b...): InvalidParameter: 1 validation error(s) found.
│ - missing required field, UpdateClassificationJobInput.JobStatus.
│ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. service/macie2 Issues and PRs that pertain to the macie2 service.
Projects
None yet
Development

No branches or pull requests

8 participants