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

[Bug]: Unable to update storage gateway SMB acl_enabled flag #36385

Closed
johnlister opened this issue Mar 14, 2024 · 5 comments · Fixed by #37611
Closed

[Bug]: Unable to update storage gateway SMB acl_enabled flag #36385

johnlister opened this issue Mar 14, 2024 · 5 comments · Fixed by #37611
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/storagegateway Issues and PRs that pertain to the storagegateway service.
Milestone

Comments

@johnlister
Copy link

johnlister commented Mar 14, 2024

Terraform Core Version

1.6.3

AWS Provider Version

5.40.0

Affected Resource(s)

aws_storagegateway_smb_file_share

Expected Behavior

changing the value of the smb_acl_enabled flag should update the resource

Actual Behavior

provider crashes

Relevant Error/Panic Output Snippet

│ Error: Request cancelled
│
│   with aws_storagegateway_smb_file_share.etl_bucket_smb[0],
│   on fileshares.tf line 75, in resource "aws_storagegateway_smb_file_share" "etl_bucket_smb":
│   75: resource "aws_storagegateway_smb_file_share" "etl_bucket_smb" {
│
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-aws_v5.40.0_x5 plugin:

panic: runtime error: index out of range [0] with length 0

goroutine 113 [running]:
github.com/hashicorp/terraform-provider-aws/internal/service/storagegateway.resourceSMBFileShareUpdate({0x12c75828, 0xc0040d6d80}, 0xc003cfc700, {0x111f4e20?, 0xc003839180?})
        github.com/hashicorp/terraform-provider-aws/internal/service/storagegateway/smb_file_share.go:386 +0x152f
github.com/hashicorp/terraform-provider-aws/internal/provider.New.(*wrappedResource).Update.interceptedHandler[...].func10(0x0?, {0x111f4e20?, 0xc003839180?})
        github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:112 +0x283
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x12c75828?, {0x12c75828?, 0xc003f8cdb0?}, 0xd?, {0x111f4e20?, 0xc003839180?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:807 +0x7a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc001b36700, {0x12c75828, 0xc003f8cdb0}, 0xc003b040d0, 0xc003cfc400, {0x111f4e20, 0xc003839180})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:919 +0x83a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0038480d8, {0x12c75828?, 0xc003f8ccc0?}, 0xc000a93400)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:1078 +0xdbc
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x12c75860?, {0x12c75828?, 0xc003f8c9c0?}, 0xc000a93400)
        github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc001b3aa00, {0x12c75828?, 0xc004194210?}, 0xc0008d8070)
        github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/tf5server/server.go:846 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x10fa0000?, 0xc001b3aa00}, {0x12c75828, 0xc004194210}, 0xc0041c8000, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.22.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc001582a00, {0x12c75828, 0xc004194180}, {0x12cab618, 0xc003980680}, 0xc0041ac000, 0xc0038e3830, 0x1acd67b8, 0x0)
        google.golang.org/grpc@v1.62.0/server.go:1383 +0xe03
google.golang.org/grpc.(*Server).handleStream(0xc001582a00, {0x12cab618, 0xc003980680}, 0xc0041ac000)
        google.golang.org/grpc@v1.62.0/server.go:1794 +0x100c
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.62.0/server.go:1027 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 42
        google.golang.org/grpc@v1.62.0/server.go:1038 +0x135

Error: The terraform-provider-aws_v5.40.0_x5 plugin crashed!

Terraform Configuration Files

resource "aws_storagegateway_smb_file_share" "etl_bucket_smb" {
  count = contains(local.shared_buckets, lower("cpp-${var.environment}-india-etl")) ? 1 : 0

  authentication        = "ActiveDirectory"
  gateway_arn           = "arn:aws:storagegateway:${data.aws_region.current.name}:${data.aws_caller_identity.current.id}:gateway/${var.storage_gateway_id}"
  location_arn          = lower("arn:aws:s3:::cpp-${var.environment}-india-etl")
  role_arn              = local.fileshare_role.arn
  vpc_endpoint_dns_name = var.s3_interface_dns_name
  bucket_region         = data.aws_region.current.name
  audit_destination_arn = local.audit_log_group_arn
  file_share_name       = lower("${var.environment}-etl")
  smb_acl_enabled       = true

  # authentication
  admin_user_list = lookup(var.share_admin_roles, lower("cpp-${var.environment}-india-etl"), null)
  valid_user_list = concat(
    lookup(var.authorised_gateway_users, lower("cpp-${var.environment}-india-etl"), []),
    [for group in lookup(var.authorised_gateway_groups, lower("cpp-${var.environment}-india-etl"), []) : "@${group}"]
  )
  invalid_user_list = concat(
    lookup(var.denied_gateway_users, lower("cpp-${var.environment}-india-etl"), []),
    [for group in lookup(var.denied_gateway_groups, lower("cpp-${var.environment}-india-etl"), []) : "@${group}"]
  )

  tags = merge(
    {
      Name = "${var.environment} ETL Bucket Share"
    },
    local.common_tags
  )
}

Steps to Reproduce

run the terraform and change the value from false to true

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@johnlister johnlister added the bug Addresses a defect in current functionality. label Mar 14, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added crash Results from or addresses a Terraform crash or kernel panic. service/storagegateway Issues and PRs that pertain to the storagegateway service. labels Mar 14, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 14, 2024
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Mar 20, 2024
@acwwat
Copy link
Contributor

acwwat commented May 20, 2024

I believe the crash is actually not caused by changing smb_acl_enabled, but caused by removing the cache_attributes block in an update scenario. I've checked in a fix for the crash, however there is still another issue where the previously set cache_attributes value will not be removed on the AWS resource even if you remove the block from the Terraform configuration. That's more of an AWS-side issue and should be separately addressed.

Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.51.0 milestone May 22, 2024
Copy link

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

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 23, 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. crash Results from or addresses a Terraform crash or kernel panic. service/storagegateway Issues and PRs that pertain to the storagegateway service.
Projects
None yet
3 participants