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_datasync_location_fsx_ontap_file_system: fix missing fields in smb #33641

Merged

Conversation

acwwat
Copy link
Contributor

@acwwat acwwat commented Sep 27, 2023

Description

Adds the missing domain, user, and password fields to the smb block's model for the aws_datasync_location_fsx_ontap_file_system resource, so that they are passed to the underlying AWS API request properly. Currently these fields are captured by the Terraform config but not passed down to the AWS API call.

Update: Found an issue with the password field not persisted since it's a sensitive field in the AWS API. This causes Terraform to always detect a resource change. This issue has been fixed and all CRUD operations have been tested locally.

Relations

Closes #33601

References

n/a

Output from Acceptance Testing

n/a - I need help with writing the tests because this change is for testing an FSx ONTAP file system that requires an AD domain. I am not sure how to best change the existing test file.

I built and tested the code using development override locally in my own AWS environment and the DataSync location with SMB parameters (domain, user, password) was created successfully.

@github-actions
Copy link

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 Sep 27, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 27, 2023
@acwwat acwwat force-pushed the b-datasync_loc_fsx_ontap_smb_missing_fields branch from d446afa to 165cc9d Compare September 27, 2023 06:33
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 27, 2023
% make testacc TESTARGS='-run=TestAccDataSyncLocationFSxONTAPFileSystem_basic\|TestAccDataSyncLocationFSxONTAPFileSystem_smb' PKG=datasync
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/datasync/... -v -count 1 -parallel 20  -run=TestAccDataSyncLocationFSxONTAPFileSystem_basic\|TestAccDataSyncLocationFSxONTAPFileSystem_smb -timeout 360m
=== RUN   TestAccDataSyncLocationFSxONTAPFileSystem_basic
=== PAUSE TestAccDataSyncLocationFSxONTAPFileSystem_basic
=== RUN   TestAccDataSyncLocationFSxONTAPFileSystem_smb
=== PAUSE TestAccDataSyncLocationFSxONTAPFileSystem_smb
=== CONT  TestAccDataSyncLocationFSxONTAPFileSystem_basic
=== CONT  TestAccDataSyncLocationFSxONTAPFileSystem_smb
    location_fsx_ontap_file_system_test.go:103: Step 1/2 error: Error running apply: exit status 1

        Error: creating DataSync Location FSx for NetApp ONTAP File System: InvalidParameter: 2 validation error(s) found.
        - missing required field, CreateLocationFsxOntapInput.Protocol.SMB.Password.
        - missing required field, CreateLocationFsxOntapInput.Protocol.SMB.User.

          with aws_datasync_location_fsx_ontap_file_system.test,
          on terraform_plugin_test.tf line 72, in resource "aws_datasync_location_fsx_ontap_file_system" "test":
          72: resource "aws_datasync_location_fsx_ontap_file_system" "test" {

--- PASS: TestAccDataSyncLocationFSxONTAPFileSystem_basic (2365.08s)
--- FAIL: TestAccDataSyncLocationFSxONTAPFileSystem_smb (2408.72s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/datasync	2414.085s
FAIL
make: *** [testacc] Error 1
% ACCTEST_TIMEOUT=720m make testacc TESTARGS='-run=TestAccDataSyncLocationFSxONTAPFileSystem_smb' PKG=datasync
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/datasync/... -v -count 1 -parallel 20  -run=TestAccDataSyncLocationFSxONTAPFileSystem_smb -timeout 720m
=== RUN   TestAccDataSyncLocationFSxONTAPFileSystem_smb
=== PAUSE TestAccDataSyncLocationFSxONTAPFileSystem_smb
=== CONT  TestAccDataSyncLocationFSxONTAPFileSystem_smb
    location_fsx_ontap_file_system_test.go:106: Step 1/2 error: Check failed: 1 error occurred:
        	* Check 8/9 error: aws_datasync_location_fsx_ontap_file_system.test: Attribute 'protocol.0.smb.0.password' expected "MyPassw0rd1", got ""

--- FAIL: TestAccDataSyncLocationFSxONTAPFileSystem_smb (2705.00s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/datasync	2710.293s
FAIL
make: *** [testacc] Error 1
…turned from the API, so propagate from configuration.
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 🚀.

% ACCTEST_TIMEOUT=720m make testacc TESTARGS='-run=TestAccDataSyncLocationFSxONTAPFileSystem_basic\|TestAccDataSyncLocationFSxONTAPFileSystem_smb' PKG=datasync
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/datasync/... -v -count 1 -parallel 20  -run=TestAccDataSyncLocationFSxONTAPFileSystem_basic\|TestAccDataSyncLocationFSxONTAPFileSystem_smb -timeout 720m
=== RUN   TestAccDataSyncLocationFSxONTAPFileSystem_basic
=== PAUSE TestAccDataSyncLocationFSxONTAPFileSystem_basic
=== RUN   TestAccDataSyncLocationFSxONTAPFileSystem_smb
=== PAUSE TestAccDataSyncLocationFSxONTAPFileSystem_smb
=== CONT  TestAccDataSyncLocationFSxONTAPFileSystem_basic
=== CONT  TestAccDataSyncLocationFSxONTAPFileSystem_smb
--- PASS: TestAccDataSyncLocationFSxONTAPFileSystem_smb (2432.96s)
--- PASS: TestAccDataSyncLocationFSxONTAPFileSystem_basic (2537.83s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/datasync	2543.360s

@ewbankkit
Copy link
Contributor

@acwwat Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 8970a31 into hashicorp:main Sep 28, 2023
34 checks passed
@github-actions github-actions bot added this to the v5.19.0 milestone Sep 28, 2023
@github-actions
Copy link

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

@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 Oct 29, 2023
@acwwat acwwat deleted the b-datasync_loc_fsx_ontap_smb_missing_fields branch January 13, 2024 22:30
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. 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
2 participants