-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add Firewall Config resource #195
Conversation
@@ -57,6 +57,7 @@ func (p *vercelProvider) Resources(_ context.Context) []func() resource.Resource | |||
newEdgeConfigResource, | |||
newEdgeConfigSchemaResource, | |||
newEdgeConfigTokenResource, | |||
newFirewallConfigResource, |
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.
is there value in having a DataSource too? (probably 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.
Yea ideally I'd want to have a couple separate datasources that you can actually use within the config resource to avoid this thing getting too out of control, but haven't quite spent the time to look into it. not sure if it makes too much sense for datasource of the firewall config
@@ -63,7 +63,7 @@ Attack Challenge Mode prevent malicious traffic by showing a verification challe | |||
PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}, | |||
}, | |||
"project_id": schema.StringAttribute{ | |||
Description: "The ID of the Project to adjust the CPU for.", | |||
Description: "The ID of the Project to toggle Attack Challenge Mode on.", |
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.
good spot.
vercel/resource_firewall_config.go
Outdated
Algo types.String `tfsdk:"algo"` | ||
Window types.Int64 `tfsdk:"window"` | ||
Limit types.Int64 `tfsdk:"limit"` | ||
Keys []types.String `tfsdk:"keys"` |
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.
types.List might be nicer 🤷
vercel/resource_firewall_config.go
Outdated
type Mitigate struct { | ||
Action types.String `tfsdk:"action"` | ||
RateLimit *RateLimit `tfsdk:"rate_limit"` | ||
Redirect *Redirect `tfsdk:"redirect"` |
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.
Could consider using types.Object
rather than *Redirect
for these kinda fields. Not a biggie if it makes the code a lot messier though.
github.com/hashicorp/terraform-plugin-framework v1.10.0 | ||
github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 | ||
github.com/hashicorp/terraform-plugin-go v0.23.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 usually try to do package bumps as a separate PR, but not worth separating out now.
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: golang/github.com/hashicorp/terraform-plugin-framework@v1.7.0, golang/github.com/hashicorp/terraform-plugin-go@v0.22.1 |
07e498f
to
7680352
Compare
Blocks: map[string]schema.Block{ | ||
"managed_rulesets": schema.SingleNestedBlock{ | ||
Description: "The managed rulesets that are enabled.", | ||
Blocks: map[string]schema.Block{ |
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.
A helper function to populate these might make this more readable.
Adds a new resource and client connector for the Firewall configuration API
Supports updating custom rules, ip blocking rules and managed rulesets