diff --git a/go.sum b/go.sum index a8ed807e6a..095f7e5747 100644 --- a/go.sum +++ b/go.sum @@ -698,6 +698,8 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121 h1:rITEj+UZHYC927n8GT97eC3zrpzXdb/voyeOuVKS46o= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= diff --git a/tencentcloud/data_source_tc_cfs_file_systems.go b/tencentcloud/data_source_tc_cfs_file_systems.go index cc64b6a893..851f020488 100644 --- a/tencentcloud/data_source_tc_cfs_file_systems.go +++ b/tencentcloud/data_source_tc_cfs_file_systems.go @@ -115,6 +115,11 @@ func dataSourceTencentCloudCfsFileSystems() *schema.Resource { Computed: true, Description: "Size used of the file system.", }, + "mount_ip": { + Type: schema.TypeString, + Computed: true, + Description: "IP of the file system.", + }, }, }, }, @@ -185,6 +190,17 @@ func dataSourceTencentCloudCfsFileSystemsRead(d *schema.ResourceData, meta inter "size_limit": fileSystem.SizeLimit, "size_used": fileSystem.SizeByte, } + targets, err := cfsService.DescribeMountTargets(ctx, *fileSystem.FileSystemId) + if err != nil { + return err + } + var mountTarget *cfs.MountInfo + if len(targets) > 0 { + mountTarget = targets[0] + } + if mountTarget != nil { + mapping["mount_ip"] = mountTarget.IpAddress + } fileSystemList = append(fileSystemList, mapping) ids = append(ids, *fileSystem.FileSystemId) } diff --git a/tencentcloud/data_source_tc_cfs_file_systems_test.go b/tencentcloud/data_source_tc_cfs_file_systems_test.go index b2a5c0985f..bd16b5ad02 100644 --- a/tencentcloud/data_source_tc_cfs_file_systems_test.go +++ b/tencentcloud/data_source_tc_cfs_file_systems_test.go @@ -25,6 +25,7 @@ func TestAccTencentCloudCfsFileSystemsDataSource(t *testing.T) { resource.TestCheckResourceAttrSet("data.tencentcloud_cfs_file_systems.file_systems", "file_system_list.0.access_group_id"), resource.TestCheckResourceAttrSet("data.tencentcloud_cfs_file_systems.file_systems", "file_system_list.0.status"), resource.TestCheckResourceAttrSet("data.tencentcloud_cfs_file_systems.file_systems", "file_system_list.0.create_time"), + resource.TestCheckResourceAttrSet("data.tencentcloud_cfs_file_systems.file_systems", "file_system_list.0.mount_ip"), ), }, }, diff --git a/website/docs/d/cfs_file_systems.html.markdown b/website/docs/d/cfs_file_systems.html.markdown index f903434603..789dc5f271 100644 --- a/website/docs/d/cfs_file_systems.html.markdown +++ b/website/docs/d/cfs_file_systems.html.markdown @@ -41,6 +41,7 @@ In addition to all arguments above, the following attributes are exported: * `availability_zone` - The available zone that the file system locates at. * `create_time` - Creation time of the file system. * `file_system_id` - ID of the file system. + * `mount_ip` - IP of the file system. * `name` - Name of the file system. * `protocol` - Protocol of the file system. * `size_limit` - Size limit of the file system.