diff --git a/docs/index.md b/docs/index.md index b8d466d..581ccf7 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,12 +3,12 @@ page_title: "routeros-firewall-list Provider" subcategory: "" description: |- - + A provider for declaratively managing firewall lists on RouterOS devices. --- # routeros-firewall-list Provider - +A provider for declaratively managing firewall lists on RouterOS devices. ## Example Usage @@ -28,6 +28,16 @@ provider "routeros-firewall-list" { ca_certificate = "./ca.pem" # env fallback: ROS_CA_CERTIFICATE insecure = false # env fallback: ROS_INSECURE } + +resource "routeros-firewall-list_rule_ordering" "rules" { + rule_type = "filter" + rules = [ + "*A", + "*B", + "*C", + "*9", + ] +} ``` @@ -35,8 +45,8 @@ provider "routeros-firewall-list" { ### Optional -- `ca_certificate` (String) Example provider attribute -- `hosturl` (String) Example provider attribute -- `insecure` (Boolean) Example provider attribute -- `password` (String, Sensitive) Example provider attribute -- `username` (String) Example provider attribute +- `ca_certificate` (String) Path to the CA root certificate +- `hosturl` (String) Address of the host device. Do not specify the protocol or port, these are hard-coded to 'https' and '443' respectively +- `insecure` (Boolean) Whether to skip verifying the SSL certificate used by the API service +- `password` (String, Sensitive) Password to use for API authentication +- `username` (String) Username to use for API authentication diff --git a/docs/resources/rule_ordering.md b/docs/resources/rule_ordering.md index ba6209d..ad96c90 100644 --- a/docs/resources/rule_ordering.md +++ b/docs/resources/rule_ordering.md @@ -10,7 +10,20 @@ description: |- Firewall rule ordering - +## Example Usage + +```terraform +# Enforces specified order for firewall rules in "filter" category +resource "routeros-firewall-list_rule_ordering" "rules" { + rule_type = "filter" + rules = [ + "*A", + "*B", + "*C", + "*9", + ] +} +``` ## Schema @@ -23,3 +36,11 @@ Firewall rule ordering ### Read-Only - `id` (String) Identifier of resource + +## Import + +Import is supported using the following syntax: + +```shell +# This resource is not importable :( +``` diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index edaa785..a9f400b 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -13,3 +13,13 @@ provider "routeros-firewall-list" { ca_certificate = "./ca.pem" # env fallback: ROS_CA_CERTIFICATE insecure = false # env fallback: ROS_INSECURE } + +resource "routeros-firewall-list_rule_ordering" "rules" { + rule_type = "filter" + rules = [ + "*A", + "*B", + "*C", + "*9", + ] +} diff --git a/examples/resources/routeros-firewall-list_rule_ordering/import.sh b/examples/resources/routeros-firewall-list_rule_ordering/import.sh new file mode 100644 index 0000000..807ac09 --- /dev/null +++ b/examples/resources/routeros-firewall-list_rule_ordering/import.sh @@ -0,0 +1 @@ +# This resource is not importable diff --git a/examples/resources/rule_ordering/resource.tf b/examples/resources/routeros-firewall-list_rule_ordering/resource.tf similarity index 71% rename from examples/resources/rule_ordering/resource.tf rename to examples/resources/routeros-firewall-list_rule_ordering/resource.tf index 7e79058..d640050 100644 --- a/examples/resources/rule_ordering/resource.tf +++ b/examples/resources/routeros-firewall-list_rule_ordering/resource.tf @@ -1,5 +1,5 @@ # Enforces specified order for firewall rules in "filter" category -resource "routeros-firewall-list_rule_ordering" "this" { +resource "routeros-firewall-list_rule_ordering" "rules" { rule_type = "filter" rules = [ "*A", diff --git a/internal/provider/provider.go b/internal/provider/provider.go index a01d501..9df20ab 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -60,32 +60,34 @@ func (p *RouterosFWFLProvider) Metadata(ctx context.Context, req provider.Metada func (p *RouterosFWFLProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) { resp.Schema = schema.Schema{ + Description: "A provider for declaratively managing firewall lists on RouterOS devices", + MarkdownDescription: "A provider for declaratively managing firewall lists on RouterOS devices.", Attributes: map[string]schema.Attribute{ "hosturl": schema.StringAttribute{ - MarkdownDescription: "Example provider attribute", Optional: true, - Description: "TODO", + Description: "Address of the host device. Do not specify the protocol or port, these are hard-coded to 'https' and '443' respectively", + MarkdownDescription: "Address of the host device. Do not specify the protocol or port, these are hard-coded to 'https' and '443' respectively", }, "username": schema.StringAttribute{ - MarkdownDescription: "Example provider attribute", Optional: true, - Description: "TODO", + Description: "Username to use for API authentication", + MarkdownDescription: "Username to use for API authentication", }, "password": schema.StringAttribute{ - MarkdownDescription: "Example provider attribute", Optional: true, Sensitive: true, - Description: "TODO", + Description: "Password to use for API authentication", + MarkdownDescription: "Password to use for API authentication", }, "ca_certificate": schema.StringAttribute{ - MarkdownDescription: "Example provider attribute", Optional: true, - Description: "TODO", + MarkdownDescription: "Path to the CA root certificate", + Description: "Path to the CA root certificate", }, "insecure": schema.BoolAttribute{ - MarkdownDescription: "Example provider attribute", Optional: true, - Description: "TODO", + Description: "Whether to skip verifying the SSL certificate used by the API service", + MarkdownDescription: "Whether to skip verifying the SSL certificate used by the API service", }, }, } diff --git a/internal/provider/resource_rule_ordering.go b/internal/provider/resource_rule_ordering.go index d0ac8a2..b8a9d28 100644 --- a/internal/provider/resource_rule_ordering.go +++ b/internal/provider/resource_rule_ordering.go @@ -77,11 +77,11 @@ func (r *FirewallRuleOrderingResource) Configure(ctx context.Context, req resour func (r *FirewallRuleOrderingResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ MarkdownDescription: "Firewall rule ordering", - Description: "TODO", + Description: "Firewall rule ordering", Attributes: map[string]schema.Attribute{ "rule_type": schema.StringAttribute{ MarkdownDescription: "The rule type to apply ordering to", - Description: "TODO", + Description: "The rule type to apply ordering to", Required: true, Validators: []validator.String{ stringvalidator.OneOf("filter", "nat", "mangle", "raw"), @@ -90,12 +90,12 @@ func (r *FirewallRuleOrderingResource) Schema(ctx context.Context, req resource. "rules": schema.ListAttribute{ ElementType: types.StringType, MarkdownDescription: "List of rules arranged in their desired order", - Description: "TODO", + Description: "List of rules arranged in their desired order", Required: true, }, "id": schema.StringAttribute{ Computed: true, - Description: "TODO", + Description: "Identifier of resource", MarkdownDescription: "Identifier of resource", PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), diff --git a/main.go b/main.go index 65ace09..08e08ae 100644 --- a/main.go +++ b/main.go @@ -53,7 +53,6 @@ func main() { flag.Parse() opts := providerserver.ServeOpts{ - // TODO: Update this string with the published name of your provider. Address: "registry.terraform.io/toalaah/terraform-provider-routeros-firewall-list", Debug: debug, }