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

r/aws_datasync_agent: remove ExactlyOneOf activation_key, ip_address #35150

Merged
merged 2 commits into from
Jan 5, 2024

Conversation

jar-b
Copy link
Member

@jar-b jar-b commented Jan 4, 2024

Description

This requirement previously prevented successful import of agents initialized with an activation_key. The activation_key is not returned by the read operation, so setting this required value in configuration always forced a new resource on the next apply. Practitioners could work around the issue with an ignore_changes lifecycle argument, but removing the ExactlyOneOf condition in favor of a ConflictsWith condition allows agents created with an activation key to be imported without requiring the attribute to be set in the corresponding Terraform configuration.

An import statement can now look like:

import {
  to = aws_datasync_agent.example
  id = "arn:aws:datasync:us-east-1:123456789012:agent/agent-12345678901234567"
}

resource "aws_datasync_agent" "example" {
  # activation_key no longer required here!
  name = "example"
}

To replace the removed functionality, an apply-time check has been added to the create operation which verifies at least one of ip_address or activation_key is set. The downside is this requirement won't be checked at plan time as before, but moving the logic here enables import to behave as expected.

Relations

Closes #33458

References

Output from Acceptance Testing

% make testacc PKG=datasync TESTS=TestAccDataSyncAgent_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/datasync/... -v -count 1 -parallel 20 -run='TestAccDataSyncAgent_'  -timeout 360m

--- PASS: TestAccDataSyncAgent_disappears (108.38s)
--- PASS: TestAccDataSyncAgent_agentName (115.58s)
--- PASS: TestAccDataSyncAgent_tags (119.54s)
--- PASS: TestAccDataSyncAgent_basic (122.91s)
--- PASS: TestAccDataSyncAgent_vpcEndpointID (293.69s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/datasync   297.241s

This requirement previously prevented successful import of agents initialized with an activation_key.
The `activation_key` is not returned by the read operation, so setting this required value in configuration
always forced a new resource on the next apply. Practitioners could work around the issue with an `ignore_changes`
`lifecycle` argument, but removing the `ExactlyOneOf` condition in favor of a `ConflictsWith`
condition allows agents created with an activation key to be imported _without_ requiring the attribute
to be set in the corresponding Terraform configuration.
Copy link

github-actions bot commented Jan 4, 2024

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/XS Managed by automation to categorize the size of a PR. service/datasync Issues and PRs that pertain to the datasync service. labels Jan 4, 2024
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jan 4, 2024
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 🚀.

@jar-b jar-b merged commit d69974e into main Jan 5, 2024
34 checks passed
@jar-b jar-b deleted the b-datasync-activation_key-import branch January 5, 2024 14:20
@github-actions github-actions bot added this to the v5.32.0 milestone Jan 5, 2024
github-actions bot pushed a commit that referenced this pull request Jan 5, 2024
Copy link

This functionality has been released in v5.32.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!

@justinretzolk justinretzolk added the bug Addresses a defect in current functionality. label Feb 10, 2024
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 Mar 12, 2024
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. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/datasync Issues and PRs that pertain to the datasync service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: aws_datasync_agent can't be imported cleanly
3 participants