-
Notifications
You must be signed in to change notification settings - Fork 632
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
resource/cloudflare_api_shield_schema_validation_settings #2841
Conversation
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. |
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.
Which ID are we talking about?
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.
this is auto-generated from the docs,it's mapped to the zone ID
Required: true, | ||
}, | ||
"validation_override_mitigation_action": { | ||
Description: "When set, this overrides both zone level and operation level mitigation actions", |
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.
Maybe add that this can only take values "none" and "disable_override" to kill SV 2.0?
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.
I'd rather not encode this into here, the API rejects invalid values.
return nil | ||
} | ||
|
||
func resourceCloudflareAPIShieldSchemaValidationSettingsDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { |
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.
Why is this a delete? We are not deleting anything? Or do you have to give a delete-function here?
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.
if a resource is removed from the terraform state, it deletes the resource - as we don't actually "delete" anything this just resets the state of the settings to default.
It could be argued there should be a DELETE
endpoint on the API, however this implementation will achieve the same.
return fmt.Errorf("encountered error getting schema validation settings: %w", err) | ||
} | ||
|
||
if result.DefaultMitigationAction != "none" { |
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.
If we want to verify that we receive the default-values, maybe compare against cloudflareAPIShieldSchemaValidationSettingsDefault().DefaultMitigationAction
?
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.
fixed 671ce3c
d7c1ac3
to
8d15cfb
Compare
changelog detected ✅ |
671ce3c
to
38b8624
Compare
Adds new resource `resource/cloudflare_api_shield_schema_validation_settings`
38b8624
to
6e40a52
Compare
acceptance tests all looking good!
thanks! |
This functionality has been released in v4.18.0 of the Terraform Cloudflare Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
Adds new resource
resource/cloudflare_api_shield_schema_validation_settings
Cloudflare-Go has been updated to include support for schema validation settings in API Shield Schema Validation 2.0
This PR updates the terraform provider to support managing these settings in API Shield
Depends on cloudflare/cloudflare-go#1418