A provider for IonosCloud.
password - Required if token is not set. If omitted, the IONOS_PASSWORD environment variable is used.export IONOS_TOKEN="token"export IONOS_USERNAME="username"
export IONOS_PASSWORD="password"export IONOS_S3_ACCESS_KEY="accesskey"
export IONOS_S3_SECRET_KEY="secretkey"export IONOS_API_URL="api-url"provider "ionoscloud" {
# we encourage users to use token authentication for security reasons
# username = var.ionos_username
# password = var.ionos_password
token = var.ionos_token
# optional, to be used only for reseller accounts
# contract_number = "contract_number_here"
# optional, does not need to be configured in most cases
# endpoint = "custom_cloud_api_url"
# s3_access_key = "your_access_key"
# s3_secret_key = "your_secret_key"export TF_VAR_ionos_token="token"
#export TF_VAR_ionos_username="username"
#export TF_VAR_ionos_password="password"
#export TF_VAR_ionos_s3_access_key="accesskey"
#export TF_VAR_ionos_s3_secret_key="secretkey"
#export TF_VAR_ionos_s3_region="region"version: 1.0
currentProfile: user # The current profile can also be overridden by the environment variable IONOS_CURRENT_PROFILE
profiles:
- name: user
environment: prod
credentials:
# You can use either username and password, or token.
# If both username and password, as well as token are provided, the token will take precedence.
token: <token>
- name: user2
environment: dev
credentials:
username: <username>
password: <password>
environments:
- name: prod
products:
- name: compute
endpoints:
- name: https://api.ionos.com/cloudapi/v6
skipTlsVerify: false
- name: dev
products:
- name: auth
endpoints:
- name: https://api.ionos.com/auth/v1
skipTlsVerify: false
terraform {
required_providers {
ionoscloud = {
source = "ionos-cloud/ionoscloud"
version = ">= 6.4.10"
}
}
}
provider "ionoscloud" {
token = var.ionos_token
# we encourage users to use token authentication
# username = var.ionos_username
# password = var.ionos_password
# optional, to be used only for reseller accounts
# contract_number = "contract_number_here"
# optional, does not need to be configured in most cases
# endpoint = "custom_cloud_api_url"
# s3_access_key = "your_access_key"
# s3_secret_key = "your_secret_key"
# s3_region = "your_bucket_region"
}
resource "ionoscloud_datacenter" "main" {
# ...
}terraform {
required_providers {
ionoscloud = {
source = "ionos-cloud/ionoscloud"
version = "6.7.20"
}
}
}
resource "ionoscloud_s3_bucket" "firstbucket" {
name = "terraform-eu-central-3"
region = "eu-central-3"
provider = ionoscloud.eucentral3
object_lock_enabled = true
force_destroy = true
}
resource "ionoscloud_s3_bucket" "secondbucket" {
name = "terraform-eu-central-4"
region = "eu-central-4"
provider = ionoscloud
object_lock_enabled = true
force_destroy = true
}
# This provider will be used to manipulate resources in 'eu-central-3' region.
provider "ionoscloud" {
s3_access_key = "S3_ACCESS_KEY"
s3_secret_key = "S3_SECRET_KEY"
token = "IONOS_TOKEN"
alias = "eucentral3"
}
# This provider will be used to manipulate resources in 'eu-central-4' region.
provider "ionoscloud" {
s3_access_key = "S3_ACCESS_KEY"
s3_secret_key = "S3_SECRET_KEY"
token = "IONOS_TOKEN"
}terraform {
required_providers {
ionoscloud = {
source = "ionos-cloud/ionoscloud"
version = "6.7.20"
}
}
}
resource "ionoscloud_logging_pipeline" "firstpipeline" {
location = "de/fra"
name = "firstpipeline"
log {
source = "kubernetes"
tag = "tagexample"
protocol = "http"
destinations {
type = "loki"
retention_in_days = 7
}
}
provider = ionoscloud.frankfurt
}
resource "ionoscloud_logging_pipeline" "secondpipeline" {
location = "de/txl"
name = "secondpipeline"
log {
source = "kubernetes"
tag = "tagexample"
protocol = "http"
destinations {
type = "loki"
retention_in_days = 7
}
}
provider = ionoscloud.berlin
}
resource "ionoscloud_logging_pipeline" "thirdpipeline" {
location = "fr/par"
name = "thirdpipeline"
log {
source = "kubernetes"
tag = "tagexample"
protocol = "http"
destinations {
type = "loki"
retention_in_days = 7
}
}
provider = ionoscloud
}
# This provider will be used to manipulate resources in Frankfurt.
provider "ionoscloud" {
token = "IONOS_TOKEN"
alias = "frankfurt"
}
# This provider will be used to manipulate resources in Berlin.
provider "ionoscloud" {
token = "IONOS_TOKEN"
alias = "berlin"
}
# This provider will be used to manipulate resources in Paris.
provider "ionoscloud" {
token = "IONOS_TOKEN"
}resource "ionoscloud_server" "example" {
name = "Server Example"
datacenter_id = ionoscloud_datacenter.example.id
cores = 1
ram = 1024
image_name = data.ionoscloud_image.example.id
image_password = random_password.server_image_password.result
type = "ENTERPRISE"
volume {
name = "system"
size = 5
disk_type = "SSD Standard"
user_data = "foo"
bus = "VIRTIO"
}
nic {
lan = ionoscloud_lan.example.id
name = "system"
dhcp = true
firewall_active = true
firewall_type = "BIDIRECTIONAL"
ips = [ ionoscloud_ipblock.example.ips[0], ionoscloud_ipblock.example.ips[1] ]
firewall {
protocol = "TCP"
name = "SSH"
port_range_start = 22
port_range_end = 22
source_mac = "00:0a:95:9d:68:17"
source_ip = ionoscloud_ipblock.example.ips[2]
target_ip = ionoscloud_ipblock.example.ips[3]
type = "EGRESS"
}
}
timeouts {
create = "30m"
update = "300s"
delete = "2h"
}
}
resource "random_password" "server_image_password" {
length = 16
special = false
}$ export IONOS_LOG_LEVEL=debug$ export TF_LOG=debug
$ export IONOS_DEBUG=true
$ terraform apply{
"httpStatus" : 422,
"messages" : [ {
"errorCode" : "200",
"message" : "[VDC-yy-xxxx] Operation cannot be executed since this Kubernetes Nodepool is already marked for deletion. Current state of the resource is FAILED_DESTROYING."
}]
}$ sed -i 's/profitbricks_/ionoscloud_/g' ./main.tf$ sed -i bak 's/profitbricks_/ionoscloud_/g' ./main.tf$ sed -i 's/profitbricks_/ionoscloud_/g' ./terraform.tfstate$ sed -i bak 's/profitbricks_/ionoscloud_/g' ./terraform.tfstate"provider": "provider[\"registry.terraform.io/hashicorp/profitbricks\"]""provider": "provider[\"registry.terraform.io/hashicorp/ionoscloud\"]"