Area: Deployment
Sub-Area: Infrastructure as Code
Applies to: Cloud
Issue
You use Terraform for infrastructure and want a Terraform alternative to the CloudFormation template for deploying the Remote Executor on AWS ECS. The Remote Executor is a DataHub Cloud feature. You deploy and run it in your own environment.
You Might Be Asking
- Is there an official Terraform module for deploying the Remote Executor?
- Which inputs does the module take?
- Why does my task not launch after
terraform apply? - Does the module support EC2 launch type?
Cause
DataHub publishes a Terraform module that builds the same ECS/Fargate stack as the CloudFormation template: an ECS cluster, a Fargate service, IAM roles, a security group and CloudWatch logging. The module provisions a Fargate service. The documented inputs include no launch_type, so the docs don't describe EC2 launch type support.
Copied examples often fail for these reasons:
- They use inputs that aren't documented for the module, such as
vpc_id,datahub_gms_url,executor_id,task_cpu,task_memoryorlaunch_type. Use the documented inputs below instead. - They leave out the access token wiring.
- They don't set
create_task_exec_iam_role = true. It defaults tofalse. Without it, the task can't pull the image, write logs or read the token, so it doesn't launch.
Solution
The module is in the public repository datahub-terraform-modules, path remote-ingestion-executor. It needs Terraform ~> 1.0 and AWS provider ~> 5.0.
Before you apply:
- Create an Executor Pool under Data Sources > Executors > Create.
- Create a token of type Remote Executor at Settings > Access Tokens > Generate new token. Your user needs the Manage Metadata Ingestion privilege.
- Store the token in AWS Secrets Manager, or in SSM Parameter Store as a SecureString. The module doesn't create it.
- Give DataHub your AWS account ID so your account can pull the private image from DataHub Cloud ECR. You can send it through your DataHub representative.
- Use a subnet with outbound HTTPS (port 443) access. Private subnets need a NAT gateway.
Then use the module. Pin it with ?ref=<tag>:
module "remote_executor" {
source = "git::https://github.com/acryldata/datahub-terraform-modules.git//remote-ingestion-executor?ref=v2.1.0"
datahub = {
url = "https://<company>.acryl.io/gms"
executor_pool_id = "remote"
}
subnet_ids = var.subnet_ids
assign_public_ip = false # for private subnets with NAT
secrets = [
{ name = "DATAHUB_GMS_TOKEN", valueFrom = var.token_secret_arn }
]
task_exec_secret_arns = [var.token_secret_arn]
create_task_exec_iam_role = true
}
Notes on the inputs:
-
datahub.urlis required and must include/gms. -
datahub.executor_pool_idis the Pool ID from the UI. The default isremote. -
datahub.image_tagsets the image version. If you don't set it, the module tag pins a default. Module tags (for examplev2.1.0) and image tags (for examplev2.4.2-cloud) are versioned independently. -
subnet_idsis required in practice. The security group's VPC comes from the first subnet. -
cpuandmemorydefault to 1024 and 2048. -
desired_countdefaults to 1. -
ephemeral_storagetakes{ size_in_gib = N }. Without it, Fargate gives the task its default of 20 GiB. -
environmenttakes non-secret variables as[{ name, value }]. - Use
task_exec_ssm_param_arnsinstead oftask_exec_secret_arnsif the token is in SSM. - Never pass the token through
environment.
To upgrade, set datahub.image_tag to a version from the Recommended Versions list in the release notes for your server version, or bump the module ?ref= tag, then run terraform apply.
If the module doesn't fit, you can deploy with the CloudFormation template instead. See the ECS deployment steps.