-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvsi.tf
42 lines (33 loc) · 777 Bytes
/
vsi.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
variable "vpcid" {
description = "Enter the vpc id"
}
variable "subnetid" {
description = "Enter the subnet id"
}
variable "sshkey" {
description = "Enter the ssh key name"
}
variable "instance_name" {
default = "testvsi-"
description = "Prefix to the name of the vsi"
}
variable "imageid" {
description = "Enter the image id for the VSI"
}
data "ibm_is_ssh_key" "testacc_sshkey" {
name = var.sshkey
}
resource "random_id" "name" {
byte_length = 4
}
resource "ibm_is_instance" "testacc_instance" {
name = "${var.instance_name}${random_id.name.hex}"
image = var.imageid
profile = "cx2-2x4"
primary_network_interface {
subnet = var.subnetid
}
vpc = var.vpcid
zone = "us-south-1"
keys = [data.ibm_is_ssh_key.testacc_sshkey.id]
}