Skip to content

Commit

Permalink
resource/aws_datasync_task: Remove BEST_EFFORT value from posix_permi…
Browse files Browse the repository at this point in the history
…ssions argument validation and documentation

Reference: https://github.com/aws/aws-sdk-go/pull/2962/files#diff-75343d273fb0174cc5d3bc82469018b5L6419
Reference: #10955

The upstream AWS Go SDK in v1.25.39 update removes the available SDK constant. In testing the behavior against the current SDK which still has this constant and when `BEST_EFFORT` is provided as a value to the DataSync API, the API returns a validation error:

```
--- FAIL: TestAccAWSDataSyncTask_DefaultSyncOptions_PosixPermissions (233.01s)
    testing.go:635: Step 0 error: errors during apply:

        Error: error creating DataSync Task: ValidationException: 1 validation error detected: Value 'BEST_EFFORT' at 'options.posixPermissions' failed to satisfy constraint: Member must satisfy enum value set: [PRESERVE, NONE]
        	status code: 400, request id: 1b101b77-f03f-4be2-b018-e2edf4088536
```

This API behavior seems to indicate that even if existing Terraform configurations might contain this value, they are invalid now according to the API and must be updated regardless. If for some reason this old value is still valid for previously existing tasks, we can hardcode the `"BEST_EFFORT"` string into the validation if necessary.
  • Loading branch information
bflad committed Nov 23, 2019
1 parent 101295f commit 00619b6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion aws/resource_aws_datasync_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ func resourceAwsDataSyncTask() *schema.Resource {
Optional: true,
Default: datasync.PosixPermissionsPreserve,
ValidateFunc: validation.StringInSlice([]string{
datasync.PosixPermissionsBestEffort,
datasync.PosixPermissionsNone,
datasync.PosixPermissionsPreserve,
}, false),
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/datasync_task.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The following arguments are supported inside the `options` configuration block:
* `bytes_per_second` - (Optional) Limits the bandwidth utilized. For example, to set a maximum of 1 MB, set this value to `1048576`. Value values: `-1` or greater. Default: `-1` (unlimited).
* `gid` - (Optional) Group identifier of the file's owners. Valid values: `BOTH`, `INT_VALUE`, `NAME`, `NONE`. Default: `INT_VALUE` (preserve integer value of the ID).
* `mtime` - (Optional) A file metadata that indicates the last time a file was modified (written to) before the sync `PREPARING` phase. Value values: `NONE`, `PRESERVE`. Default: `PRESERVE`.
* `posix_permissions` - (Optional) Determines which users or groups can access a file for a specific purpose such as reading, writing, or execution of the file. Valid values: `BEST_EFFORT`, `NONE`, `PRESERVE`. Default: `PRESERVE`.
* `posix_permissions` - (Optional) Determines which users or groups can access a file for a specific purpose such as reading, writing, or execution of the file. Valid values: `NONE`, `PRESERVE`. Default: `PRESERVE`.
* `preserve_deleted_files` - (Optional) Whether files deleted in the source should be removed or preserved in the destination file system. Valid values: `PRESERVE`, `REMOVE`. Default: `PRESERVE`.
* `preserve_devices` - (Optional) Whether the DataSync Task should preserve the metadata of block and character devices in the source files system, and recreate the files with that device name and metadata on the destination. The DataSync Task can’t sync the actual contents of such devices, because many of the devices are non-terminal and don’t return an end of file (EOF) marker. Valid values: `NONE`, `PRESERVE`. Default: `NONE` (ignore special devices).
* `uid` - (Optional) User identifier of the file's owners. Valid values: `BOTH`, `INT_VALUE`, `NAME`, `NONE`. Default: `INT_VALUE` (preserve integer value of the ID).
Expand Down

0 comments on commit 00619b6

Please sign in to comment.