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

rd/efs_file_system - support multiple lifecycle policies #20971

Merged
merged 3 commits into from
Sep 22, 2021

Conversation

DrFaust92
Copy link
Collaborator

@DrFaust92 DrFaust92 commented Sep 21, 2021

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment 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 pull request followers and do not help prioritize the request

Closes #20953

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSEFSFileSystem_'
--- PASS: TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption (42.00s)
--- PASS: TestAccAWSEFSFileSystem_disappears (69.75s)
--- PASS: TestAccAWSEFSFileSystem_availabilityZoneName (82.05s)
--- PASS: TestAccAWSEFSFileSystem_kmsKey (96.62s)
--- PASS: TestAccAWSEFSFileSystem_pagedTags (97.53s)
--- PASS: TestAccAWSEFSFileSystem_ThroughputMode (120.87s)
--- PASS: TestAccAWSEFSFileSystem_basic (131.08s)
--- PASS: TestAccAWSEFSFileSystem_ProvisionedThroughputInMibps (139.01s)
--- PASS: TestAccAWSEFSFileSystem_tags (195.76s)
--- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy (200.39s)
$ make testacc TESTARGS='-run=TestAccDataSourceAwsEfsFileSystem_'
--- PASS: TestAccDataSourceAwsEfsFileSystem_NonExistent (15.88s)
--- PASS: TestAccDataSourceAwsEfsFileSystem_name (58.54s)
--- PASS: TestAccDataSourceAwsEfsFileSystem_availabilityZone (60.45s)
--- PASS: TestAccDataSourceAwsEfsFileSystem_id (62.42s)


--- FAIL: TestAccDataSourceAwsEfsFileSystem_tags (19.77s) -- i believe is unrleated

@github-actions github-actions bot added service/efs Issues and PRs that pertain to the efs service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/S Managed by automation to categorize the size of a PR. labels Sep 21, 2021
@DrFaust92 DrFaust92 added bug Addresses a defect in current functionality. enhancement Requests to existing resources that expand the functionality or scope. labels Sep 21, 2021
@DrFaust92 DrFaust92 marked this pull request as ready for review September 21, 2021 21:44
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

