Reputation: 3355
I have a Glue job resource defined in module A, now I want to import it and use the job name in module B, how can I achieve this?
I tried something like, in the module B:
variable "example_glue_name" {
type = string
}
data "aws_glue_job" "example_glue_name" {
example_glue_name = var.example_glue_name
}
then:
module "B"{
source = .....
...
example_glue_name = module.A.example_glue_name
}
But I got error: Unsupported argument, │ An argument named "example_glue_job_name" is not expected here.
, I read the docs here: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/glue_script
It looks like terraform doesn't support data "aws_glue_job"
, it only has something like data "aws_glue_script"
, but it's not clear how to reference the glue name....
anyone what's the correct way to do this? Thanks.
Upvotes: 1
Views: 787
Reputation: 238687
There is no data source called aws_glue_job
. The only one that exists is aws_glue_script. You would have to create external data source which would required custom script in bash, for instance, as shown in docs.
The script would use AWS CLI to get-job to query AWS Glue for a job of interest and return its details to your TF script for future processing.
But if module A creates a job, then it should output
it. Once its output, you can reference in as input to module B.
Upvotes: 1