ccycv opened a new issue #2:
URL: https://github.com/apache/cloudstack-terraform-provider/issues/2


   
   **If I add the bellow option to the terraform, I get this error in the first 
deploy**:
   
   ```
   cloudstack_network.terra-net: Creating...
   cloudstack_network.terra-net: Creation complete after 1s 
[id=f0b8709c-6013-4d80-9075-cc26b826f5a6]
   cloudstack_ipaddress.default: Creating...
   cloudstack_instance.web: Creating...
   cloudstack_ipaddress.default: Creation complete after 0s 
[id=907d5b89-cf2f-4109-ba83-78e620a5b431]
   cloudstack_firewall.default: Creating...
   cloudstack_instance.web: Still creating... [10s elapsed]
   cloudstack_instance.web: Still creating... [20s elapsed]
   cloudstack_instance.web: Still creating... [30s elapsed]
   cloudstack_instance.web: Still creating... [40s elapsed]
   cloudstack_instance.web: Still creating... [50s elapsed]
   cloudstack_instance.web: Still creating... [1m0s elapsed]
   cloudstack_instance.web: Still creating... [1m10s elapsed]
   cloudstack_instance.web: Creation complete after 1m19s 
[id=00fa3d62-0d22-470d-81fc-477bbc5d3bea]
   cloudstack_static_nat.default: Creating...
   ╷
   │ Error: Error enabling static NAT: CloudStack API error 431 
(CSExceptionErrorCode: 4350): Can't enable static, ip address Ip[5.xxx.xx.xx-1] 
is a sourceNat ip address
   │
   │   with cloudstack_static_nat.default,
   │   on acs.tf line 49, in resource "cloudstack_static_nat" "default":
   │   49: resource "cloudstack_static_nat" "default" {
   │
   ╵
   ╷
   │ Error: 1 error occurred:
   │       * Undefined error: {"errorcode":530,"errortext":"Failed to create 
firewall rule"}
   │
   │
   │
   │   with cloudstack_firewall.default,
   │   on acs.tf line 60, in resource "cloudstack_firewall" "default":
   │   60: resource "cloudstack_firewall" "default" {
   │
   `╵`
   ```
   If I do another run after this, it will work, the problem is that only 1 
public IP is allocated by default and the default one is with source NAT which 
can not be changed to static NAT.
   
   Is there a way to specify the public IP quantity? ( like it is possible via 
API ) or how can be this done only with 1 run?
   
   
   **This is how the deploy code looks.**
   
   ```
   resource "cloudstack_network" "terra-net" {
     name             = "terra-net"
     cidr             = "10.200.0.0/24"
     network_offering = "eb986523-8375-4824-8091-126a61e6ef05"
     zone             = "DE-001"
   }
   resource "cloudstack_instance" "web" {
     name             = "terratestacs"
     service_offering = "Micro"
     network_id       = cloudstack_network.terra-net.id
     template         = "7c01984d-f5ab-4638-b7a0-cb427f49523d"
     zone             = "DE-001"
     keypair          = "terrakey"
   
     user_data = <<-EOF
                   #!/bin/bash
                   sudo apt update -y
                   sudo apt install apache2 -y
                   sudo systemctl start apache2
                   sudo bash -c 'It is up > /var/www/html/index.html'
                   systemctl enable apache2.service             
                   EOF
     #expunge = true
     root_disk_size   = "10"
   }
   
   resource "cloudstack_ipaddress" "default" {
     network_id = cloudstack_network.terra-net.id
   }
   
   resource "cloudstack_static_nat" "default" {
     ip_address_id      = cloudstack_ipaddress.default.id  
     virtual_machine_id = cloudstack_instance.web.id
   }
   
   output "acs_ip_address" {
     value = cloudstack_instance.web.ip_address
     
   }
   
   
   resource "cloudstack_firewall" "default" {
     ip_address_id = cloudstack_ipaddress.default.id
   
     rule {
       cidr_list = ["0.0.0.0/0"]
       protocol  = "tcp"
       ports     = ["80", "443", "22"]
     }
   }
     
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to