Skip to content

Commit aa21925

Browse files
authored
Merge pull request #1132 from ovh/dev/aamstutz/deprecate-ip-mitigation
fix(ip_mitigation): Deprecate attribute 'permanent'
2 parents 4ace382 + 68b55a6 commit aa21925

File tree

9 files changed

+12
-68
lines changed

9 files changed

+12
-68
lines changed

docs/data-sources/ip_mitigation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ data "ovh_ip_mitigation" "mitigation_data" {
2424

2525
* `ip` - The IP or the CIDR
2626
* `ip_on_mitigation` - IPv4 address
27-
* `permanent ` - Set on true if the IP is on permanent mitigation
27+
* `permanent ` - (Deprecated) Set on true if the IP is on permanent mitigation
2828
* `state` - Current state of the IP on mitigation
2929
* `auto` - Set on true if the IP is on auto-mitigation

docs/data-sources/okms_credential.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ data "ovh_okms_credential" "kms" {
2222

2323
## Attributes Reference
2424

25-
- `certificate_type` (String) Type of the certificate (ECDSA or RSA)
25+
- `certificate_type` (String) Type of certificate key (`ECDSA` or `RSA`).
2626
- `certificate_pem` (String) PEM encoded certificate of the credential
2727
- `created_at` (String) Creation time of the credential
2828
- `description` (String) Description of the credential

docs/resources/ip_mitigation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ resource "ovh_ip_mitigation" "mitigation" {
1919

2020
* `ip` - (Required) The IP or the CIDR
2121
* `ip_on_mitigation` - (Required) IPv4 address
22-
* `permanent ` - Set on true if the IP is on permanent mitigation
22+
* `permanent ` - Deprecated, has no effect
2323

2424
## Attributes Reference
2525

2626
* `ip` - The IP or the CIDR
2727
* `ip_on_mitigation` - IPv4 address
28-
* `permanent ` - Set on true if the IP is on permanent mitigation
28+
* `permanent ` - (Deprecated) Set on true if the IP is on permanent mitigation
2929
* `state` - Current state of the IP on mitigation
3030
* `auto` - Set on true if the IP is on auto-mitigation

docs/resources/okms_credential.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ resource "ovh_okms_credential" "cred_from_csr" {
4040
identity_urns = ["urn:v1:eu:identity:account:${data.ovh_me.current_account.nichandle}"]
4141
csr = file("cred.csr")
4242
description = "Credential from CSR"
43-
certificate_type = "ECDSA"
4443
}
4544
```
4645

@@ -57,11 +56,11 @@ resource "ovh_okms_credential" "cred_from_csr" {
5756
- `csr` (String) Certificate Signing Request. The CSR should be encoded in the PEM format. If this argument is not set, the server will generate a CSR for this credential, and the corresponding private key will be returned in the `private_key_pem` attribute.
5857
- `description` (String) Description of the credential (max 200 characters)
5958
- `validity` (Number) Validity in days (default: 365 days, max: 365 days)
60-
- `certificate_type` (String) Type of the certificate key algorithm. Allowed values: `ECDSA`, `RSA`. Default to `ECDSA`. Changing forces a new credential.
59+
- `certificate_type` (String) Type of certificate key. Allowed values: `ECDSA`, `RSA`. Default to `ECDSA`. Changing forces a new credential.
6160

6261
## Attributes Reference
6362

64-
- `certificate_type` (String) Type of the certificate key algorithm (`ECDSA` or `RSA`).
63+
- `certificate_type` (String) Type of certificate key (`ECDSA` or `RSA`).
6564
- `certificate_pem` (String) Certificate PEM of the credential.
6665
- `created_at` (String) Creation time of the credential
6766
- `expired_at` (String) Expiration time of the credential

ovh/data_ip_mitigation_gen.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ovh/resource_ip_mitigation.go

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -117,54 +117,7 @@ func (r *ipMitigationResource) Read(ctx context.Context, req resource.ReadReques
117117
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
118118
}
119119

120-
func (r *ipMitigationResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
121-
var data, planData, responseData IpMitigationModel
122-
123-
// Read Terraform plan data into the model
124-
resp.Diagnostics.Append(req.Plan.Get(ctx, &planData)...)
125-
if resp.Diagnostics.HasError() {
126-
return
127-
}
128-
129-
// Read Terraform prior state data into the model
130-
resp.Diagnostics.Append(req.State.Get(ctx, &data)...)
131-
if resp.Diagnostics.HasError() {
132-
return
133-
}
134-
135-
// Update resource
136-
endpoint := "/ip/" + url.PathEscape(data.Ip.ValueString()) + "/mitigation/" + url.PathEscape(data.IpOnMitigation.ValueString())
137-
if err := r.config.OVHClient.Put(endpoint, planData.ToUpdate(), nil); err != nil {
138-
resp.Diagnostics.AddError(
139-
fmt.Sprintf("Error calling Put %s", endpoint),
140-
err.Error(),
141-
)
142-
return
143-
}
144-
145-
// Read updated resource
146-
err := retry.RetryContext(ctx, 10*time.Minute, func() *retry.RetryError {
147-
readErr := r.config.OVHClient.Get(endpoint, &responseData)
148-
if readErr != nil {
149-
return retry.NonRetryableError(readErr)
150-
}
151-
152-
if responseData.State.ValueString() == "ok" {
153-
return nil
154-
}
155-
156-
return retry.RetryableError(errors.New("waiting for resource state to be ok"))
157-
})
158-
159-
if err != nil {
160-
resp.Diagnostics.AddError("error waiting status to be ok", err.Error())
161-
return
162-
}
163-
164-
responseData.MergeWith(&planData)
165-
166-
// Save updated data into Terraform state
167-
resp.Diagnostics.Append(resp.State.Set(ctx, &responseData)...)
120+
func (r *ipMitigationResource) Update(_ context.Context, _ resource.UpdateRequest, _ *resource.UpdateResponse) {
168121
}
169122

170123
func (r *ipMitigationResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {

ovh/resource_ip_mitigation_gen.go

Lines changed: 1 addition & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/data-sources/ip_mitigation.md.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ Use this resource to retrieve information about an IP permanent mitigation.
2323

2424
* `ip` - The IP or the CIDR
2525
* `ip_on_mitigation` - IPv4 address
26-
* `permanent ` - Set on true if the IP is on permanent mitigation
26+
* `permanent ` - (Deprecated) Set on true if the IP is on permanent mitigation
2727
* `state` - Current state of the IP on mitigation
2828
* `auto` - Set on true if the IP is on auto-mitigation

templates/resources/ip_mitigation.md.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ Use this resource to manage an IP permanent mitigation.
1818

1919
* `ip` - (Required) The IP or the CIDR
2020
* `ip_on_mitigation` - (Required) IPv4 address
21-
* `permanent ` - Set on true if the IP is on permanent mitigation
21+
* `permanent ` - Deprecated, has no effect
2222

2323
## Attributes Reference
2424

2525
* `ip` - The IP or the CIDR
2626
* `ip_on_mitigation` - IPv4 address
27-
* `permanent ` - Set on true if the IP is on permanent mitigation
27+
* `permanent ` - (Deprecated) Set on true if the IP is on permanent mitigation
2828
* `state` - Current state of the IP on mitigation
2929
* `auto` - Set on true if the IP is on auto-mitigation

0 commit comments

Comments
 (0)