Very difficult to specify both transition_to_ia and transition_to_primary_storage_class in lifecycle policies
kartsm opened this issue · 2 comments
Description
Please provide a clear and concise description of the issue you are encountering, and a reproduction of your configuration (see the examples/*
directory for references that you can copy+paste and tailor to match your configs if you are unable to copy your exact configuration). The reproduction MUST be executable by running terraform init && terraform apply
without any further changes.
If your request is for a new feature, please use the Feature request
template.
- ✋ I have searched the open/closed issues and my issue is not listed.
⚠️ Note
Before you submit an issue, please perform the following first:
- Remove the local
.terraform
directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!):rm -rf .terraform/
- Re-initialize the project root to pull down modules:
terraform init
- Re-attempt your terraform plan or apply and check if the issue still persists
Versions
-
Module version [Required]: 1.0.1
-
Terraform version:
Terraform v1.3.4
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v4.39.0
- Provider version(s):
(output identical to above)
Reproduction Code [Required]
provider "aws" {
region = "us-east-1"
}
module "maybe_efs" {
source = "terraform-aws-modules/efs/aws"
version = "v1.0.1"
create = true
name = "lorem-ipsum"
lifecycle_policy = {
transition_to_ia = "AFTER_7_DAYS"
transition_to_primary_storage_class = "AFTER_1_ACCESS"
}
}
Steps to reproduce the behavior:
terraform init
with above codeterraform plan -out apply-${TF_WORKSPACE:-default}.tfplan
terraform apply apply-${TF_WORKSPACE:-default}.tfplan
Expected behavior
Applies successfully.
Actual behavior
╷
│ Error: error creating EFS file system (fs-0659eb16fd4b7abe4) lifecycle configuration: BadRequest: One or more LifecyclePolicy objects specified are malformed.
│ {
│ RespMetadata: {
│ StatusCode: 400,
│ RequestID: "2c30e1a2-97a2-4597-bd8f-9c5d3e058c4b"
│ },
│ ErrorCode: "BadRequest",
│ Message_: "One or more LifecyclePolicy objects specified are malformed."
│ }
│
│ with module.maybe_efs.aws_efs_file_system.this[0],
│ on .terraform/modules/maybe_efs/main.tf line 5, in resource "aws_efs_file_system" "this":
│ 5: resource "aws_efs_file_system" "this" {
│
╵
The EFS filesystem is created, but the resource is tainted.
If I remove either transition_to_ia
or transition_to_primary_storage_class
from my lifecycle_policy
then it will apply just fine. But due to the particular for_each
expression used by dynamic "lifecycle_policy"
, I don't know if it is possible to construct a data structure that can pass both lifecycle attributes successfully.
Terminal Output Screenshot(s)
Additional context
I will be opening a pull request with a suggested fix.
This issue has been resolved in version 1.1.1 🎉
I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.