Bonjour,
J'essaie de créer un réseau privé via terraform et d'y ajouter une instance. Le réseau et le sous-réseau ce créent correctement mais j'ai une erreur au moment de la création de l'instance.
Voilà mon fichier de configuration:
```
# main.tf
# Version terraform: Terraform v1.0.11
terraform {
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "1.45.0"
}
ovh = {
source = "ovh/ovh"
version = "0.18.1"
}
}
}
provider "openstack" {
auth_url = "https://auth.cloud.ovh.net/v3/"
domain_name = "default" # Always "default" for OVHcloud
alias = "ovh"
tenant_id = "..."
}
provider "ovh" {
alias = "ovh"
endpoint = "ovh-eu"
application_key = "..."
application_secret = "..."
consumer_key = "..."
}
resource "ovh_cloud_project_network_private" "hadb-pn" {
provider = ovh.ovh
service_name = "..."
name = "pn-hadb"
regions = var.ovh_regions
vlan_id = 168
}
resource "ovh_cloud_project_network_private_subnet" "hadb-subnet" {
provider = ovh.ovh
service_name = "..."
network_id = ovh_cloud_project_network_private.hadb-pn.id
start = "10.42.0.1"
end = "10.42.0.100"
network = "10.42.0.0/24"
region = element(var.ovh_regions, 0)
no_gateway = true
}
module "ovh" {
source = "./modules/ovh"
providers = {
openstack = openstack.ovh
}
count = length(var.ovh_regions)
database_volume_size = var.database_volume_size
instance_type = "s1-2"
private_network_ip = "10.42.0.${count.index + 1}"
private_network_name = ovh_cloud_project_network_private.hadb-pn.name
region = element(var.ovh_regions, count.index)
ssh_key_path = var.ssh_key_path
ssh_key_name = var.ssh_key_name
subnet_id = ovh_cloud_project_network_private_subnet.hadb-subnet.id
}
# modules/ovh/main.tf
resource "openstack_compute_instance_v2" "ha-db" {
name = "ha-db"
image_name = "Ubuntu 18.04"
flavor_name = var.instance_type
key_pair = openstack_compute_keypair_v2.keypair.name
security_groups = [openstack_networking_secgroup_v2.ha-db_sg.name]
region = var.region
network {
name = "Ext-Net"
}
network {
name = var.private_network_name
fixed_ip_v4 = var.private_network_ip
}
}
```
Voilà l'erreur:
```
│ Error: Error creating OpenStack server: Bad request with: [POST https://compute.de1.cloud.ovh.net/v2.1/.../servers], error message: {"badRequest": {"code": 400, "message": "Network
04f51f23-1be8-409b-9c85-9e0c02091135 requires a subnet in order to boot instances on."}}
│
│ with module.ovh[1].openstack_compute_instance_v2.ha-db,
│ on modules/ovh/main.tf line 123, in resource "openstack_compute_instance_v2" "ha-db":
│ 123: resource "openstack_compute_instance_v2" "ha-db" {
│
╵
╷
│ Error: Error waiting for instance (e6b46a27-e3e5-4a72-817f-33ca5be39339) to become ready: unexpected state 'ERROR', wanted target 'ACTIVE'. last error: %!s()
│
│ with module.ovh[0].openstack_compute_instance_v2.ha-db,
│ on modules/ovh/main.tf line 123, in resource "openstack_compute_instance_v2" "ha-db":
│ 123: resource "openstack_compute_instance_v2" "ha-db" {
│
```
Public Cloud OVHcloud - Création d'un réseau privé avec Terraform
Related questions
- Dimensionnement serveur MySQL
44495
07.11.2018 12:32
- [RESOLU] Connexion impossible en SSH
37195
05.06.2019 20:05
- Bonjour, Je n'est reçus aucun mot de passe root lors de mon achat!
32567
05.02.2018 20:47
- Gitlab private docker registry
32363
16.03.2018 13:05
- Ssh connection timed out port 22
31450
11.12.2019 08:21
- Configuration IP failover avec netplan (Ubuntu 17.10)
31145
12.01.2018 23:23
- Problème connexion ssh
30783
04.02.2018 09:46
- IP Failover sur Debian 9
30518
18.11.2016 20:40
- Instance Public Cloud en "error"
27973
15.12.2025 10:04
- Connexion OpenStack Swift Object Storage
24252
11.04.2019 10:09