From fd0a4da9ca551b19f9d1941e24d1b3b055701c6d Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 8 May 2024 11:53:52 -0400 Subject: [PATCH 1/4] aws_fsx_ontap_storage_virtual_machine: Correctly set 'tags'. --- .changelog/#####.txt | 7 +++++++ .../service/fsx/ontap_storage_virtual_machine.go | 3 ++- .../fsx/ontap_storage_virtual_machine_data_source.go | 12 +++++++++++- ...ontap_storage_virtual_machine_data_source_test.go | 2 ++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .changelog/#####.txt diff --git a/.changelog/#####.txt b/.changelog/#####.txt new file mode 100644 index 000000000000..39cf919cc63b --- /dev/null +++ b/.changelog/#####.txt @@ -0,0 +1,7 @@ +```release-note:bug +resource/aws_fsx_ontap_storage_virtual_machine: Correctly set `tags` and `tags_all` on resource Read +``` + +```release-note:bug +data-source/aws_fsx_ontap_storage_virtual_machine: Correctly set `tags` on Read +``` \ No newline at end of file diff --git a/internal/service/fsx/ontap_storage_virtual_machine.go b/internal/service/fsx/ontap_storage_virtual_machine.go index 9f708f72b9bf..e22ac9e539b2 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine.go +++ b/internal/service/fsx/ontap_storage_virtual_machine.go @@ -306,7 +306,8 @@ func resourceONTAPStorageVirtualMachineRead(ctx context.Context, d *schema.Resou d.Set("svm_admin_password", d.Get("svm_admin_password").(string)) d.Set("uuid", storageVirtualMachine.UUID) - setTagsOut(ctx, storageVirtualMachine.Tags) + // SVM tags aren't set in the Describe response. + // setTagsOut(ctx, storageVirtualMachine.Tags) return diags } diff --git a/internal/service/fsx/ontap_storage_virtual_machine_data_source.go b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go index 4af66e0fdb11..292309bda000 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_data_source.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go @@ -196,6 +196,8 @@ func dataSourceONTAPStorageVirtualMachine() *schema.Resource { func dataSourceONTAPStorageVirtualMachineRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics conn := meta.(*conns.AWSClient).FSxConn(ctx) + defaultTagsConfig := meta.(*conns.AWSClient).DefaultTagsConfig + ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig input := &fsx.DescribeStorageVirtualMachinesInput{} @@ -235,7 +237,15 @@ func dataSourceONTAPStorageVirtualMachineRead(ctx context.Context, d *schema.Res d.Set("subtype", svm.Subtype) d.Set("uuid", svm.UUID) - setTagsOut(ctx, svm.Tags) + // SVM tags aren't set in the Describe response. + // setTagsOut(ctx, svm.Tags) + + tags := KeyValueTags(ctx, svm.Tags).IgnoreAWS().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + return sdkdiag.AppendErrorf(diags, "setting tags: %s", err) + } return diags } diff --git a/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go b/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go index 71a4d84096fb..f7be92bcd255 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go @@ -38,6 +38,7 @@ func TestAccFSxONTAPStorageVirtualMachineDataSource_Id(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName, "subtype", resourceName, "subtype"), + resource.TestCheckResourceAttrPair(dataSourceName, "tags.%", resourceName, "tags.%"), resource.TestCheckResourceAttrPair(dataSourceName, "uuid", resourceName, "uuid"), ), }, @@ -71,6 +72,7 @@ func TestAccFSxONTAPStorageVirtualMachineDataSource_Filter(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName, "subtype", resourceName, "subtype"), + resource.TestCheckResourceAttrPair(dataSourceName, "tags.%", resourceName, "tags.%"), resource.TestCheckResourceAttrPair(dataSourceName, "uuid", resourceName, "uuid"), ), }, From b64a096eb71898619d9ea55c453632d93f240007 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 8 May 2024 13:04:21 -0400 Subject: [PATCH 2/4] aws_fsx_openzfs_file_system: Correctly set 'tags'. --- .changelog/#####.txt | 4 ++++ internal/service/fsx/openzfs_file_system.go | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.changelog/#####.txt b/.changelog/#####.txt index 39cf919cc63b..6313582895f1 100644 --- a/.changelog/#####.txt +++ b/.changelog/#####.txt @@ -4,4 +4,8 @@ resource/aws_fsx_ontap_storage_virtual_machine: Correctly set `tags` and `tags_a ```release-note:bug data-source/aws_fsx_ontap_storage_virtual_machine: Correctly set `tags` on Read +``` + +```release-note:bug +resource/aws_fsx_openzfs_file_system: Correctly set `tags` and `tags_all` on resource Read ``` \ No newline at end of file diff --git a/internal/service/fsx/openzfs_file_system.go b/internal/service/fsx/openzfs_file_system.go index 8e1426b9cbbf..64ef2d9b44a8 100644 --- a/internal/service/fsx/openzfs_file_system.go +++ b/internal/service/fsx/openzfs_file_system.go @@ -514,7 +514,8 @@ func resourceOpenZFSFileSystemRead(ctx context.Context, d *schema.ResourceData, d.Set(names.AttrVPCID, filesystem.VpcId) d.Set("weekly_maintenance_start_time", openZFSConfig.WeeklyMaintenanceStartTime) - setTagsOut(ctx, filesystem.Tags) + // FS tags aren't set in the Describe response. + // setTagsOut(ctx, filesystem.Tags) rootVolume, err := findOpenZFSVolumeByID(ctx, conn, rootVolumeID) From b68f3ab55f398a8be1917a4ed0e907e29dc8f5ca Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 8 May 2024 13:31:41 -0400 Subject: [PATCH 3/4] Correct CHANGELOG entry file name. --- .changelog/{#####.txt => 37353.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .changelog/{#####.txt => 37353.txt} (100%) diff --git a/.changelog/#####.txt b/.changelog/37353.txt similarity index 100% rename from .changelog/#####.txt rename to .changelog/37353.txt From 022f36430dcb33ac11b6948d3ee4b334ab81520c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 8 May 2024 13:51:19 -0400 Subject: [PATCH 4/4] Update internal/service/fsx/ontap_storage_virtual_machine_data_source.go --- .../service/fsx/ontap_storage_virtual_machine_data_source.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/fsx/ontap_storage_virtual_machine_data_source.go b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go index 292309bda000..caf5fd25a790 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_data_source.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go @@ -243,7 +243,7 @@ func dataSourceONTAPStorageVirtualMachineRead(ctx context.Context, d *schema.Res tags := KeyValueTags(ctx, svm.Tags).IgnoreAWS().IgnoreConfig(ignoreTagsConfig) //lintignore:AWSR002 - if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { + if err := d.Set(names.AttrTags, tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return sdkdiag.AppendErrorf(diags, "setting tags: %s", err) }