Commercial
% make testacc TESTARGS='-run=TestAccAWSEFSFileSystem_\|TestAccDataSourceAwsEfsFileSystem_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSEFSFileSystem_\|TestAccDataSourceAwsEfsFileSystem_ -timeout 180m
=== RUN   TestAccDataSourceAwsEfsFileSystem_id
=== PAUSE TestAccDataSourceAwsEfsFileSystem_id
=== RUN   TestAccDataSourceAwsEfsFileSystem_tags
=== PAUSE TestAccDataSourceAwsEfsFileSystem_tags
=== RUN   TestAccDataSourceAwsEfsFileSystem_name
=== PAUSE TestAccDataSourceAwsEfsFileSystem_name
=== RUN   TestAccDataSourceAwsEfsFileSystem_availabilityZone
=== PAUSE TestAccDataSourceAwsEfsFileSystem_availabilityZone
=== RUN   TestAccDataSourceAwsEfsFileSystem_NonExistent
=== PAUSE TestAccDataSourceAwsEfsFileSystem_NonExistent
=== RUN   TestAccAWSEFSFileSystem_basic
=== PAUSE TestAccAWSEFSFileSystem_basic
=== RUN   TestAccAWSEFSFileSystem_availabilityZoneName
=== PAUSE TestAccAWSEFSFileSystem_availabilityZoneName
=== RUN   TestAccAWSEFSFileSystem_tags
=== PAUSE TestAccAWSEFSFileSystem_tags
=== RUN   TestAccAWSEFSFileSystem_pagedTags
=== PAUSE TestAccAWSEFSFileSystem_pagedTags
=== RUN   TestAccAWSEFSFileSystem_kmsKey
=== PAUSE TestAccAWSEFSFileSystem_kmsKey
=== RUN   TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption
=== PAUSE TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption
=== RUN   TestAccAWSEFSFileSystem_ProvisionedThroughputInMibps
=== PAUSE TestAccAWSEFSFileSystem_ProvisionedThroughputInMibps
=== RUN   TestAccAWSEFSFileSystem_ThroughputMode
=== PAUSE TestAccAWSEFSFileSystem_ThroughputMode
=== RUN   TestAccAWSEFSFileSystem_lifecyclePolicy
=== PAUSE TestAccAWSEFSFileSystem_lifecyclePolicy
=== RUN   TestAccAWSEFSFileSystem_disappears
=== PAUSE TestAccAWSEFSFileSystem_disappears
=== CONT  TestAccDataSourceAwsEfsFileSystem_id
=== CONT  TestAccAWSEFSFileSystem_pagedTags
=== CONT  TestAccAWSEFSFileSystem_disappears
=== CONT  TestAccDataSourceAwsEfsFileSystem_availabilityZone
=== CONT  TestAccAWSEFSFileSystem_lifecyclePolicy
=== CONT  TestAccAWSEFSFileSystem_ProvisionedThroughputInMibps
=== CONT  TestAccDataSourceAwsEfsFileSystem_NonExistent
=== CONT  TestAccAWSEFSFileSystem_tags
=== CONT  TestAccAWSEFSFileSystem_ThroughputMode
=== CONT  TestAccAWSEFSFileSystem_availabilityZoneName
=== CONT  TestAccDataSourceAwsEfsFileSystem_name
=== CONT  TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption
=== CONT  TestAccAWSEFSFileSystem_basic
=== CONT  TestAccDataSourceAwsEfsFileSystem_tags
=== CONT  TestAccAWSEFSFileSystem_kmsKey
--- PASS: TestAccDataSourceAwsEfsFileSystem_NonExistent (7.69s)
--- PASS: TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption (16.91s)
--- PASS: TestAccAWSEFSFileSystem_availabilityZoneName (74.55s)
--- PASS: TestAccAWSEFSFileSystem_disappears (83.18s)
--- PASS: TestAccDataSourceAwsEfsFileSystem_availabilityZone (84.93s)
--- PASS: TestAccAWSEFSFileSystem_pagedTags (85.88s)
--- PASS: TestAccAWSEFSFileSystem_ProvisionedThroughputInMibps (88.93s)
--- PASS: TestAccAWSEFSFileSystem_kmsKey (95.83s)
--- PASS: TestAccAWSEFSFileSystem_ThroughputMode (101.90s)
--- PASS: TestAccAWSEFSFileSystem_basic (113.70s)
--- PASS: TestAccAWSEFSFileSystem_tags (116.50s)
--- PASS: TestAccDataSourceAwsEfsFileSystem_tags (134.58s)
--- PASS: TestAccDataSourceAwsEfsFileSystem_id (144.75s)
--- PASS: TestAccDataSourceAwsEfsFileSystem_name (171.23s)
--- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy (190.57s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	193.866s
GovCloud
% make testacc TESTARGS='-run=TestAccAWSEFSFileSystem_\|TestAccDataSourceAwsEfsFileSystem_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSEFSFileSystem_\|TestAccDataSourceAwsEfsFileSystem_ -timeout 180m
=== RUN   TestAccDataSourceAwsEfsFileSystem_id
=== PAUSE TestAccDataSourceAwsEfsFileSystem_id
=== RUN   TestAccDataSourceAwsEfsFileSystem_tags
=== PAUSE TestAccDataSourceAwsEfsFileSystem_tags
=== RUN   TestAccDataSourceAwsEfsFileSystem_name
=== PAUSE TestAccDataSourceAwsEfsFileSystem_name
=== RUN   TestAccDataSourceAwsEfsFileSystem_availabilityZone
=== PAUSE TestAccDataSourceAwsEfsFileSystem_availabilityZone
=== RUN   TestAccDataSourceAwsEfsFileSystem_NonExistent
=== PAUSE TestAccDataSourceAwsEfsFileSystem_NonExistent
=== RUN   TestAccAWSEFSFileSystem_basic
=== PAUSE TestAccAWSEFSFileSystem_basic
=== RUN   TestAccAWSEFSFileSystem_availabilityZoneName
=== PAUSE TestAccAWSEFSFileSystem_availabilityZoneName
=== RUN   TestAccAWSEFSFileSystem_tags
=== PAUSE TestAccAWSEFSFileSystem_tags
=== RUN   TestAccAWSEFSFileSystem_pagedTags
=== PAUSE TestAccAWSEFSFileSystem_pagedTags
=== RUN   TestAccAWSEFSFileSystem_kmsKey
=== PAUSE TestAccAWSEFSFileSystem_kmsKey
=== RUN   TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption
=== PAUSE TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption
=== RUN   TestAccAWSEFSFileSystem_ProvisionedThroughputInMibps
=== PAUSE TestAccAWSEFSFileSystem_ProvisionedThroughputInMibps
=== RUN   TestAccAWSEFSFileSystem_ThroughputMode
=== PAUSE TestAccAWSEFSFileSystem_ThroughputMode
=== RUN   TestAccAWSEFSFileSystem_lifecyclePolicy
=== PAUSE TestAccAWSEFSFileSystem_lifecyclePolicy
=== RUN   TestAccAWSEFSFileSystem_disappears
=== PAUSE TestAccAWSEFSFileSystem_disappears
=== CONT  TestAccDataSourceAwsEfsFileSystem_id
=== CONT  TestAccAWSEFSFileSystem_pagedTags
=== CONT  TestAccAWSEFSFileSystem_ThroughputMode
=== CONT  TestAccDataSourceAwsEfsFileSystem_tags
=== CONT  TestAccAWSEFSFileSystem_ProvisionedThroughputInMibps
=== CONT  TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption
=== CONT  TestAccAWSEFSFileSystem_disappears
=== CONT  TestAccAWSEFSFileSystem_kmsKey
=== CONT  TestAccAWSEFSFileSystem_availabilityZoneName
=== CONT  TestAccAWSEFSFileSystem_basic
=== CONT  TestAccAWSEFSFileSystem_tags
=== CONT  TestAccDataSourceAwsEfsFileSystem_name
=== CONT  TestAccAWSEFSFileSystem_lifecyclePolicy
=== CONT  TestAccDataSourceAwsEfsFileSystem_availabilityZone
=== CONT  TestAccDataSourceAwsEfsFileSystem_NonExistent
--- PASS: TestAccDataSourceAwsEfsFileSystem_NonExistent (7.79s)
--- PASS: TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption (18.10s)
--- PASS: TestAccAWSEFSFileSystem_availabilityZoneName (36.93s)
--- PASS: TestAccDataSourceAwsEfsFileSystem_name (68.23s)
--- PASS: TestAccDataSourceAwsEfsFileSystem_tags (75.33s)
--- PASS: TestAccAWSEFSFileSystem_kmsKey (84.00s)
--- PASS: TestAccAWSEFSFileSystem_disappears (103.36s)
--- PASS: TestAccDataSourceAwsEfsFileSystem_availabilityZone (111.73s)
--- PASS: TestAccAWSEFSFileSystem_basic (115.45s)
--- PASS: TestAccAWSEFSFileSystem_ProvisionedThroughputInMibps (115.76s)
--- PASS: TestAccAWSEFSFileSystem_tags (124.86s)
--- PASS: TestAccAWSEFSFileSystem_pagedTags (144.91s)
--- PASS: TestAccDataSourceAwsEfsFileSystem_id (146.73s)
--- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy (151.48s)
--- PASS: TestAccAWSEFSFileSystem_ThroughputMode (169.18s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	172.408s

@ewbankkit
Copy link
Contributor

@DrFaust92 Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit c8fdd1f into hashicorp:main Sep 22, 2021
@github-actions github-actions bot added this to the v3.60.0 milestone Sep 22, 2021
@DrFaust92 DrFaust92 deleted the efs_fix_lifecycle branch September 23, 2021 22:34
@github-actions
Copy link

This functionality has been released in v3.60.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@James-Sjogren
Copy link

This functionality appears to be broken in AWS provider 4.17.1 using Terraform 1.2.2. The functionality to put two lifecycle_policy no longer works.

lifecycle_policy {
transition_to_ia = "AFTER_60_DAYS"
transition_to_primary_storage_class = "AFTER_1_ACCESS"
}

Once again you can no longer provide multiple arguments to the aws_efs_file_system resource. (See the old error again)

{
│ RespMetadata: {
│ StatusCode: 400,
│ RequestID: "c6912f71-680e-4585-8555-5a13faf5fd2b"
│ },
│ ErrorCode: "BadRequest",
│ Message_: "One or more LifecyclePolicy objects specified are malformed."
│ }

Note: This works correctly with the just one item defined. Either transition_to_ia or transition_to_primary_storage_class. It doesn't work when both are selected.

@leroykayanda
Copy link

leroykayanda commented Jun 13, 2022

Have gotten this error as well

lifecycle_policy {
    transition_to_ia                    = "AFTER_30_DAYS"
    transition_to_primary_storage_class = "AFTER_1_ACCESS"
  }

**Error: error creating EFS file system (REDACTED) lifecycle configuration: BadRequest: One or more LifecyclePolicy objects specified are malformed. { RespMetadata: { StatusCode: 400, RequestID: "REDACTED" }, ErrorCode: "BadRequest", Message: "One or more LifecyclePolicy objects specified are malformed." }
with aws_efs_file_system.efs_file_system

terraform --version
Terraform v1.2.2

Initializing provider plugins...

  • Using previously-installed hashicorp/aws v4.18.0

@James-Sjogren
Copy link

James-Sjogren commented Jun 13, 2022

This appears to actually have been fixed in the newer version. I've provided an example of code style that worked for me.

resource "aws_efs_file_system" "resource-name" {
creation_token = "some-name"
performance_mode = "generalPurpose"
throughput_mode = "bursting"
encrypted = "true"

tags = {
Name = "some-name"
Terraform = "true"
}

lifecycle_policy {
transition_to_primary_storage_class = "AFTER_1_ACCESS"
}

lifecycle_policy {
transition_to_ia = "AFTER_60_DAYS"
}
}

@github-actions
Copy link

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 Jul 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. enhancement Requests to existing resources that expand the functionality or scope. service/efs Issues and PRs that pertain to the efs service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_efs_file_system lifecycle_policy fails with more than one argument
4 participants