I'm building out some infrastructure in AWS with Terraform. I have several S3 buckets created and want a Glue crawler to crawl these buckets once per hour. My Terraform Glue catalog db, role, and policy all build fine but when I try to create the crawler resource by adding four S3 paths to the s3_target{}
portion of the crawler, I get a failure:
resource "aws_glue_crawler" "datalake_crawler" {
database_name = "${var.glue_db_name}"
name = "${var.crawler_name}"
role = "${aws_iam_role.glue.id}"
s3_target {
# count = "${length(var.data_source_path)}"
path = "${var.data_source_path}"#"${formatlist("%s", var.data_source_path)}"
}
}
This causes an error:
Error: aws_glue_crawler.datalake_crawler: s3_target.0.path must be a single value, not a list
I have tried adding a count
statement in the s3_target
but this fails. I have also tried adding
"${formatlist("%s", var.data_source_path)}"
in the path
argument but this too fails.
Can I add multiple s3
paths to a Glue Crawler with Terraform? I can make this happen through the AWS console but this needs to be done using infrastructure as code.
s3_target
block for each path. On my phone right now so can't test it to make this a proper answer. – ydaetskcoRs3_target
blocks to the glue crawler resource allowed me to add all four of my buckets to the crawler. I had reviewed the glue docs but saw nowhere that led me to believe that I could replicate thes3_target
blocks. Can you help me see what was missing? Also, can I add those blocks progrommatically based upon a variable? Feel free to add as an answer when you're back at a box; happy to accept. – Steven