-
Notifications
You must be signed in to change notification settings - Fork 8
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
138 new resource security certificate #311
Open
csahu9
wants to merge
19
commits into
integration/main
Choose a base branch
from
138-new-resource-security_certificates
base: integration/main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
2241452
new resource security certificate
csahu9 d96d857
acc test for security_certificate resource
csahu9 55d6f98
added examples
csahu9 7768147
updated unmarshalResponse
csahu9 e6632ff
added connection profile
csahu9 4dda71c
updated examples
csahu9 1c4d7b0
fix go lint issues
csahu9 8078ee0
update acc tests
csahu9 b168ca8
update examples
csahu9 173f827
new resource security_certificate
csahu9 9a30df6
added error reporting
csahu9 1388db5
update acc tests
csahu9 6165e9f
update doc
csahu9 29761e2
update examples
csahu9 6bedac3
update resource schema
csahu9 c5f4b68
update examples
csahu9 2bc9b2b
update docs
csahu9 e69b88d
sync with integration/main
csahu9 7b7e77d
resolve conflicts
csahu9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "netapp-ontap_security_certificate Resource - terraform-provider-netapp-ontap" | ||
subcategory: "" | ||
description: |- | ||
SecurityCertificate resource | ||
--- | ||
|
||
# netapp-ontap_security_certificate (Resource) | ||
|
||
Create/ install/ sign a certificate | ||
|
||
### Related ONTAP commands | ||
```commandline | ||
* security certificate show | ||
* security certificate create | ||
* security certificate install | ||
* security certificate sign | ||
``` | ||
|
||
## Supported Platforms | ||
* On-prem ONTAP system 9.6 or higher | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
# creating a certificate | ||
resource "netapp-ontap_security_certificate" "create_certificate" { | ||
cx_profile_name = "cluster5" | ||
name = "tfsvm_ca_cert1" | ||
common_name = "tfsvm_ca_cert" | ||
type = "root_ca" | ||
svm_name = "tfsvm" | ||
expiry_time = "P365DT" | ||
} | ||
|
||
# signing a certificate | ||
resource "netapp-ontap_security_certificate" "sign_certificate" { | ||
cx_profile_name = "cluster5" | ||
name = "tfsvm_ca_cert1" | ||
common_name = "tfsvm_ca_cert" | ||
type = "root_ca" | ||
svm_name = "svm1" # SVM on which the signed certificate will exist | ||
expiry_time = "P90DT" | ||
signing_request = <<-EOT | ||
-----BEGIN CERTIFICATE REQUEST----- | ||
signing-request | ||
-----END CERTIFICATE REQUEST----- | ||
EOT | ||
} | ||
|
||
# installing a certificate | ||
resource "netapp-ontap_security_certificate" "install_certificate" { | ||
cx_profile_name = "cluster5" | ||
common_name = "svm1_cert1" | ||
type = "server" | ||
svm_name = "svm1" | ||
expiry_time = "P90DT" | ||
public_certificate = <<-EOT | ||
-----BEGIN CERTIFICATE----- | ||
certificate | ||
-----END CERTIFICATE----- | ||
EOT | ||
|
||
private_key = <<-EOT | ||
-----BEGIN PRIVATE KEY----- | ||
private-key | ||
-----END PRIVATE KEY----- | ||
EOT | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `cx_profile_name` (String) Connection profile name. | ||
- `common_name` (String) Common name of the certificate. | ||
- `type` (String) Type of certificate. | ||
|
||
### Optional | ||
|
||
- `expiry_time` (String) Certificate expiration time, in ISO 8601 duration format or date and time format. | ||
- `hash_function` (String) Hashing function. | ||
- `key_size` (Number) Key size of the certificate in bits. | ||
- `name` (String) The unique name of the security certificate per SVM. | ||
- `private_key` (String, Sensitive) Private key Certificate in PEM format. Only valid when installing a CA-signed certificate. | ||
- `public_certificate` (String) Public key Certificate in PEM format. If this is not provided during create action, a self-signed certificate is created. | ||
- `signing_request` (String) Certificate signing request to be signed by the given certificate authority. Request should be in X509 PEM format. | ||
- `svm_name` (String) Name of the SVM in which the certificate is created or installed or the SVM on which the signed certificate will exist. | ||
|
||
### Read-Only | ||
|
||
- `ca` (String) Certificate authority. | ||
- `id` (String) UUID of the certificate. | ||
- `scope` (String) Set to 'svm' for certificates installed in a SVM. Otherwise, set to 'cluster'. | ||
- `serial_number` (String) Serial number of the certificate. | ||
- `signed_certificate` (String) Signed public key Certificate in PEM format that is returned while signing a certificate. | ||
|
||
## Import | ||
This resource supports import, which allows you to import existing security certificate into the state of this resource. | ||
Import require a unique ID composed of the security certificate name and connection profile, separated by a comma. | ||
|
||
id = `name`, `cx_profile_name` | ||
|
||
### Terraform Import | ||
|
||
For example | ||
```shell | ||
terraform import netapp-ontap_security_certificate.cert_import tfsvm_ca_cert1,cluster5 | ||
``` | ||
|
||
### Terraform Import Block | ||
This requires Terraform 1.5 or higher, and will auto create the configuration for you | ||
|
||
First create the block | ||
```terraform | ||
import { | ||
to = netapp-ontap_security_certificate.cert_import | ||
id = "tfsvm_ca_cert1,cluster5" | ||
} | ||
``` | ||
Next run, this will auto create the configuration for you | ||
```shell | ||
terraform plan -generate-config-out=generated.tf | ||
``` | ||
This will generate a file called generated.tf, which will contain the configuration for the imported resource | ||
```terraform | ||
# __generated__ by Terraform | ||
# Please review these resources and move them into your main configuration files. | ||
|
||
# __generated__ by Terraform from "tfsvm_ca_cert1,cluster5" | ||
resource "netapp-ontap_security_certificate" "cert_import" { | ||
common_name = "tfsvm_ca_cert" | ||
cx_profile_name = "cluster5" | ||
expiry_time = "2025-10-04T01:24:54-04:00" | ||
hash_function = "sha256" | ||
key_size = 2048 | ||
name = "tfsvm_ca_cert1" | ||
private_key = null # sensitive | ||
public_certificate = "-----BEGIN CERTIFICATE-----\ncertificate\n-----END CERTIFICATE-----\n" | ||
signing_request = null | ||
svm_name = "tfsvm" | ||
type = "root_ca" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
examples/resources/netapp-ontap_security_certificate/provider.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../provider/provider.tf |
44 changes: 44 additions & 0 deletions
44
examples/resources/netapp-ontap_security_certificate/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# creating a certificate | ||
resource "netapp-ontap_security_certificate" "create_certificate" { | ||
cx_profile_name = "cluster5" | ||
name = "tfsvm_ca_cert1" | ||
common_name = "tfsvm_ca_cert" | ||
type = "root_ca" | ||
svm_name = "tfsvm" | ||
expiry_time = "P365DT" | ||
} | ||
|
||
# signing a certificate | ||
resource "netapp-ontap_security_certificate" "sign_certificate" { | ||
cx_profile_name = "cluster5" | ||
name = "tfsvm_ca_cert1" | ||
common_name = "tfsvm_ca_cert" | ||
type = "root_ca" | ||
svm_name = "svm1" # SVM on which the signed certificate will exist | ||
expiry_time = "P90DT" | ||
signing_request = <<-EOT | ||
-----BEGIN CERTIFICATE REQUEST----- | ||
signing-request | ||
-----END CERTIFICATE REQUEST----- | ||
EOT | ||
} | ||
|
||
# installing a certificate | ||
resource "netapp-ontap_security_certificate" "install_certificate" { | ||
cx_profile_name = "cluster5" | ||
common_name = "svm1_cert1" | ||
type = "server" | ||
svm_name = "svm1" | ||
expiry_time = "P90DT" | ||
public_certificate = <<-EOT | ||
-----BEGIN CERTIFICATE----- | ||
certificate | ||
-----END CERTIFICATE----- | ||
EOT | ||
|
||
private_key = <<-EOT | ||
-----BEGIN PRIVATE KEY----- | ||
private-key | ||
-----END PRIVATE KEY----- | ||
EOT | ||
} |
1 change: 1 addition & 0 deletions
1
examples/resources/netapp-ontap_security_certificate/terraform.tfvars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../provider/terraform.tfvars |
1 change: 1 addition & 0 deletions
1
examples/resources/netapp-ontap_security_certificate/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../provider/variables.tf |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want to make sure if you check the fsx is supported or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, @chuyich , I haven't tested for fsx support.
Could you please let me know the steps that are required to test the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the slack message.