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

r/aws_fsx_ontap_volume support snapshot_policy argument #32530

Merged
merged 30 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1d239d5
add snapshot_policy to aws_fsx_ontap_volume
coreylane-orion Jul 15, 2023
6496e6d
Merge branch 'hashicorp:main' into f-aws_fsx_ontap_volume-add-snapsho…
coreylane Jul 15, 2023
1b31de8
update snapshot test and attribute
coreylane-orion Jul 17, 2023
d5fa3fd
fsx documentation
coreylane-orion Jul 17, 2023
448f72b
adds pr 32530 to changelog
coreylane-orion Jul 17, 2023
91f885c
adds TestAccFSxOntapVolume_snapshotPolicy
coreylane-orion Jul 17, 2023
3e3b420
alpha testAccONTAPVolumeConfig_size
coreylane-orion Jul 17, 2023
65e95f3
Merge branch 'main' into HEAD
ewbankkit Sep 22, 2023
06ee53d
fsx: Move functions around.
ewbankkit Sep 22, 2023
0930fbe
r/aws_fsx_ontap_volume: Tidy up resource Read.
ewbankkit Sep 22, 2023
ca74a29
r/aws_fsx_ontap_volume: Tidy up resource Update and Delete.
ewbankkit Sep 22, 2023
95ad7a7
fsx: 'AdministrativeAction' -> 'FileSystemAdministrativeAction'.
ewbankkit Sep 22, 2023
140d06f
fsx: Add 'waitVolumeAdministrativeActionCompleted' and friends.
ewbankkit Sep 22, 2023
767ba0c
r/aws_fsx_ontap_volume: Correct function names.
ewbankkit Sep 22, 2023
cb8c708
r/aws_fsx_ontap_volume: Add 'copy_tags_to_backups' argument.
ewbankkit Sep 22, 2023
fd8075f
r/aws_fsx_ontap_volume: Make 'snapshot_policy' Computed, preventing e…
ewbankkit Sep 23, 2023
b93f168
Acceptance test output:
ewbankkit Sep 23, 2023
57d5892
r/aws_fsx_openzfs_volume: Correct function names.
ewbankkit Sep 23, 2023
de65886
Add 'TestAccFSxOpenZFSVolume_disappears'.
ewbankkit Sep 23, 2023
4bec1b6
fsx: Consolidate OpenZFS flatteners and expanders.
ewbankkit Sep 23, 2023
a923621
Acceptance test output:
ewbankkit Sep 23, 2023
f8a0aa5
r/aws_fsx_ontap_volume: Add 'snaplock_configuration' argument.
ewbankkit Sep 24, 2023
d1d34a1
fsx: Cosmetics.
ewbankkit Sep 24, 2023
a4b8d57
Add 'TestAccFSxONTAPVolume_snaplock'.
ewbankkit Sep 24, 2023
6dbbc63
fsx: Fix sweeper compilation errors.
ewbankkit Sep 24, 2023
3c3cb18
r/aws_fsx_ontap_volume: 'snaplock_configuration.autocommit_period' an…
ewbankkit Sep 25, 2023
4f687c3
Fix markdown-lint 'MD009/no-trailing-spaces Trailing spaces [Expected…
ewbankkit Sep 25, 2023
efbdb7a
r/aws_fsx_openzfs_volume: Add 'delete_volume_options' argument.
ewbankkit Sep 25, 2023
ad58585
Acceptance test output:
ewbankkit Sep 25, 2023
0ed7cef
r/aws_fsx_ontap_volume: Add 'bypass_snaplock_enterprise_retention' ar…
ewbankkit Sep 25, 2023
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
3 changes: 3 additions & 0 deletions .changelog/32530.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_fsx_ontap_volume: Add `snapshot_policy` argument
```
15 changes: 15 additions & 0 deletions internal/service/fsx/ontap_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ func ResourceOntapVolume() *schema.Resource {
Optional: true,
Default: false,
},
"snapshot_policy": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ewbankkit marked this conversation as resolved.
Show resolved Hide resolved
ValidateFunc: validation.StringLenBetween(1, 255),
},
"storage_efficiency_enabled": {
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -169,6 +175,10 @@ func resourceOntapVolumeCreate(ctx context.Context, d *schema.ResourceData, meta
input.OntapConfiguration.SecurityStyle = aws.String(v.(string))
}

if v, ok := d.GetOk("snapshot_policy"); ok {
input.OntapConfiguration.SnapshotPolicy = aws.String(v.(string))
}

if v, ok := d.GetOkExists("storage_efficiency_enabled"); ok {
input.OntapConfiguration.StorageEfficiencyEnabled = aws.Bool(v.(bool))
}
Expand Down Expand Up @@ -220,6 +230,7 @@ func resourceOntapVolumeRead(ctx context.Context, d *schema.ResourceData, meta i
d.Set("ontap_volume_type", ontapConfig.OntapVolumeType)
d.Set("security_style", ontapConfig.SecurityStyle)
d.Set("size_in_megabytes", ontapConfig.SizeInMegabytes)
d.Set("snapshot_policy", ontapConfig.SnapshotPolicy)
d.Set("storage_efficiency_enabled", ontapConfig.StorageEfficiencyEnabled)
d.Set("storage_virtual_machine_id", ontapConfig.StorageVirtualMachineId)
if err := d.Set("tiering_policy", flattenOntapVolumeTieringPolicy(ontapConfig.TieringPolicy)); err != nil {
Expand Down Expand Up @@ -254,6 +265,10 @@ func resourceOntapVolumeUpdate(ctx context.Context, d *schema.ResourceData, meta
input.OntapConfiguration.SizeInMegabytes = aws.Int64(int64(d.Get("size_in_megabytes").(int)))
}

if d.HasChange("snapshot_policy") {
input.OntapConfiguration.SnapshotPolicy = aws.String(d.Get("snapshot_policy").(string))
}

if d.HasChange("storage_efficiency_enabled") {
input.OntapConfiguration.StorageEfficiencyEnabled = aws.Bool(d.Get("storage_efficiency_enabled").(bool))
}
Expand Down
1 change: 1 addition & 0 deletions internal/service/fsx/ontap_volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func TestAccFSxOntapVolume_basic(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "security_style", ""),
resource.TestCheckResourceAttr(resourceName, "size_in_megabytes", "1024"),
resource.TestCheckResourceAttr(resourceName, "skip_final_backup", "false"),
resource.TestCheckResourceAttr(resourceName, "snapshot_policy", "default"),
ewbankkit marked this conversation as resolved.
Show resolved Hide resolved
resource.TestCheckResourceAttr(resourceName, "storage_efficiency_enabled", "true"),
resource.TestCheckResourceAttrSet(resourceName, "storage_virtual_machine_id"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "0"),
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/fsx_ontap_volume.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ The following arguments are supported:
* `security_style` - (Optional) Specifies the volume security style, Valid values are `UNIX`, `NTFS`, and `MIXED`.
* `size_in_megabytes` - (Required) Specifies the size of the volume, in megabytes (MB), that you are creating.
* `skip_final_backup` - (Optional) When enabled, will skip the default final backup taken when the volume is deleted. This configuration must be applied separately before attempting to delete the resource to have the desired behavior. Defaults to `false`.
* `snapshot_policy` - (Optional) Specifies the snapshot policy for the volume. See [snapshot policies](https://docs.aws.amazon.com/fsx/latest/ONTAPGuide/snapshots-ontap.html#snapshot-policies) in the Amazon FSx ONTAP User Guide
* `storage_efficiency_enabled` - (Optional) Set to true to enable deduplication, compression, and compaction storage efficiency features on the volume.
* `storage_virtual_machine_id` - (Required) Specifies the storage virtual machine in which to create the volume.
* `tags` - (Optional) A map of tags to assign to the volume. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level.
Expand Down