hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.88k stars 9.22k forks source link

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

Open amol621984 opened 3 years ago

amol621984 commented 3 years ago

Description


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

amol621984 commented 3 years ago

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

ghost commented 2 years ago

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

hayata-yamamoto commented 2 years ago

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

terraform apply -replace="resource.path"
marinalimeira commented 1 year ago

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: https://github.com/hashicorp/terraform-provider-aws/blob/c44a5b971247fb197725a063532b4f1421c958dc/internal/service/macie2/classification_job.go#L703-L711

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 commented 6 months ago

i have the same issue

CameronBeeler commented 4 months ago

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

dcloud9 commented 4 months ago

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.
│ 
varxnnn commented 2 days ago

This issue is still prevalent on AWS provider ~4.16. Any updates on a fix?