Skip to content

**Error when creating private gateway** #172

@lwsa-leonardosouza

Description

@lwsa-leonardosouza

Error when creating private gateway

I tested the module for creating private gateways. When executing the creation action below, I receive the following error message:

CloudStack API error 431 (CSExceptionErrorCode: 4350): One of vlanId and associatedNetworkId must be specified

I tried creating the private gateway through the UI, and it worked successfully. Here's the code I used to create the resource:

Code for creating resources using project scope:

resource "cloudstack_vpc" "vpc" {
  name         = var.vpc_name
  display_text = "VPC created by the module"
  cidr         = var.vpc_cidr
  zone         = var.zone_id
  vpc_offering = var.vpc_offering
  project      = var.project != "" ? var.project : null
  network_domain = var.network_domain 
}

resource "cloudstack_network" "network" {
  name             = var.network_name
  display_text     = var.network_display_text
  network_offering = var.network_offering
  zone             = var.zone
  cidr             = var.cidr
  vpc_id           = var.vpc_id 
  network_domain   = var.network_domain != "" ? var.network_domain : null
  acl_id           = var.acl_id != null ? var.acl_id : null
  project          = var.project != "" ? var.project : null
}

resource "cloudstack_network_acl" "acl" {

  name        = var.acl_name
  vpc_id      = module.vpc.id
  description = var.vpc_desc
  project     = var.project
}


resource "cloudstack_private_gateway" "pvgateway" {
  gateway                   =  var.gateway
  ip_address               =  var.ip_address
  netmask                   =  var.netmask
  vlan                          =  var.vlan != "" ? var.vlan : null
  vpc_id                      =  module.vpc.id
  acl_id                       =  var.acl_id != "" ? var.acl_id : null
  physical_network_id = var.physical_network_id != "" ? var.physical_network_id : null
}

I`ve tried same example from repository, but didn't work:

resource "cloudstack_private_gateway" "default" {
  gateway    = "10.0.0.1"
  ip_address = "10.0.0.2"
  netmask    = "255.255.255.252"
  vlan       = "200"
  vpc_id     = "76f6e8dc-07e3-4971-b2a2-8831b0cc4cb4"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions