Skip to content

Commit

Permalink
Merge pull request #37353 from hashicorp/b-fsx-tags-regression
Browse files Browse the repository at this point in the history
FSx: Fix `tags` regressions
  • Loading branch information
ewbankkit authored May 8, 2024
2 parents f34be8e + 022f364 commit b29f63e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
11 changes: 11 additions & 0 deletions .changelog/37353.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```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
```

```release-note:bug
resource/aws_fsx_openzfs_file_system: Correctly set `tags` and `tags_all` on resource Read
```
3 changes: 2 additions & 1 deletion internal/service/fsx/ontap_storage_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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{}

Expand Down Expand Up @@ -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(names.AttrTags, tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil {
return sdkdiag.AppendErrorf(diags, "setting tags: %s", err)
}

return diags
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
),
},
Expand Down Expand Up @@ -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"),
),
},
Expand Down
3 changes: 2 additions & 1 deletion internal/service/fsx/openzfs_file_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit b29f63e

Please sign in to comment.