Skip to content

Commit

Permalink
fix(Firewall): Fix a type error in the firewall
Browse files Browse the repository at this point in the history
Change cird for cidr in the firewall rule

BREAKING CHANGE: No

Signed-off-by: Alejandro JNM <alejandrojnm@gmail.com>
  • Loading branch information
alejandrojnm committed Apr 20, 2020
1 parent d656e61 commit 71e4ade
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions civo/resource_firewall_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func resourceFirewallRule() *schema.Resource {
Description: "The end of the port range (this is optional, by default it will only apply to the single port listed in start_port)",
ValidateFunc: validation.NoZeroValues,
},
"cird": {
"cidr": {
Type: schema.TypeSet,
Required: true,
ForceNew: true,
Expand Down Expand Up @@ -84,7 +84,7 @@ func resourceFirewallRule() *schema.Resource {
func resourceFirewallRuleCreate(d *schema.ResourceData, m interface{}) error {
apiClient := m.(*civogo.Client)

tfCidr := d.Get("cird").(*schema.Set).List()
tfCidr := d.Get("cidr").(*schema.Set).List()
cird := make([]string, len(tfCidr))
for i, tfCird := range tfCidr {
cird[i] = tfCird.(string)
Expand Down Expand Up @@ -137,7 +137,7 @@ func resourceFirewallRuleRead(d *schema.ResourceData, m interface{}) error {
d.Set("protocol", resp.Protocol)
d.Set("start_port", resp.StartPort)
d.Set("end_port", resp.EndPort)
d.Set("cird", resp.Cidr)
d.Set("cidr", resp.Cidr)
d.Set("direction", resp.Direction)
d.Set("label", resp.Label)

Expand Down Expand Up @@ -178,7 +178,7 @@ func resourceFirewallRuleImport(d *schema.ResourceData, m interface{}) ([]*schem
d.Set("protocol", resp.Protocol)
d.Set("start_port", resp.StartPort)
d.Set("end_port", resp.EndPort)
d.Set("cird", resp.Cidr)
d.Set("cidr", resp.Cidr)
d.Set("direction", resp.Direction)
d.Set("label", resp.Label)

Expand Down
6 changes: 3 additions & 3 deletions website/docs/r/firewall_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resource "civo_firewall_rule" "http" {
protocol = "tcp"
start_port = "80"
end_port = "80"
cird = ["192.168.1.2/32", "10.10.10.1/32", format("%s/%s",civo_instance.foo.public_ip,"32")]
cidr = ["192.168.1.2/32", "10.10.10.1/32", format("%s/%s",civo_instance.foo.public_ip,"32")]
direction = "inbound"
label = "server web"
depends_on = [civo_firewall.www]
Expand All @@ -40,7 +40,7 @@ The following arguments are supported:
* `protocol` (Required) This may be one of "tcp", "udp", or "icmp".
* `start_port` (Required) The start port where traffic to be allowed.
* `end_port` (Required) The end port where traffic to be allowed.
* `cird` (Required) the IP address of the other end (i.e. not your instance) to affect, or a valid network CIDR (defaults to being globally applied, i.e. 0.0.0.0/0).
* `cidr` (Required) the IP address of the other end (i.e. not your instance) to affect, or a valid network CIDR (defaults to being globally applied, i.e. 0.0.0.0/0).
* `direction` (Required) will this rule affect inbound or outbound traffic (by default this is inbound)
* `label` (Optional) a string that will be the displayed name/reference for this rule (optional)

Expand All @@ -53,7 +53,7 @@ The following attributes are exported:
* `protocol` This may be one of "tcp", "udp", or "icmp".
* `start_port` The start port where traffic to be allowed.
* `end_port` The end port where traffic to be allowed.
* `cird` A list of IP address of the other end (i.e. not your instance) to affect, or a valid network CIDR.
* `cidr` A list of IP address of the other end (i.e. not your instance) to affect, or a valid network CIDR.
* `direction` Will this rule affect inbound or outbound traffic (by default this is inbound)
* `label` A string that will be the displayed name/reference for this rule (optional)

Expand Down

0 comments on commit 71e4ade

Please sign in to comment.