Skip to content

Unable to create EFS volume #231

Open
@vanilla-lake

Description

@vanilla-lake

Describe the Bug

When following the steps in Steps to Reproduce, we get the following output:

...
# module.app.module.ecs_alb_service_task.aws_ecs_task_definition.default[0] will be created
  + resource "aws_ecs_task_definition" "default" {
      ...
      + volume {
          + name = "test"
        }
    }
    ...

Expected Behavior

The module should add an efs_volume_configuration block to the volume block. terraform plan should output the following:

...
# module.app.module.ecs_alb_service_task.aws_ecs_task_definition.default[0] will be created
  + resource "aws_ecs_task_definition" "default" {
      ...
      + volume {
          + name = "test"

          + efs_volume_configuration {
              + file_system_id     = (known after apply)
              + root_directory     = "/"
              + transit_encryption = "ENABLED"
            }
        }
    }
    ...

Steps to Reproduce

Run terraform plan in a directory containing a main.tf file with the following content:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 4.0"
    }
  }
}

variable "region" {
  type = string
}

variable "vpc_id" {
  type = string
}

data "aws_subnets" "vpc" {
  filter {
    name   = "vpc-id"
    values = [var.vpc_id]
  }
}

resource "aws_ecs_cluster" "app" {
  name = "app"
}

module "alb" {
  source  = "cloudposse/alb/aws"
  version = "1.7.0"

  name       = "alb"
  namespace  = "ecs-web-app-bug"
  subnet_ids = data.aws_subnets.vpc.ids
  vpc_id     = var.vpc_id
}

module "efs" {
  source  = "cloudposse/efs/aws"
  version = "0.34.0"

  name      = "efs"
  namespace = "ecs-web-app-bug"
  region    = var.region
  subnets   = data.aws_subnets.vpc.ids
  vpc_id    = var.vpc_id
}

module "app" {
  source  = "cloudposse/ecs-web-app/aws"
  version = "1.8.1"

  alb_security_group     = module.alb.security_group_id
  ecs_cluster_arn        = aws_ecs_cluster.app.arn
  ecs_private_subnet_ids = data.aws_subnets.vpc.ids
  name                   = "app"
  namespace              = "ecs-web-app-bug"
  vpc_id                 = var.vpc_id

  volumes = [{
    host_path = null
    name      = "test"

    docker_volume_configuration = []

    efs_volume_configuration = [{
      file_system_id          = module.efs.id
      root_directory          = null
      transit_encryption      = "ENABLED"
      transit_encryption_port = null

      authorization_config = []
    }]
  }]
}

Screenshots

No response

Environment

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🐛 An issue with the system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions