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

SG ID not imported for FSx #9795

Closed
onur-sam-gtn-ai opened this issue Aug 16, 2019 · 6 comments
Closed

SG ID not imported for FSx #9795

onur-sam-gtn-ai opened this issue Aug 16, 2019 · 6 comments
Labels
service/fsx Issues and PRs that pertain to the fsx service.

Comments

@onur-sam-gtn-ai
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

  • Terraform v0.12.6

Affected Resource(s)

  • aws_fsx_lustre_file_system

Expected Behavior

  • terraform import for FSx Lustre should have imported security_group_ids as well

Actual Behavior

# aws_fsx_lustre_file_system.lustre[0] must be replaced
-/+ resource "aws_fsx_lustre_file_system" "lustre" {
      ~ arn                           = "redacted" -> (known after apply)
      ~ dns_name                      = "redacted.amazonaws.com" -> (known after apply)
        export_path                   = "s3://redacted"
      ~ id                            = "fs-redacted" -> (known after apply)
        import_path                   = "s3://redacted"
      ~ imported_file_chunk_size      = 2048 -> (known after apply)
      ~ network_interface_ids         = [
          - "eni-redacted",
          - "eni-redacted",
        ] -> (known after apply)
      ~ owner_id                      = "redacted" -> (known after apply)
      + security_group_ids            = [
          + "SAME SG ID AS THE ONE ALREADY ON THE FSx",
        ] # forces replacement

FSx support was only recently merged, see PR-9761.

@ghost ghost added the service/fsx Issues and PRs that pertain to the fsx service. label Aug 16, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Aug 16, 2019
@bflad
Copy link
Contributor

bflad commented Aug 16, 2019

Hi @onur-sam-gtn-ai 👋 Thank you for reporting this.

Currently, the FSx API does not provide a method for reading this information, so therefore Terraform cannot know this information during resource import. We try to note this in the import section the resource documentation along with a workaround:

Certain resource arguments, like security_group_ids, do not have a FSx API method for reading the information after creation. If the argument is set in the Terraform configuration on an imported resource, Terraform will always show a difference. To workaround this behavior, either omit the argument from the Terraform configuration or use ignore_changes to hide the difference

So for your Terraform configuration:

resource "aws_fsx_lustre_file_system" "lustre" {
  # ... other configuration ...

  # There is no FSx API for reading security_group_ids
  lifecycle {
    ignore_changes = [security_group_ids]
  }
}

If you would like to see this support added, we would suggest opening a AWS Support Case or reaching out to your AWS account team if you have one. When the information is available from the API, this limitation can be removed from the Terraform resource. 👍 Also, if we can improve our documentation, please let us know. Thanks again.

@bflad bflad closed this as completed Aug 16, 2019
@onur-sam-gtn-ai
Copy link
Author

I'm no Terraform expert so excuse my ignorance, but isn't it possible to just query the returned ENI's and store the SG information there in the state file during the FSx import?

@slapula
Copy link
Contributor

slapula commented Aug 16, 2019

@onur-sam-gtn-ai That would involve several calls to non-FSx APIs (EC2 and or VPC if I recall) that is not practical or encouraged when developing resources (@bflad can correct me if I'm wrong here). IMO, this is a bug that AWS needs to fix. This is data that should be returned when calling a Describe on a filesystem even if it can only be set during creation time.

@bflad
Copy link
Contributor

bflad commented Aug 16, 2019

@onur-sam-gtn-ai potentially, but there are caveats to performing that sort of logic outside the AWS service's handling/API:

  • At best we will be guessing about the underlying implementation, the implementation may change over time, and operators/AWS may have the ability to adjust those ENI security groups in ways that could break assumptions in the implementation. We typically try to avoid the maintenance burden of special handling such as this.
  • As a general project principle, we try extremely hard to avoid cross-AWS-service logic within resources. Most operators when working with a specific Terraform resource only expect it to be accessing the service that implements the resource itself and may have otherwise restrictive IAM Policies that prevent accessing other services.

We might be able to accept an implementation if it is documented by the AWS service team, has compatibility guarantees, and falls back to not causing the Terraform resource to return an error.

@onur-sam-gtn-ai
Copy link
Author

No worries, I'll raise a support ticket with AWS regarding this at the first opportunity. Thanks for all the prompt responses!

@ghost
Copy link

ghost commented Nov 1, 2019

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Nov 1, 2019
@breathingdust breathingdust removed the needs-triage Waiting for first response or review from a maintainer. label Sep 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/fsx Issues and PRs that pertain to the fsx service.
Projects
None yet
Development

No branches or pull requests

4 participants