hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.76k stars 9.12k forks source link

[Bug]: missing dns_name in aws_fsx_ontap_file_system #38179

Closed relivnd closed 3 months ago

relivnd commented 3 months ago

Terraform Core Version

1.9.0

AWS Provider Version

5.56.0

Affected Resource(s)

aws_fsx_ontap_file_system

Expected Behavior

I expect a string containing the DNS name at the dns_name field in the state. The DNS name is visible in the AWS Console.

Actual Behavior

The field is null and thus can't be used e.g. to mount the file-share via nfs. image

Relevant Error/Panic Output Snippet

# data.aws_fsx_ontap_file_system.example:
data "aws_fsx_ontap_file_system" "example" {
    arn                               = "arn:aws:fsx:eu-central-1:3*****7:file-system/fs-0*******d"
    automatic_backup_retention_days   = 7
    daily_automatic_backup_start_time = "05:00"
    deployment_type                   = "MULTI_AZ_1"
    disk_iops_configuration           = [
        {
            iops = 3072
            mode = "USER_PROVISIONED"
        },
    ]
    dns_name                          = null
    endpoint_ip_address_range         = "***.***.***.0/24"
    endpoints                         = [
        {
            intercluster = [
                {
                    dns_name     = "intercluster.fs-0****d.fsx.eu-central-1.amazonaws.com"
                    ip_addresses = [
                        "***.***.***.0",
                        "***.***.***.0",
                    ]
                },
            ]
            management   = [
                {
                    dns_name     = "management.fs-0*****d.fsx.eu-central-1.amazonaws.com"
                    ip_addresses = [
                        "***.***.***.0",
                    ]
                },
            ]
        },
    ]
    ha_pairs                          = 1
    id                                = "fs-0****d"
    kms_key_id                        = "arn:aws:kms:eu-central-1:3****7:key/4****-67f8-47de-8c38-*********3"
    network_interface_ids             = [
        "eni-0***e",
        "eni-0***6",
    ]
    owner_id                          = "3******7"
    preferred_subnet_id               = "subnet-0******5"
    route_table_ids                   = [
        "rtb-02aad3a7e884d85f1",
    ]
    storage_capacity                  = 1024
    storage_type                      = "SSD"
    subnet_ids                        = [
        "subnet-0******5",
        "subnet-0******5",
    ]
    tags                              = {
        "Name"                  = "cst-trc-dev-app-server-fsx"
        "managed_by"            = "Terraform"
        "terraform-aws-modules" = "fsx"
    }
    throughput_capacity               = 128
    throughput_capacity_per_ha_pair   = 128
    vpc_id                            = "vpc-0*****6"
    weekly_maintenance_start_time     = "1:06:00"
}

Terraform Configuration Files

terraform { required_version = ">= 1.8.4"

required_providers { aws = { source = "hashicorp/aws" version = ">= 5.0" } } }

provider "aws" { region = "eu-central-1"

default_tags { tags = { managed_by = "Terraform" repository = "something" } } }

data "aws_fsx_ontap_file_system" "example" { id = "id-of_deployed_fsx_ontap" }

Steps to Reproduce

  1. Deploy fsx NetApp ONTAP either manually or with https://github.com/terraform-aws-modules/terraform-aws-fsx/tree/master/modules/ontap
  2. set the right fsx id within the data block
  3. apply
  4. look at element in state terraform state show data.aws_fsx_ontap_file_system.example ==> Missing dns_name

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 3 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

acwwat commented 3 months ago

If I am not mistaken, FSx for ONTAP file systems would only provide DNS names for the management and inter-cluster endpoint. To access the file system and volumes, you also need to use a Storage Virtual Machine (SVM), which should provide you with the endpoint (DNS name) to connect to it for different protocols (SMB, NFS, iSCSI). See the aws_fsx_ontap_storage_virtual_machine resource for details.

The aws_fsx_ontap_file_system resource likely just inherited the dns_name attribute that is part of the more general FileSystem data type that is common across different flavors of FSx, but not "used" for FSx for ONTAP file systems.

relivnd commented 3 months ago

You're right. I resolved it in my case by using the DNS name from data.aws_fsx_ontap_storage_virtual_machine and concatenating it with the junction path of the volume. Although it might even be slightly cleaner to use the data block for the SVM in the first place, I think it would be better to either:

Otherwise one is just questioning why the code is not working, even though there's an underlying reason. Currently, the documentation is misleading to: dns_name - DNS name for the file system (e.g. fs-12345678.corp.example.com).

acwwat commented 3 months ago

I think adding a note to the documentation is the most sensible option for now - I've submitted a PR.

github-actions[bot] commented 3 months ago

[!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[bot] commented 2 months ago

This functionality has been released in v5.57.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[bot] commented 1 month ago

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.