Skip to content

Commit b9809a6

Browse files
committed
k8s
2 parents a1113fc + 9796f49 commit b9809a6

File tree

6 files changed

+173
-24
lines changed

6 files changed

+173
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Resource for creating a Google Kubernetes Engine cluster
2+
resource "google_container_cluster" "k8s_cluster" {
3+
name = "k8s-cluster-name"
4+
location = "us-central1-c"
5+
6+
# Node configuration
7+
node_config {
8+
machine_type = "n1-standard-2"
9+
oauth_scopes = [
10+
"https://www.googleapis.com/auth/devstorage.read_write",
11+
"https://www.googleapis.com/auth/cloud.platform"
12+
]
13+
image_type = "COS"
14+
local_ssd_count = 0
15+
}
16+
17+
initial_node_count = 3
18+
min_master_version = "1.30.6-gke.1596000"
19+
20+
# Autoscaling configuration for the default node pool
21+
node_pool {
22+
name = "default-pool"
23+
autoscaling {
24+
min_node_count = 2
25+
max_node_count = 6
26+
}
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Configure the Google Cloud provider
2+
provider "google" {
3+
project = "project_id"
4+
region = "us-central1"
5+
}
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
resource "libvirt_pool" "sysimg" {
2-
name = "sysimg"
3-
type = "dir"
4-
target {
5-
path = "/var/lib/libvirt/images/more"
1+
resource "libvirt_pool" "vmdisks" {
2+
name = "vmdisks"
3+
type = "dir"
4+
target {
5+
path = "/vmdisks"
6+
}
67
}
7-
}
88

99
resource "libvirt_volume" "arch_iso" {
1010
name = "archlinux-2024.08.01-x86_64.iso"
11-
pool = libvirt_pool.sysimg.name
11+
pool = libvirt_pool.vmdisks.name
1212
source = "/var/lib/libvirt/images/archlinux-2024.08.01-x86_64.iso"
1313
}
1414

1515
resource "libvirt_volume" "node0_disk" {
1616
name = "${var.domain_name}.qcow2"
17-
pool = libvirt_pool.sysimg.name
17+
pool = libvirt_pool.vmdisks.name
1818
size = var.disk_size * 1024 * 1024 * 1024
1919
format = "qcow2"
2020
}

provision-vm/kvm/using-terraform/src/terraform.tfstate

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": 4,
33
"terraform_version": "1.10.2",
4-
"serial": 56,
4+
"serial": 85,
55
"lineage": "c6da0a51-4628-6462-35ee-3e2611ac5d35",
66
"outputs": {},
77
"resources": [],

provision-vm/kvm/using-terraform/src/terraform.tfstate.backup

+131-15
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,126 @@
11
{
22
"version": 4,
33
"terraform_version": "1.10.2",
4-
"serial": 51,
4+
"serial": 79,
55
"lineage": "c6da0a51-4628-6462-35ee-3e2611ac5d35",
66
"outputs": {},
77
"resources": [
8+
{
9+
"mode": "managed",
10+
"type": "libvirt_domain",
11+
"name": "node0",
12+
"provider": "provider[\"registry.terraform.io/dmacvicar/libvirt\"]",
13+
"instances": [
14+
{
15+
"status": "tainted",
16+
"schema_version": 0,
17+
"attributes": {
18+
"arch": null,
19+
"autostart": null,
20+
"boot_device": [
21+
{
22+
"dev": [
23+
"cdrom",
24+
"hd"
25+
]
26+
}
27+
],
28+
"cloudinit": null,
29+
"cmdline": null,
30+
"console": [],
31+
"coreos_ignition": null,
32+
"cpu": [
33+
{
34+
"mode": "host-passthrough"
35+
}
36+
],
37+
"description": null,
38+
"disk": [
39+
{
40+
"block_device": "",
41+
"file": "",
42+
"scsi": false,
43+
"url": "",
44+
"volume_id": "/vmdisks/node0.qcow2",
45+
"wwn": ""
46+
},
47+
{
48+
"block_device": "",
49+
"file": "",
50+
"scsi": false,
51+
"url": "",
52+
"volume_id": "/vmdisks/archlinux-2024.08.01-x86_64.iso",
53+
"wwn": ""
54+
}
55+
],
56+
"emulator": null,
57+
"filesystem": [],
58+
"firmware": "/usr/share/edk2/x64/OVMF_CODE.4m.fd",
59+
"fw_cfg_name": "opt/com.coreos/config",
60+
"graphics": [
61+
{
62+
"autoport": true,
63+
"listen_address": "0.0.0.0",
64+
"listen_type": "address",
65+
"type": "vnc",
66+
"websocket": 0
67+
}
68+
],
69+
"id": "ce2c26b8-2243-4830-8539-83a43622db28",
70+
"initrd": null,
71+
"kernel": null,
72+
"machine": "q35",
73+
"memory": 1024,
74+
"metadata": null,
75+
"name": "node0",
76+
"network_interface": [
77+
{
78+
"addresses": [],
79+
"bridge": "",
80+
"hostname": "",
81+
"mac": "",
82+
"macvtap": "",
83+
"network_id": "e929708e-fe21-4386-9939-70f8c3a2eaa3",
84+
"network_name": "",
85+
"passthrough": "",
86+
"vepa": "",
87+
"wait_for_lease": true
88+
}
89+
],
90+
"nvram": [
91+
{
92+
"file": "/var/lib/libvirt/qemu/nvram/node0_VARS.fd",
93+
"template": "/usr/share/edk2/x64/OVMF_VARS.4m.fd"
94+
}
95+
],
96+
"qemu_agent": false,
97+
"running": true,
98+
"timeouts": null,
99+
"tpm": [],
100+
"type": "kvm",
101+
"vcpu": 1,
102+
"video": [
103+
{
104+
"type": "virtio"
105+
}
106+
],
107+
"xml": [
108+
{
109+
"xslt": "\u003c?xml version=\"1.0\" ?\u003e\n\u003cxsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\u003e\n \u003cxsl:template match=\"/domain/os\"\u003e\n \u003cxsl:copy\u003e\n \u003cxsl:apply-templates select=\"@*|node()\"/\u003e\n \u003cloader readonly=\"yes\" type=\"pflash\"\u003e/usr/share/ovmf/x64/OVMF_CODE.fd\u003c/loader\u003e\n \u003cnvram\u003e/var/lib/libvirt/qemu/nvram/node0_VARS.fd\u003c/nvram\u003e\n \u003c/xsl:copy\u003e\n \u003c/xsl:template\u003e\n \u003cxsl:template match=\"@*|node()\"\u003e\n \u003cxsl:copy\u003e\n \u003cxsl:apply-templates select=\"@*|node()\"/\u003e\n \u003c/xsl:copy\u003e\n \u003c/xsl:template\u003e\n\u003c/xsl:stylesheet\u003e\n"
110+
}
111+
]
112+
},
113+
"sensitive_attributes": [],
114+
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDB9fQ==",
115+
"dependencies": [
116+
"libvirt_network.devsecops2",
117+
"libvirt_pool.vmdisks",
118+
"libvirt_volume.arch_iso",
119+
"libvirt_volume.node0_disk"
120+
]
121+
}
122+
]
123+
},
8124
{
9125
"mode": "managed",
10126
"type": "libvirt_network",
@@ -36,7 +152,7 @@
36152
],
37153
"dnsmasq_options": [],
38154
"domain": "devsecops2.local",
39-
"id": "702e92b3-68f4-433e-90c3-13657fd0e788",
155+
"id": "e929708e-fe21-4386-9939-70f8c3a2eaa3",
40156
"mode": "nat",
41157
"mtu": null,
42158
"name": "devsecops2",
@@ -51,22 +167,22 @@
51167
{
52168
"mode": "managed",
53169
"type": "libvirt_pool",
54-
"name": "sysimg",
170+
"name": "vmdisks",
55171
"provider": "provider[\"registry.terraform.io/dmacvicar/libvirt\"]",
56172
"instances": [
57173
{
58174
"schema_version": 0,
59175
"attributes": {
60-
"allocation": 147680301056,
61-
"available": 102165659648,
176+
"allocation": 149280890880,
177+
"available": 100565069824,
62178
"capacity": 249845960704,
63-
"id": "f79aa16e-dd0f-466c-98f4-b1baded98281",
64-
"name": "sysimg",
179+
"id": "7e9a7e33-7005-4a2f-8c9d-bc11d80f35e1",
180+
"name": "vmdisks",
65181
"path": null,
66182
"source": [],
67183
"target": [
68184
{
69-
"path": "/var/lib/libvirt/images/more"
185+
"path": "/vmdisks"
70186
}
71187
],
72188
"type": "dir",
@@ -90,17 +206,17 @@
90206
"base_volume_name": null,
91207
"base_volume_pool": null,
92208
"format": "iso",
93-
"id": "/var/lib/libvirt/images/more/archlinux-2024.08.01-x86_64.iso",
209+
"id": "/vmdisks/archlinux-2024.08.01-x86_64.iso",
94210
"name": "archlinux-2024.08.01-x86_64.iso",
95-
"pool": "sysimg",
211+
"pool": "vmdisks",
96212
"size": 1182826496,
97213
"source": "/var/lib/libvirt/images/archlinux-2024.08.01-x86_64.iso",
98214
"xml": []
99215
},
100216
"sensitive_attributes": [],
101217
"private": "bnVsbA==",
102218
"dependencies": [
103-
"libvirt_pool.sysimg"
219+
"libvirt_pool.vmdisks"
104220
]
105221
}
106222
]
@@ -118,17 +234,17 @@
118234
"base_volume_name": null,
119235
"base_volume_pool": null,
120236
"format": "qcow2",
121-
"id": "/var/lib/libvirt/images/more/node1.qcow2",
122-
"name": "node1.qcow2",
123-
"pool": "sysimg",
237+
"id": "/vmdisks/node0.qcow2",
238+
"name": "node0.qcow2",
239+
"pool": "vmdisks",
124240
"size": 32212254720,
125241
"source": null,
126242
"xml": []
127243
},
128244
"sensitive_attributes": [],
129245
"private": "bnVsbA==",
130246
"dependencies": [
131-
"libvirt_pool.sysimg"
247+
"libvirt_pool.vmdisks"
132248
]
133249
}
134250
]
-17 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)