Terraform IONOS configuration issues

I tried everything but all I get are errors. Good people, please help if you can.
I have read the documentation. I am good at ansible and thought Terraform would show itself as a simpler tool to use but I guess I was wrong. I spent a lot of time making this, but it just does not want to work. There are few more files but only this one is the cause of all the errors, I think.


# Fetch Images Dynamically using data blocks
data "ionoscloud_image" "fw0_image" {
  image_alias = "OPNsense:latest"
  location    = "de/txl"
}

data "ionoscloud_image" "windows_2022_image" {
  image_alias = "Windows-Server-2022:latest"
  location    = "de/txl"
}

data "ionoscloud_image" "ubuntu_22_04_image" {
  image_alias = "Ubuntu-22.04:latest"
  location    = "de/txl"
}

# Create New Data Center
resource "ionoscloud_datacenter" "new_vdc" {
  name        = "CGM Medical IaaS - New Clone"
  location    = "de/txl"
  description = "Clone of CGM Medical IaaS - M1"
}

# LAN Setup
resource "ionoscloud_lan" "lan1" {
  datacenter_id = ionoscloud_datacenter.new_vdc.id
  public        = true
  name          = "LAN1"
}

resource "ionoscloud_lan" "lan2" {
  datacenter_id = ionoscloud_datacenter.new_vdc.id
  public        = false
  name          = "LAN2"
}

resource "ionoscloud_lan" "lan3" {
  datacenter_id = ionoscloud_datacenter.new_vdc.id
  public        = false
  name          = "LAN3"
}

# Firewall Server (FW0)
resource "ionoscloud_server" "fw0" {
  datacenter_id     = ionoscloud_datacenter.new_vdc.id
  name              = "FW0"
  cores             = 2
  ram               = 4096
  availability_zone = "AUTO"
  cpu_family        = "AMD_EPYC"
  type              = "ENTERPRISE"

  volume {
    name              = "FW0_BOOT_DISK"
    size              = 80
    disk_type         = "SSD"
    bus               = "VIRTIO"
    image_name        = data.ionoscloud_image.fw0_image.name
  }

  nic {
    lan             = ionoscloud_lan.lan1.id
    name            = "FW0_NIC0_LAN1"
    dhcp            = true
    firewall_active = false
  }
}

# Domain Controller (DC0)
resource "ionoscloud_server" "dc0" {
  datacenter_id     = ionoscloud_datacenter.new_vdc.id
  name              = "DC0"
  cores             = 4
  ram               = 8192
  availability_zone = "AUTO"
  cpu_family        = "AMD_EPYC"
  type              = "ENTERPRISE"

  volume {
    name              = "DC0_BOOT_DISK"
    size              = 160
    disk_type         = "SSD"
    bus               = "VIRTIO"
    image_name        = data.ionoscloud_image.windows_2022_image.name
  }

  nic {
    lan             = ionoscloud_lan.lan2.id
    name            = "DC0_NIC0_LAN2"
    dhcp            = true
    firewall_active = false
  }
}

# M1 Server (M1SRV)
resource "ionoscloud_server" "m1srv" {
  datacenter_id     = ionoscloud_datacenter.new_vdc.id
  name              = "M1SRV"
  cores             = 8
  ram               = 32768
  availability_zone = "AUTO"
  cpu_family        = "AMD_EPYC"
  type              = "ENTERPRISE"

  volume {
    name              = "M1SRV_BOOT_DISK"
    size              = 640
    disk_type         = "SSD"
    bus               = "VIRTIO"
    image_name        = var.m1srv_snapshot_id
  }

  nic {
    lan             = ionoscloud_lan.lan2.id
    name            = "M1SRV_NIC0_LAN2"
    dhcp            = true
    firewall_active = false
  }
}

