-
Notifications
You must be signed in to change notification settings - Fork 462
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
350 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.img | ||
*.qcow2 | ||
*.tfstate* | ||
.terraform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
This example takes a base image of 2G and uses it as the backing store of a bigger volume. _cloud-init_ is then used to resize the original partition to the new available space. | ||
|
||
See https://github.com/dmacvicar/terraform-provider-libvirt/issues/369 | ||
|
||
# Running | ||
|
||
```console | ||
$ terraform apply | ||
$ ssh -i id_rsa "root@$(terraform output ip)" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEpAIBAAKCAQEAzKsKBhrbzq5Ur80tDE2t5fsAkJ5qHnm5w0v9cEVKkkPgeUTi | ||
+VswoBAFMjf1nTKbGZAEsXS8nphD4XURdztV+p1m7XopzS1uC0DDyPm5TxWptMSd | ||
ZAS2DA0l0eeyvKmNGveKKcrgFAjwMENr3syjwfNKao5waYSkLBvvgp6oWkPJG7RK | ||
SER6z/n1JBhJoGwAu8plNsLWRhhoYrGMaVTsOcYj2ohFNM3c59UarwL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Y6a7EuUrxh7NO68N1c | ||
0f0v2GNOeG4uKQkFeTKAVgQo9us++gR3l9Hcpr2hStWQ9RzhpLxqeF5hp8mDDIt6 | ||
PulLCp9UTSZUA5LHcJMdV5xE4EigyT6QxVncZWHgM6FRecm8FulYXgkfHATD6QMv | ||
W1OspwKBgQDviiVBtlUvRWo9wUs1Y1tYCwBjFVztaJBGQ+Qx5uhYAhSobwUTW/MI | ||
1lrxpGWaBfe63Iy+3V8v7YLU/bjjUMrzNFTrvoERwoRndL5EDqL5clljHO5kW+2g | ||
wXfNa8BPj2EiqmmMcM3rcxd7Kw7qvEFLeJk9WE6EvKjvYiirr20mhQ== | ||
-----END RSA PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMqwoGGtvOrlSvzS0MTa3l+wCQnmoeebnDS/1wRUqSQ+B5ROL5WzCgEAUyN/WdMpsZkASxdLyemEPhdRF3O1X6nWbteinNLW4LQMPI+blPFam0xJ1kBLYMDSXR57K8qY0a94opyuAUCPAwQ2vezKPB80pqjnBphKQsG++CnqhaQ8kbtEpIRHrP+fUkGEmgbAC7ymU2wtZGGGhisYxpVOw5xiPaiEU0zdzn1RqvAs+wqVXZNEk8WkuQabr0FgxHZ/EfIUufWIQy/LbVfTByzhuHZIsHypO7W4OSjoyd4ACUVCA+C8lwhhaGB3IiLRUaFq288UfgTQLbB8AOpXe6zmrP duncan@piscolita.suse.de |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
provider "libvirt" { | ||
uri = "qemu:///system" | ||
} | ||
|
||
resource "libvirt_volume" "os_image_ubuntu" { | ||
name = "os_image_ubuntu" | ||
pool = "default" | ||
source = "https://cloud-images.ubuntu.com/releases/xenial/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img" | ||
} | ||
|
||
resource "libvirt_volume" "disk_ubuntu_resized" { | ||
name = "disk" | ||
base_volume_id = "${libvirt_volume.os_image_ubuntu.id}" | ||
pool = "default" | ||
size = 5361393152 | ||
} | ||
|
||
# Use CloudInit to add our ssh-key to the instance | ||
resource "libvirt_cloudinit_disk" "cloudinit_ubuntu_resized" { | ||
name = "cloudinit_ubuntu_resized.iso" | ||
pool = "default" | ||
user_data = <<EOF | ||
#cloud-config | ||
disable_root: 0 | ||
ssh_pwauth: 1 | ||
users: | ||
- name: root | ||
ssh-authorized-keys: | ||
- ${file("id_rsa.pub")} | ||
growpart: | ||
mode: auto | ||
devices: ['/'] | ||
EOF | ||
} | ||
|
||
resource "libvirt_domain" "domain_ubuntu_resized" { | ||
name = "doman_ubuntu_resized" | ||
memory = "512" | ||
vcpu = 1 | ||
|
||
cloudinit = "${libvirt_cloudinit_disk.cloudinit_ubuntu_resized.id}" | ||
|
||
network_interface { | ||
network_name = "default" | ||
wait_for_lease = true | ||
} | ||
|
||
# IMPORTANT | ||
# Ubuntu can hang if an isa-serial is not present at boot time. | ||
# If you find your CPU 100% and never is available this is why | ||
console { | ||
type = "pty" | ||
target_port = "0" | ||
target_type = "serial" | ||
} | ||
|
||
console { | ||
type = "pty" | ||
target_type = "virtio" | ||
target_port = "1" | ||
} | ||
|
||
disk { | ||
volume_id = "${libvirt_volume.disk_ubuntu_resized.id}" | ||
} | ||
|
||
graphics { | ||
type = "spice" | ||
listen_type = "address" | ||
autoport = true | ||
} | ||
} | ||
|
||
output "ip" { | ||
value = "${libvirt_domain.domain_ubuntu_resized.network_interface.0.addresses.0}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.