Skip to content

fix: Only create mount point for EFS when using EFS #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 1, 2022

Conversation

MarkIannucci
Copy link
Contributor

@MarkIannucci MarkIannucci commented Feb 18, 2022

Description

Fixes #254 by adding a conditional to the mount so we only create the mount when we are adding storage for EFS.

How Has This Been Tested?

  • I have tested and validated these changes using one or more of the provided examples/* projects

Needs an example which I haven't completed yet.

@MarkIannucci MarkIannucci changed the title Fix: only create mount point for EFS when using EFS fix: only create mount point for EFS when using EFS Feb 18, 2022
for_each = zipmap(coalescelist(var.private_subnets, var.private_subnet_ids), local.private_subnet_ids)
for_each = {
for k, v in zipmap(coalescelist(var.private_subnets, var.private_subnet_ids), local.private_subnet_ids) : k => v
if var.enable_ephemeral_storage == false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if var.enable_ephemeral_storage == false
if var.enable_ephemeral_storage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created an example which github-ephemeral-storage which uses ephemeral storage and works with the code as written.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be if ! var.enable_ephemeral_storage? We only want to make this map if we need to mount EFS.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh thats my bad, didn't understand the variable fully. this is not great - we should have never accepted the enable_ephemeral_storage and instead it should have been enable_efs_storage which is false by default and users then opt in. reading through the module now, everything is backwards and confusing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I struggled with how to simultaneously support ephemeral storage, EFS, and whatever Amazon calls the capacity constrained storage that Fargate provides by default.

Ultimately, I decided to try to encourage EFS adoption because it fixes #206. In doing that, I unintentionally broke ephemeral storage users (who apparently aren't too worried about #206 ).

So... Where to go from here?

I agree with @llamahunter. Merge #261 so we can fix stuff for the people who rely on the ephemeral storage and #257 so we're safer by default.

That doesn't resolve the everything is "backwards and confusing problem" (which is a pretty good way to describe it :)

Long term, I'd like to see us fix #19. Doing so would allow us to remove a lot of complexity (and cost) from this module since we wouldn't need ALB or ephemeral storage support.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand the whole picture, but I have executed examples/github-complete with enable_ephemeral_storage set as true and false. Both cases created some resources.

@bryantbiggs Should this be merged as it is, or do we still need something implemented in this PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If its deployable, lets ship it - we can continue making adjustments after

@MarkIannucci MarkIannucci changed the title fix: only create mount point for EFS when using EFS fix: Only create mount point for EFS when using EFS Feb 18, 2022
@llamahunter
Copy link

what's the status of this PR? Seems unmerged for nearly a month after approval. In the meantime, ephemeral storage doesn't work at all.

@dgokcin
Copy link

dgokcin commented Apr 1, 2022

ephemeral storage still has problems. I really want to try atlantis and I am blocked because of this issue. Here is my error message
image

Here is my basic terragrunt config

image
any help is appreciated.

Copy link
Member

@antonbabenko antonbabenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works!

@bryantbiggs WDYT?

@@ -37,6 +37,9 @@ module "atlantis" {
private_subnets = ["10.20.1.0/24", "10.20.2.0/24", "10.20.3.0/24"]
public_subnets = ["10.20.101.0/24", "10.20.102.0/24", "10.20.103.0/24"]

# EFS
enable_ephemeral_storage = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is enough to have this argument in one example. I have removed the copied one.

for_each = zipmap(coalescelist(var.private_subnets, var.private_subnet_ids), local.private_subnet_ids)
for_each = {
for k, v in zipmap(coalescelist(var.private_subnets, var.private_subnet_ids), local.private_subnet_ids) : k => v
if var.enable_ephemeral_storage == false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand the whole picture, but I have executed examples/github-complete with enable_ephemeral_storage set as true and false. Both cases created some resources.

@bryantbiggs Should this be merged as it is, or do we still need something implemented in this PR?

@antonbabenko antonbabenko merged commit b1b61f3 into terraform-aws-modules:master Apr 1, 2022
antonbabenko pushed a commit that referenced this pull request Apr 1, 2022
### [3.13.1](v3.13.0...v3.13.1) (2022-04-01)

### Bug Fixes

* Only create mount point for EFS when using EFS ([#261](#261)) ([b1b61f3](b1b61f3))
@antonbabenko
Copy link
Member

This PR is included in version 3.13.1 🎉

@dgokcin
Copy link

dgokcin commented Apr 2, 2022

@antonbabenko I am still having efs related problems after the fixes that are done yesterday. Here is my config file

include {
  path = find_in_parent_folders()
}

locals {
  common_vars                                     = yamldecode(file(find_in_parent_folders("common_vars.yaml")))
  hosted_zone                                     = "example.com"
  certificate_arn                                 = "arn:aws:acm:eu-west-1:141757035671:certificate/52bbc00f-857c-45dd-b8ea-20bb8dfbcfec"
  alb_ingress_cidr_blocks                         = "MY_EXTERNAL_IP_ADDRESS/32"
}

terraform {
  source = "../../..//modules/terraform-aws-atlantis"
}

inputs = {
  name = "atlantis"

  vpc_id             = dependency.vpc.outputs.vpc_id
  private_subnet_ids = dependency.vpc.outputs.private_subnets
  public_subnet_ids  = dependency.vpc.outputs.public_subnets


  # DNS
  create_route53_record = false
  route53_zone_name = local.hosted_zone
  certificate_arn   = local.certificate_arn

  # Atlantis
  atlantis_github_user       = "atlantis-bot"
  atlantis_github_user_token = "examplegithubtoken"
  atlantis_repo_allowlist    = ["github.com/MyGitHubOrg/*"]

  # EFS
  enable_ephemeral_storage   = false

  allow_unauthenticated_access = true
  allow_github_webhooks        = true

  # alb
  alb_ingress_cidr_blocks         = local.alb_ingress_cidr_blocks


  tags = local.common_vars.tags
}

dependency "vpc" {
  config_path = "../vpc"
}

dependency "alb" {
  config_path = "../alb/main"
}

As you see, I have the latest updates. Any suggestions on what might I be missing?
image

@bryantbiggs
Copy link
Member

bryantbiggs commented Apr 2, 2022

@dgokcin please file a new issue with a complete reproduction (i.e. - without your terragrunt and other specifics, start with the examples provided in the project and modify to reproduce your issue)

titanlien pushed a commit to Flaconi/terraform-aws-atlantis that referenced this pull request Jun 8, 2022
titanlien pushed a commit to Flaconi/terraform-aws-atlantis that referenced this pull request Jun 8, 2022
titanlien pushed a commit to Flaconi/terraform-aws-atlantis that referenced this pull request Jun 8, 2022
titanlien pushed a commit to Flaconi/terraform-aws-atlantis that referenced this pull request Jun 8, 2022
titanlien pushed a commit to Flaconi/terraform-aws-atlantis that referenced this pull request Jun 9, 2022
titanlien pushed a commit to Flaconi/terraform-aws-atlantis that referenced this pull request Jun 9, 2022
@github-actions
Copy link

github-actions bot commented Nov 8, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: enable_ephemeral_storage broken by update to support EFS to persist Atlantis state
6 participants