# Monitoring Proxy (MONPROX)
resource "ionoscloud_server" "monprox" {
  datacenter_id     = ionoscloud_datacenter.new_vdc.id
  name              = "MONPROX"
  cores             = 1
  ram               = 2048
  availability_zone = "AUTO"
  cpu_family        = "AMD_EPYC"
  type              = "ENTERPRISE"

  volume {
    name              = "MONPROX_BOOT_DISK"
    size              = 50
    disk_type         = "SSD"
    bus               = "VIRTIO"
    image_name        = data.ionoscloud_image.ubuntu_22_04_image.name
  }

  nic {
    lan             = ionoscloud_lan.lan2.id
    name            = "MONPROX_NIC0_LAN2"
    dhcp            = true
    firewall_active = false
  }
}

# Terminal Servers (TS0 and TS1)
resource "ionoscloud_server" "ts" {
  count             = var.ts_count
  datacenter_id     = ionoscloud_datacenter.new_vdc.id
  name              = "TS${count.index}"
  cores             = 6
  ram               = 16384
  availability_zone = "AUTO"
  cpu_family        = "AMD_EPYC"
  type              = "ENTERPRISE"

  volume {
    name              = "TS${count.index}_BOOT_DISK"
    size              = 320
    disk_type         = "SSD"
    bus               = "VIRTIO"
    image_name        = data.ionoscloud_image.windows_2022_image.name
  }

  nic {
    lan             = ionoscloud_lan.lan2.id
    name            = "TS${count.index}_NIC0_LAN2"
    dhcp            = true
    firewall_active = false
  }
}

# Cross Connect
resource "ionoscloud_private_crossconnect" "cross_connect" {
  name         = "Cross Connect"
  description  = "Cross Connecting with M1-MGMT"

  peers {
    lan_id = ionoscloud_lan.lan1.id
  }

  peers {
    lan_id = ionoscloud_lan.lan2.id
  }

  peers {
    lan_id = ionoscloud_lan.lan3.id
  }
}

I did a lot of things, I tried even consulting chatgpt but it only brought even more errors. What am I doing wrong. I guess if I manage to fix one error, I fix all of them.

 Error: Unsupported argument
│
│   on main.tf line 58, in resource "ionoscloud_server" "fw0":
│   58:     image_name        = data.ionoscloud_image.fw0_image.name
│
│ An argument named "image_name" is not expected here.
╵
╷
│ Error: Unsupported argument
│
│   on main.tf line 84, in resource "ionoscloud_server" "dc0":
│   84:     image_name        = data.ionoscloud_image.windows_2022_image.name
│
│ An argument named "image_name" is not expected here.
╵
╷
│ Error: Unsupported argument
│
│   on main.tf line 110, in resource "ionoscloud_server" "m1srv":
│  110:     image_name        = var.m1srv_snapshot_id
│
│ An argument named "image_name" is not expected here.
╵
╷
│ Error: Unsupported argument
│
│   on main.tf line 136, in resource "ionoscloud_server" "monprox":
│  136:     image_name        = data.ionoscloud_image.ubuntu_22_04_image.name
│
│ An argument named "image_name" is not expected here.
╵
╷
│ Error: Unsupported argument
│
│   on main.tf line 163, in resource "ionoscloud_server" "ts":
│  163:     image_name        = data.ionoscloud_image.windows_2022_image.name
│
│ An argument named "image_name" is not expected here.

New contributor

Boris Nemet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

There is no image_name field inside volume. You should replace image_name=<image-name> to the ionoscloud_server. Here is an example:

# Firewall Server (FW0)
resource "ionoscloud_server" "fw0" {
  datacenter_id     = ionoscloud_datacenter.new_vdc.id
  name              = "FW0"
  cores             = 2
  ram               = 4096
  availability_zone = "AUTO"
  cpu_family        = "AMD_EPYC"
  type              = "ENTERPRISE"
  image_name        = data.ionoscloud_image.fw0_image.name

  volume {
    name              = "FW0_BOOT_DISK"
    size              = 80
    disk_type         = "SSD"
    bus               = "VIRTIO"
  }

  nic {
    lan             = ionoscloud_lan.lan1.id
    name            = "FW0_NIC0_LAN1"
    dhcp            = true
    firewall_active = false
  }
}

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật