Skip to content

Commit e786652

Browse files
authored
Merge pull request #650 from NetApp/508-new-resource-s3_user
New data source and resource - s3_user
2 parents aa8caeb + 7f6f7fe commit e786652

23 files changed

Lines changed: 1745 additions & 0 deletions

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# 2.6.0 (2026-xx-xx)
22

3+
FEATURES:
4+
5+
- **New Data Source:** `netapp-ontap_s3_user` and `netapp-ontap_s3_users`([#507](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/507))
6+
- **New Resource:** `netapp-ontap_s3_user` ([#508](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/508))
7+
38
BUG FIXES:
49

510
- **netapp-ontap_snapmirror_policy resource**: fixed issue with create when `retention` is not set in config ([#647](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/647))

docs/data-sources/s3_user.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "netapp-ontap_s3_user Data Source - terraform-provider-netapp-ontap"
4+
subcategory: "Object-store"
5+
description: |-
6+
S3 User data source
7+
---
8+
9+
# Data Source S3 User
10+
11+
Retrieves the specified S3 user in the SVM
12+
13+
## Related ONTAP commands
14+
15+
```commandline
16+
* vserver object-store-server user show
17+
```
18+
19+
## Supported Platforms
20+
21+
* On-prem ONTAP system 9.7 or higher
22+
* Amazon FSx for NetApp ONTAP
23+
24+
## Example Usage
25+
26+
```terraform
27+
data "netapp-ontap_s3_user" "s3_user" {
28+
# required to know which system to interface with
29+
cx_profile_name = "hw-cluster"
30+
name = "test_s3_user"
31+
svm_name = "svm1"
32+
}
33+
```
34+
35+
<!-- schema generated by tfplugindocs -->
36+
## Schema
37+
38+
### Required
39+
40+
- `cx_profile_name` (String) Connection profile name
41+
- `name` (String) The name of the S3 user.
42+
- `svm_name` (String) The name of the SVM.
43+
44+
### Read-Only
45+
46+
- `access_key` (String) Access key for the S3 user.
47+
- `comment` (String) Additional information about the user.
48+
- `id` (Number) The UUID of the S3 user.
49+
- `key_expiry_time` (String) The date and time after which keys expire and are no longer valid.
50+
- `key_time_to_live` (String) The time period in ISO 8601 format for which the keys are valid.

docs/data-sources/s3_users.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "netapp-ontap_s3_users Data Source - terraform-provider-netapp-ontap"
4+
subcategory: "Object-store"
5+
description: |-
6+
S3 Users data source
7+
---
8+
9+
# Data Source S3 Users
10+
11+
Retrieves all S3 users of the specified SVM
12+
13+
## Related ONTAP commands
14+
15+
```commandline
16+
* vserver object-store-server user show
17+
```
18+
19+
## Example Usage
20+
21+
```terraform
22+
# retrieving all S3 groups for a SVM
23+
data "netapp-ontap_s3_users" "example1" {
24+
# required to know which system to interface with
25+
cx_profile_name = "hw-cluster"
26+
filter = {
27+
svm_name = "svm1"
28+
}
29+
}
30+
31+
# retrieving S3 groups for a SVM matching the name filter
32+
data "netapp-ontap_s3_users" "example2" {
33+
# required to know which system to interface with
34+
cx_profile_name = "hw-cluster"
35+
filter = {
36+
svm_name = "svm1"
37+
name = "csahu_test*"
38+
}
39+
}
40+
```
41+
42+
<!-- schema generated by tfplugindocs -->
43+
## Schema
44+
45+
### Required
46+
47+
- `cx_profile_name` (String) Connection profile name
48+
- `filter` (Attributes) (see [below for nested schema](#nestedatt--filter))
49+
50+
### Read-Only
51+
52+
- `protocols_s3_users` (Attributes List) List of S3 users (see [below for nested schema](#nestedatt--protocols_s3_users))
53+
54+
<a id="nestedatt--filter"></a>
55+
56+
### Nested Schema for `filter`
57+
58+
Optional:
59+
60+
- `name` (String) The name of the S3 user
61+
- `svm_name` (String) The name of the SVM
62+
63+
64+
<a id="nestedatt--protocols_s3_users"></a>
65+
66+
### Nested Schema for `protocols_s3_users`
67+
68+
Required:
69+
70+
- `cx_profile_name` (String) Connection profile name
71+
- `name` (String) The name of the S3 user.
72+
- `svm_name` (String) The name of the SVM.
73+
74+
Read-Only:
75+
76+
- `access_key` (String) Access key for the S3 user.
77+
- `comment` (String) Additional information about the user.
78+
- `id` (Number) The UUID of the S3 user.
79+
- `key_expiry_time` (String) The date and time after which keys expire and are no longer valid.
80+
- `key_time_to_live` (String) The time period in ISO 8601 format for which the keys are valid.

docs/resources/s3_user.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "netapp-ontap_s3_user Resource - terraform-provider-netapp-ontap"
4+
subcategory: "Object-store"
5+
description: |-
6+
S3 User resource
7+
---
8+
9+
# Resource S3 User
10+
11+
Create, delete, or modify S3 user
12+
13+
## Related ONTAP commands
14+
15+
```commandline
16+
* vserver object-store-server user create
17+
* vserver object-store-server user regenerate-keys
18+
* vserver object-store-server user delete-keys
19+
* vserver object-store-server user delete
20+
```
21+
22+
## Supported Platforms
23+
24+
* On-prem ONTAP system 9.7 or higher
25+
* Amazon FSx for NetApp ONTAP
26+
27+
## Example Usage
28+
29+
```terraform
30+
# creating a S3 user configuration with user keys specified
31+
resource "netapp-ontap_s3_user" "example1" {
32+
cx_profile_name = "hw-cluster"
33+
name = "test_s3_user"
34+
svm_name = "svm1"
35+
comment = "test user"
36+
access_key = "<AWS-ACCESS-KEY-ID>"
37+
secret_key = "<AWS-SECRET-ACCESS-KEY>"
38+
}
39+
40+
# regenerating keys and setting new expiry configuration for a specific S3 user
41+
resource "netapp-ontap_s3_user" "example2" {
42+
cx_profile_name = "hw-cluster"
43+
name = "test_s3_user"
44+
svm_name = "svm1"
45+
comment = "test s3 user"
46+
regenerate_keys = true
47+
key_time_to_live = "PT2M"
48+
}
49+
50+
# deleting keys for a specific S3 user
51+
resource "netapp-ontap_s3_user" "example3" {
52+
cx_profile_name = "hw-cluster"
53+
name = "test_s3_user"
54+
svm_name = "svm1"
55+
comment = "test s3 user"
56+
delete_keys = true
57+
}
58+
```
59+
60+
<!-- schema generated by tfplugindocs -->
61+
## Schema
62+
63+
### Required
64+
65+
- `cx_profile_name` (String) Connection profile name
66+
- `name` (String) Specifies the name of the user.
67+
- `svm_name` (String) The name of the SVM.
68+
69+
### Optional
70+
71+
> **NOTE**: [Write-only arguments](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments) are supported in Terraform 1.11 and later.
72+
73+
- `access_key` (String, Sensitive) Specifies the access key for the user.
74+
- `comment` (String) Additional information about the user.
75+
- `delete_keys` (Boolean, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) Specifies if secret_key and access_key need to be deleted.
76+
- `key_time_to_live` (String) Indicates the time period from when this parameter is specified:
77+
when creating or modifying a user or when the user keys were last regenerated, after which the user keys expire and are no longer valid.
78+
Valid format is: 'PnDTnHnMnS|PnW'. For example, P2DT6H3M10S specifies a time period of 2 days, 6 hours, 3 minutes, and 10 seconds.
79+
If the value specified is '0' seconds, then the keys won't expire.
80+
It can be used during user creation (POST) and during keys regeneration (PATCH with regenerate_keys).
81+
- `regenerate_keys` (Boolean, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) Specifies if secret_key and access_key need to be regenerated.
82+
**Note:** This resource is not idempotent when this option is set.
83+
- `secret_key` (String, Sensitive) Specifies the secret key for the user.
84+
85+
### Read-Only
86+
87+
- `id` (Number) The UUID of the S3 user.
88+
- `key_expiry_time` (String) The date and time after which keys expire and are no longer valid.
89+
90+
## Import
91+
92+
This resource supports import, which allows you to import existing S3 user into the state of this resource.
93+
Import require a unique ID composed of the S3 user name, svm name and connection profile, separated by a comma.
94+
95+
id = `name`,`svm_name`,`cx_profile_name`
96+
97+
### Terraform Import
98+
99+
For example
100+
101+
```shell
102+
terraform import netapp-ontap_s3_user.example test_s3_user,svm1,cluster5
103+
```
104+
105+
!> The terraform import CLI command can only import resources into the state. Importing via the CLI does not generate configuration. If you want to generate the accompanying configuration for imported resources, use the import block instead.
106+
107+
### Terraform Import Block
108+
109+
This requires Terraform 1.5 or higher, and will auto create the configuration for you
110+
111+
First create the block
112+
113+
```terraform
114+
import {
115+
to = netapp-ontap_s3_user.s3_user_import
116+
id = "test_s3_user,svm1,cluster5"
117+
}
118+
```
119+
120+
Next run, this will auto create the configuration for you
121+
122+
```shell
123+
terraform plan -generate-config-out=generated.tf
124+
```
125+
126+
This will generate a file called generated.tf, which will contain the configuration for the imported resource
127+
128+
```terraform
129+
# __generated__ by Terraform
130+
# Please review these resources and move them into your main configuration files.
131+
# __generated__ by Terraform from "test_s3_user_,svm1,cluster5"
132+
resource "netapp-ontap_s3_user" "s3_user_import" {
133+
cx_profile_name = "cluster5"
134+
name = "test_s3_user"
135+
svm_name = "svm1"
136+
}
137+
```
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
data "netapp-ontap_s3_user" "s3_user" {
2+
# required to know which system to interface with
3+
cx_profile_name = "hw-cluster"
4+
name = "test_s3_user"
5+
svm_name = "svm1"
6+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../provider/provider.tf
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../provider/terraform.tfvars
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../provider/variables.tf
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# retrieving all S3 groups for a SVM
2+
data "netapp-ontap_s3_users" "example1" {
3+
# required to know which system to interface with
4+
cx_profile_name = "hw-cluster"
5+
filter = {
6+
svm_name = "svm1"
7+
}
8+
}
9+
10+
# retrieving S3 groups for a SVM matching the name filter
11+
data "netapp-ontap_s3_users" "example2" {
12+
# required to know which system to interface with
13+
cx_profile_name = "hw-cluster"
14+
filter = {
15+
svm_name = "svm1"
16+
name = "csahu_test*"
17+
}
18+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../provider/provider.tf

0 commit comments

Comments
 (0)