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

FSx: Fix tags regressions #37353

Merged
merged 4 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading