Skip to content
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

aws_efs_file_system: Create additional resource for lifecycle policy: aws_efs_file_system_lifecycle_policy #25482

Open
jornfranke opened this issue Jun 20, 2022 · 3 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. new-resource Introduces a new resource. service/efs Issues and PRs that pertain to the efs service.

Comments

@jornfranke
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Currently, one can create a EFS filesystem using efs_file_system and attach in the same resource a lifecycle policy. However, in certain cases, such as an aws_sagemaker_domain the EFS is not directly created by TF. In order to avoid manual imports etc., I suggest to create a resource aws_efs_file_system_lifecycle_policy to update the lifecycle policy also for those cases with the same cotnent as lifecycle policy.

New or Affected Resource(s)

  • aws_efs_file_system_lifecycle_policy

Potential Terraform Configuration

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

resource "aws_efs_file_system" "foo" {
  creation_token = "my-product"

  tags = {
    Name = "MyProduct"
  }
}

  resource "aws_efs_file_system_lifecycle_policy" "example" {
    efs_file_system_id = aws_efs_file_system.foo.id
    transition_to_ia = "AFTER_30_DAYS"
    transition_to_primary_storage_class = "AFTER_1_ACCESS"
  }

More complex example with a AWS Sagemaker Domain


  resource "aws_efs_file_system_lifecycle_policy" "example" {
    efs_file_system_id = aws_sagemaker_domain.example.home_efs_file_system_id
    transition_to_ia = "AFTER_30_DAYS"
    transition_to_primary_storage_class = "AFTER_1_ACCESS"
  }

resource "aws_sagemaker_domain" "example" {
  domain_name = "example"
  auth_mode   = "IAM"
  vpc_id      = aws_vpc.test.id
  subnet_ids  = [aws_subnet.test.id]

  default_user_settings {
    execution_role = aws_iam_role.test.arn
  }
}

resource "aws_iam_role" "example" {
  name               = "example"
  path               = "/"
  assume_role_policy = data.aws_iam_policy_document.example.json
}

data "aws_iam_policy_document" "example" {
  statement {
    actions = ["sts:AssumeRole"]

    principals {
      type        = "Service"
      identifiers = ["sagemaker.amazonaws.com"]
    }
  }
}

References

  • #0000
@jornfranke jornfranke added the enhancement Requests to existing resources that expand the functionality or scope. label Jun 20, 2022
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/efs Issues and PRs that pertain to the efs service. service/iam Issues and PRs that pertain to the iam service. service/sagemaker Issues and PRs that pertain to the sagemaker service. labels Jun 20, 2022
@jornfranke
Copy link
Author

@justinretzolk justinretzolk added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 19, 2022
@DrFaust92 DrFaust92 removed service/iam Issues and PRs that pertain to the iam service. service/sagemaker Issues and PRs that pertain to the sagemaker service. labels Dec 4, 2022
@fabriciocarboni
Copy link

following up.

@Alexj12
Copy link

Alexj12 commented Sep 21, 2023

This would be helpful, as I believe it would allow a lifecycle policy on EFS systems created by efs_replication_configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Requests to existing resources that expand the functionality or scope. new-resource Introduces a new resource. service/efs Issues and PRs that pertain to the efs service.
Projects
None yet
Development

No branches or pull requests

5 participants