ionos-cloud / terraform-provider-profitbricks

Terraform ProfitBricks provider
https://www.terraform.io/docs/providers/profitbricks/
Mozilla Public License 2.0
3 stars 16 forks source link

Unsupported attribute: ip = "${profitbricks_ipblock.example.ip}" #66

Closed cristinelcalugarita closed 4 years ago

cristinelcalugarita commented 4 years ago

Hi IONOS team,

Thank you for releasing this beautiful code. It's NOT working :)))

Terraform Version

Terraform v0.12.24

Affected Resource(s)

Code

resource "profitbricks_ipblock" "example" { location = "${profitbricks_datacenter.example.location}" size = 1 }

resource "profitbricks_server" "example" { name = "server" datacenter_id = "${profitbricks_datacenter.example.id}" cores = 1 ram = 1024 availability_zone = "ZONE_1" cpu_family = "AMD_OPTERON"

 volume {
   name = "new"
   image_name = "${var.ubuntu}"
   size = 15
   disk_type = "SSD"
   ssh_key_path = "${var.private_key_path}"
   image_password = "test1234"
 }

 nic {
   lan = "${profitbricks_lan.example.id}"
   dhcp = true
   ip = "${profitbricks_ipblock.example.ip}"
   firewall_active = true

   firewall {
     protocol = "TCP"
     name = "SSH"
     port_range_start = 22
     port_range_end = 22
   }
 }

}

Terraform Configuration Files

default configuration

Expected Behaviour

Such a simple job is expected to run smoothly.

Actual Behaviour

Error: Unsupported attribute

on main.tf line XX, in resource "profitbricks_server" "example": XX: ip = "${profitbricks_ipblock.example.ip}"

This object has no argument, nested block, or exported attribute named "ip". Did you mean "id"?

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform validate

Important Factoids

Ionos - Profitbricks

References

none

jbuchhammer commented 4 years ago

The argument reference for ips is wrong, it is always a list of IPs. Try

ip = "${profitbricks_ipblock.example.ips[0]}"

instead. BTW: profitbricks_ipblock also has an undocumented name parameter which makes it easier to relate the IPblock to other resources. For example, I usually name the IPblock as "<datacentername>_CRIP".

cristinelcalugarita commented 4 years ago

yes yes, i know. but without checking the api and using only the documentation it's not working.

so, please update the docs for the profitbricks terraform provider!!!

cristinelcalugarita commented 4 years ago

btw, for example if you set an additional volume and you need that auxiliary disk to have no os installed, you have to mention licence_type = "UNKNOWN" otherwise it's not working.

again, in the docs nothing is specified, lucky me i had to create one manually and then query the api.