This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
технология_terraform [2024/07/20 05:14] val [Провайдеры Selectel и OpenStack] |
технология_terraform [2025/02/13 12:07] (current) val [Управление проектом] |
||
---|---|---|---|
Line 2: | Line 2: | ||
* [[https://releases.hashicorp.com/terraform/]] | * [[https://releases.hashicorp.com/terraform/]] | ||
+ | * [[https://mirror.selectel.ru/3rd-party/hashicorp-releases/terraform/]] | ||
* [[https://hashicorp-releases.yandexcloud.net/terraform/]] | * [[https://hashicorp-releases.yandexcloud.net/terraform/]] | ||
* [[https://www.linuxtechi.com/how-to-install-terraform-on-debian/|How to Install Terraform on Debian 12]] | * [[https://www.linuxtechi.com/how-to-install-terraform-on-debian/|How to Install Terraform on Debian 12]] | ||
Line 13: | Line 14: | ||
# VER=1.9.2 | # VER=1.9.2 | ||
- | # wget https://hashicorp-releases.yandexcloud.net/terraform/$VER/terraform_${VER}_linux_amd64.zip | + | # wget https://mirror.selectel.ru/3rd-party/hashicorp-releases/terraform/$VER/terraform_${VER}_linux_amd64.zip |
# unzip terraform_${VER}_linux_amd64.zip | # unzip terraform_${VER}_linux_amd64.zip | ||
Line 22: | Line 23: | ||
</code> | </code> | ||
- | ===== terraform-provider-lxc ===== | ||
- | * [[https://github.com/jtopjian/terraform-provider-lxc]] | ||
===== terraform-provider-libvirt ===== | ===== terraform-provider-libvirt ===== | ||
Line 76: | Line 75: | ||
==== Простой проект ==== | ==== Простой проект ==== | ||
<code> | <code> | ||
- | ~/nodes# cp network-config network-config.tftpl | ||
- | |||
~/nodes# cat meta-data.tftpl | ~/nodes# cat meta-data.tftpl | ||
</code><code> | </code><code> | ||
local-hostname: ${name} | local-hostname: ${name} | ||
</code><code> | </code><code> | ||
+ | ~/nodes# cp network-config network-config.tftpl | ||
+ | |||
~/nodes# cat network-config.tftpl | ~/nodes# cat network-config.tftpl | ||
</code><code> | </code><code> | ||
Line 193: | Line 192: | ||
~/nodes# terraform apply #-auto-approve | ~/nodes# terraform apply #-auto-approve | ||
+ | |||
+ | ~/nodes# virsh list --all | ||
~/nodes# virsh console --domain domain-node1 | ~/nodes# virsh console --domain domain-node1 | ||
+ | |||
+ | ~/nodes# virsh vncdisplay domain-node1 | ||
~/nodes# terraform state list | ~/nodes# terraform state list | ||
~/nodes# terraform state show libvirt_domain.domain-node1 | ~/nodes# terraform state show libvirt_domain.domain-node1 | ||
- | + | ... | |
- | ~/nodes# virsh vncdisplay domain-node1 | + | network_interface { |
+ | addresses | ||
+ | ... | ||
~/nodes# terraform destroy #-auto-approve | ~/nodes# terraform destroy #-auto-approve | ||
+ | |||
+ | ~/nodes# ###virsh destroy domain-nodeN | ||
+ | ~/nodes# ###virsh undefine --domain domain-nodeN | ||
~/nodes# ### rm -r .terraform .terraform.lock.hcl terraform.tfstate terraform.tfstate.backup | ~/nodes# ### rm -r .terraform .terraform.lock.hcl terraform.tfstate terraform.tfstate.backup | ||
Line 242: | Line 250: | ||
local-hostname: ${name} | local-hostname: ${name} | ||
</code><code> | </code><code> | ||
+ | home-computer:~/nodes# ip r | ||
+ | home-computer:~/nodes# cat /etc/resolv.conf | ||
+ | |||
home-computer:~/nodes# cat network-config.tftpl | home-computer:~/nodes# cat network-config.tftpl | ||
</code><code> | </code><code> | ||
Line 257: | Line 268: | ||
addresses: [192.168.X.10] | addresses: [192.168.X.10] | ||
</code><code> | </code><code> | ||
+ | home-computer:~/nodes# mv node1.tf nodes.tf | ||
+ | |||
home-computer:~/nodes# cat nodes.tf | home-computer:~/nodes# cat nodes.tf | ||
</code><code> | </code><code> | ||
Line 359: | Line 372: | ||
} | } | ||
} | } | ||
- | </code> | + | </code><code> |
- | <code> | + | home-computer:~# mkdir -p selectel; cd $_ |
home-computer:~/selectel# cat main.tf | home-computer:~/selectel# cat main.tf | ||
+ | </code><code> | ||
terraform { | terraform { | ||
required_providers { | required_providers { |