I have a problem, when i deploy appears the next message:
Error: error running EMR Job Flow: ValidationException: The supplied ecSubnetId is not valid.
status code: 400, request id: 8491b195-55c4-4a9c-b883-76dc21b783b3
on emr\emr.tf line 1, in resource "aws_emr_cluster" "cluster":
1: resource "aws_emr_cluster" "cluster" {
i have this code:
emr.tf
resource "aws_emr_cluster" "cluster" {
count = length(var.names)
name = var.names[count.index]
release_label = var.release
applications = concat(var.applications)
ec2_attributes {
subnet_id = element(var.subnet_ids, count.index)
key_name = element(var.ssh_key_ids, count.index)
emr_managed_master_security_group = aws_security_group.master.id
emr_managed_slave_security_group = aws_security_group.slave.id
instance_profile = aws_iam_instance_profile.training_ec2_profile.arn
}
ebs_root_volume_size = "16"
master_instance_group {
instance_type = var.master_type
bid_price = var.master_bid_price
ebs_config {
size = var.master_ebs_size
type = "gp2"
volumes_per_instance = 1
}
}
core_instance_group {
instance_type = var.worker_type
instance_count = var.worker_count
bid_price = var.worker_bid_price
ebs_config {
size = var.worker_ebs_size
type = "gp2"
volumes_per_instance = 1
}
}
tags = merge(
var.tags,
{
"name" = element(var.names, count.index)
},
)
configurations = file("emr/configuration.json")
service_role = aws_iam_role.training_emr_service_role.arn
depends_on = [
aws_security_group.master,
aws_security_group.slave,
]
bootstrap_action {
path = "s3://bucket/scripts/aws/setup-training.sh"
name = "setup-training"
}
bootstrap_action {
path = "s3://bucket/scripts/aws/install-kafka.sh"
name = "install-kafka"
}
bootstrap_action {
path = "s3://bucket/scripts/aws/install-jupyter-5.2.0.sh"
name = "install-jupyter"
}
bootstrap_action {
path = "s3://bucket/scripts/aws/install-reverse-proxy.sh"
name = "install-reverse-proxy"
args = ["-d", "${element(var.names, count.index)}.${var.proxy_domain}", "-u", var.proxy_user, "-p", var.proxy_password]
}
}
variables.tf
variable "names" {
type = list(string)
default = ["name"]
}
variable "worker_count" {
default = 1
}
variable "worker_type" {
default = "m5.xlarge"
}
variable "worker_bid_price" {
default = "0.048"
}
variable "worker_ebs_size" {
default = "20"
}
variable "master_type" {
default = "m5.xlarge"
}
variable "master_bid_price" {
default = "0.048"
}
variable "master_ebs_size" {
default = "80"
}
variable "release" {
default = "emr-5.26.0"
}
variable "applications" {
type = list(string)
default = ["Spark", "Hadoop", "Pig", "Hue", "Zeppelin", "Hive", "HCatalog", "HBase", "Presto", "Tez", "ZooKeeper"]
}
variable "vpc_id" {
}
variable "subnet_ids" {
type = list(string)
default = []
}
variable "proxy_domain" {
default = "example.com"
}
variable "proxy_user" {
default = "user"
}
variable "proxy_password" {
default = "password"
}
variable "tags" {
type = map(string)
default = {}
}
variable "ssh_key_ids" {
type = list(string)
default = []
}
main.tf
variable "common_tags" {
type = map(string)
default = {
builtWith = "terraform"
terraformGroup = "training-dmx"
}
}
}
}
module "vpc" {
source = "./vpc"
name = "vpc"
tags = var.common_tags
cidr = "10.200.0.0/16"
private_subnets = ["10.200.1.0/24"]
public_subnets = ["10.200.101.0/24"]
enable_nat_gateway = "true"
enable_s3_endpoint = "true"
enable_dns_hostnames = "true"
enable_dns_support = "true"
azs = var.aws_availability_zone
}
module "emr" {
source = "./emr"
tags = var.common_tags
proxy_domain = "aws.example.com"
names = ["cl1","cl2","cl3","cl4","cl5","cl6"]
release = "emr-5.23.0"
applications = ["Spark","Hadoop","Hue","Zeppelin","Hive","Zookeeper"]
master_type = "m5.xlarge"
master_ebs_size = "40"
worker_type = "m5.xlarge"
worker_ebs_size = "40"
worker_count = 1
ssh_key_ids = [aws_key_pair.deployer.id]
vpc_id = module.vpc.vpc_id
subnet_ids = ["module.vpc.public_subnets"]
proxy_user = "user"
proxy_password = "password"
}
module route53 {
source = "./route53"
tags = var.common_tags
names = module.emr.names
targets = module.emr.master_public_dns
zone_name = "aws.example.com"
}
I have a problem, when i deploy appears the next message:
Error: error running EMR Job Flow: ValidationException: The supplied ecSubnetId is not valid.
status code: 400, request id: 8491b195-55c4-4a9c-b883-76dc21b783b3
on emr\emr.tf line 1, in resource "aws_emr_cluster" "cluster":
1: resource "aws_emr_cluster" "cluster" {
i have this code:
emr.tf
variables.tf
main.tf