Skip to content

feat: Ensure EFS is owned by the posix_user to avoid permission issues #287

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

Conversation

affelaffen
Copy link
Contributor

Description

When specifying a user for running the container, e.g. using the 100:1000 Atlantis user on the default image, the aws_efs_access_point is correctly configured with said posix_user, but the ownership of the root directory is left as the default root:root. This can result in different permission issues, one of which is described in runatlantis/atlantis#2221. By specifying the creation_info, we ensure that the user provided as the executing posix user also owns the directory. If desired, this change can be put behind a feature variable.

Motivation and Context

The issue described in runatlantis/atlantis#2221 is the primary motivation for this change.

Breaking Changes

No breaking changes as such, but this will force recreation of an existing aws_efs_access_point and thus the aws_ecs_task_definition.

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

@jensenbox
Copy link

@affelaffen I applied this change locally and rebuilt my ECS cluster, EFS volume and EFS Access point and I am still encountering the unsafe repository is owned by someone else issue.

Any suggestion here?

@affelaffen
Copy link
Contributor Author

affelaffen commented Jun 14, 2022

@affelaffen I applied this change locally and rebuilt my ECS cluster, EFS volume and EFS Access point and I am still encountering the unsafe repository is owned by someone else issue.

Any suggestion here?

Do you run the module with user = "100:1000"? This is the atlantis user on the official image.

@jensenbox
Copy link

jensenbox commented Jun 14, 2022 via email

@affelaffen
Copy link
Contributor Author

Since I am using a slightly modified entrypoint script, I did not experience this issue. I tried with a completely new setup and the default image and also ran into the issue with permissions within the /home/atlantis folder. I modified the aws_efs_access_point path to point directly to the home folder instead, and this seems to have solved the issue.

@userhas404d
Copy link

Since I am using a slightly modified entrypoint script, I did not experience this issue. I tried with a completely new setup and the default image and also ran into the issue with permissions within the /home/atlantis folder. I modified the aws_efs_access_point path to point directly to the home folder instead, and this seems to have solved the issue.

@affelaffen confirmed this works - thanks!

@antonbabenko antonbabenko merged commit 61cdf8f into terraform-aws-modules:master Jun 15, 2022
antonbabenko pushed a commit that referenced this pull request Jun 15, 2022
## [3.17.0](v3.16.0...v3.17.0) (2022-06-15)

### Features

* Ensure EFS is owned by the posix_user to avoid permission issues ([#287](#287)) ([61cdf8f](61cdf8f))
@antonbabenko
Copy link
Member

This PR is included in version 3.17.0 🎉

@antonbabenko
Copy link
Member

Thank you all for the fix and confirmation that it works!

@affelaffen affelaffen deleted the efs-creation-info branch June 22, 2022 08:20
@pauloconnor
Copy link

This is a breaking change - if you have been running this previously, and have mounted / as your path, changing it to /home/atlantis will result in losing all your previous checkouts and plans. In order to fix it, you need to create a new /home/atlantis in your existing mount, then copy everything over, ensuring permissions are updated

@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.

5 participants