Error with firewalls api, shows `Server was unable to give you a response.`

January 8, 2019 762 views
Terraform Firewall Ubuntu 18.04

Most firewalls declared on Terraform .hcl file does not get created when using tarraform as in this docs https://www.terraform.io/docs/providers/do/r/firewall.html

Shows error like this,

Error: Error applying plan:

5 error(s) occurred:

* module.default-firewall.digitalocean_firewall.outbound-ntp: 1 error(s) occurred:

* digitalocean_firewall.outbound-ntp: Error creating firewall: POST https://api.digitalocean.com/v2/firewalls: 500 Server was unable to give you a response.
* digitalocean_firewall.gluster_client: 1 error(s) occurred:

* digitalocean_firewall.gluster_client: Error creating firewall: POST https://api.digitalocean.com/v2/firewalls: 500 Server was unable to give you a response.
* module.default-firewall.digitalocean_firewall.outbound-dns: 1 error(s) occurred:

* digitalocean_firewall.outbound-dns: Error creating firewall: POST https://api.digitalocean.com/v2/firewalls: 500 Server was unable to give you a response.
* module.docker-swarm-firewall.digitalocean_firewall.swarm-mode-internal-fw: 1 error(s) occurred:

* digitalocean_firewall.swarm-mode-internal-fw: Error creating firewall: POST https://api.digitalocean.com/v2/firewalls: 500 Server was unable to give you a response.
* module.default-firewall.digitalocean_firewall.outbound-http: 1 error(s) occurred:

* digitalocean_firewall.outbound-http: Error creating firewall: POST https://api.digitalocean.com/v2/firewalls: 500 Server was unable to give you a response.

2 Answers
surajstha January 9, 2019
Accepted Answer

I believe terraform was trying to apply firewalls to droplet resources, and dependent resource was not available to handle it at the time. So some of the firewalls were applied randomly on each try.
Related issue on github:
https://github.com/thojkooi/terraform-digitalocean-docker-swarm-firewall/issues/8

Hey friend,

I believe this uses our firewall product, though it may use software firewall inside of a droplet. The first seems more likely. It may be good to cross post this to GitHub so that the maintainers can review it as well:

https://github.com/terraform-providers/terraform-provider-digitalocean/issues

If you do get an answer elsewhere, please share it here so I can know how to help others who experience the same.

Jarland

Have another answer? Share your knowledge.