Skip to content
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

cloudstack_firewall fails with json: unmarshal error #14044

Closed
samzehnder opened this issue Apr 27, 2017 · 3 comments · Fixed by #14385
Closed

cloudstack_firewall fails with json: unmarshal error #14044

samzehnder opened this issue Apr 27, 2017 · 3 comments · Fixed by #14385

Comments

@samzehnder
Copy link

samzehnder commented Apr 27, 2017

Hi there,

I run in an error when using the cloudstack_firewall ressource. The configuration is applied correctly but it seems like terraform fails to parse the state and fails with the error:

Error refreshing state: 1 error(s) occurred:

  • cloudstack_firewall.default: cloudstack_firewall.default: json: cannot unmarshal string into Go struct field FirewallRule.startport of type int

Terraform Version

Terraform v0.9.4

Affected Resource(s)

  • cloudstack_firewall

Terraform Configuration Files

provider "cloudstack" {
  # PROD
  api_url = "ommited"
  api_key = "ommited"
  secret_key = "ommited"
  http_get_only = true
  timeout = 3600
}

resource "cloudstack_firewall" "default" {
  ip_address_id = "6be820f2-3e34-40da-9de8-0f323b4a4a89"
  rule {
    cidr_list = ["195.8.198.0/23"]
    protocol  = "tcp"
    ports     = ["80", "22", "443"]
  }
}

Debug Output

not much more than this:
cloudstack_firewall.default: Refreshing state... (ID: 6be820f2-3e34-40da-9de8-0f323b4a4a89)
2017/04/27 18:32:02 [ERROR] root: eval: *terraform.EvalRefresh, err: cloudstack_firewall.default: json: cannot unmarshal string into Go struct field FirewallRule.startport of type int
2017/04/27 18:32:02 [ERROR] root: eval: *terraform.EvalSequence, err: cloudstack_firewall.default: json: cannot unmarshal string into Go struct field FirewallRule.startport of type int
2017/04/27 18:32:02 [TRACE] [walkRefresh] Exiting eval tree: cloudstack_firewall.default
2017/04/27 18:32:02 [DEBUG] dag/walk: upstream errored, not walking "provider.cloudstack (close)"
Error refreshing state: 1 error(s) occurred:

2017/04/27 18:32:02 [DEBUG] plugin: waiting for all plugin processes to complete...
2017/04/27 18:32:02 [DEBUG] plugin: terraform: cloudstack-provider (internal) 2017/04/27 18:32:02 [DEBUG] plugin: waiting for all plugin processes to complete...

  • cloudstack_firewall.default: cloudstack_firewall.default: json: cannot unmarshal string into Go struct field FirewallRule.startport of type int
    2017/04/27 18:32:02 [DEBUG] plugin: /usr/local/bin/terraform: plugin process exited

Expected Behavior

Firewallrules are applied, state is updated and can be processed further by terraform

Actual Behavior

Firewallrules are applied, state cannot be read by further terraform plan/apply runs

Steps to Reproduce

  1. terraform apply => error occurs
  2. terraform plan => error occurs
@samzehnder
Copy link
Author

@svanharmelen
Copy link
Contributor

@samzehnder I noticed you already supplied a patch to the go-cloudstack package and that you already found out this is due to an API change wit CloudStack that happened quite a while ago. I'll have a look at your suggested fix and if that works out we'll update the dependency here as well.

Thanks and I'll get back to you shortly!

@ghost
Copy link

ghost commented Apr 12, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants