<p>It seems that there is no official support for it yet. This is a brand new feature released on Sep 23rd, 2021, see below:</p>
<p><a href="https://aws.amazon.com/about-aws/whats-new/2021/09/amazon-macie-managed-data-identifiers/" rel="nofollow noreferrer">https://aws.amazon.com/about-aws/whats-new/2021/09/amazon-macie-managed-data-identifiers/</a></p>
<p>I have created a feature request to the community, your support will be very appreciated:</p>
<p><a href="https://github.com/hashicorp/terraform-provider-aws/issues/21952" rel="nofollow noreferrer">https://github.com/hashicorp/terraform-provider-aws/issues/21952</a></p>

CC BY-SA 4.0
2021-12-02T17:19:56.783Z
Didn't realize the feature came out so recently... Thanks for submitting the feature request!
dr Oq
CC BY-SA 4.0
2021-12-03T23:22:53.390Z
@drOq Would you mind flagging my answer as useful here and giving a thumbs up on GitHub issue? That will help them to bump it up. Thank you!
brngyn
CC BY-SA 4.0
2021-12-20T17:06:07.953Z
don't have enough rep yet to upvote on stack. I'll upvote the github issue tho :D
dr Oq
CC BY-SA 4.0
2021-11-29T22:35:05.013Z
2021-11-29T22:35:05.013Z
brngyn
<p>I am trying to enable AWS Macie via Terraform to run scheduled jobs that scan S3 buckets for sensitive data.</p>
<p>I've been able to create an account and execute an initial scan of my buckets, but I would also like to specify a few managed data identifiers (<em>e.g., address, DOB, drivers license, phone number, etc</em>).</p>
<p>Looking at the HashiCorp documentation (<a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/macie2_classification_job" rel="nofollow noreferrer">https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/macie2_classification_job</a>), I only see information about custom data identifiers.</p>
<p>The AWS REST API docs suggests there is a way using the <code>managedDataIdentifierIds</code> property in <code>CreateClassificationJobRequest</code> but I am struggling to apply it within Terraform.</p>
<p>Defining custom data identifiers may be a workaround, but would I'd like to avoid this path if possible.</p>
<p><strong>How do I use managed data identifiers via Terraform?</strong></p>
<pre><code>resource &quot;aws_macie2_account&quot; &quot;test_scan&quot; {}

resource &quot;aws_macie2_classification_job&quot; &quot;test_scan&quot; {
    job_type = &quot;ONE_TIME&quot;
    name     = &quot;init_test_scan&quot;
    s3_job_definition {
        bucket_definitions {
            account_id = var.account_id
            buckets    = var.buckets
        }
    }

    sampling_percentage = 100

  depends_on = [aws_macie2_account.test_scan]
}
</code></pre>

<amazon-web-services><terraform><data-protection>
Terraform/AWS Macie: how to use managed data identifiers?
dr Oq
# Terraform/AWS Macie: how to use managed data identifiers?

(Asked by: username_0 on 2021-11-03)

I am trying to enable AWS Macie via Terraform to run scheduled jobs that scan S3 buckets for sensitive data.
I've been able to create an account and execute an initial scan of my buckets, but I would also like to specify a few managed data identifiers (e.g., address, DOB, drivers license, phone number, etc).
Looking at the HashiCorp documentation (https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/macie2_classification_job), I only see information about custom data identifiers.
The AWS REST API docs suggests there is a way using the managedDataIdentifierIds property in CreateClassificationJobRequest but I am struggling to apply it within Terraform.
Defining custom data identifiers may be a workaround, but would I'd like to avoid this path if possible.
How do I use managed data identifiers via Terraform?
resource "aws_macie2_account" "test_scan" {}

resource "aws_macie2_classification_job" "test_scan" {
    job_type = "ONE_TIME"
    name     = "init_test_scan"
    s3_job_definition {
        bucket_definitions {
            account_id = var.account_id
            buckets    = var.buckets
        }
    }

    sampling_percentage = 100

  depends_on = [aws_macie2_account.test_scan]
}

**Tags:** amazon-web-services, terraform, data-protection


---

## 1 answers

### Answer by username_1 on 2021-11-29. Score: 1

It seems that there is no official support for it yet. This is a brand new feature released on Sep 23rd, 2021, see below:

<https://aws.amazon.com/about-aws/whats-new/2021/09/amazon-macie-managed-data-identifiers/>

I have created a feature request to the community, your support will be very appreciated:

<https://github.com/hashicorp/terraform-provider-aws/issues/21952>

> **Comments:**
> **username_0**: Didn't realize the feature came out so recently... Thanks for submitting the feature request!  
> **username_1**: @drOq Would you mind flagging my answer as useful here and giving a thumbs up on GitHub issue? That will help them to bump it up. Thank you!  
> **username_0**: don't have enough rep yet to upvote on stack. I'll upvote the github issue tho :D  

---

