LF
October 24

S3E02

  1. Повторил. В процессе что-то поломал и пришлось удалить пулы, чтоб заново заинитить все.
  2. Токен - это про Selectel. Наверное придется все-таки там еще заводить акк. В CLO завел пользователя для S3, получил ключевую пару, заполнил конфиг.
  3. Файл перенесен

[lgc@localhost lf]$ cat provider.tf
terraform {
  backend "s3" {
    bucket = "s3-lgc-tfstates-default-bucket"
    key = "lf.tfstate"
    endpoints = {
      s3= "https://storage.clo.ru"
    }
    region = "default"
    username = "s3-lgc-tfstates"

    skip_region_validation      = true
    skip_credentials_validation = true
    skip_requesting_account_id  = true
    force_path_style            = true
  }


  required_providers {
    clo = {
      version = "2.8.0"
      source = "clo-ru/clo"
    }
    libvirt = {
      version = ">=0.8.3"
      source = "dmacvicar/libvirt"
    }
  }
}

# Подключение к storage
provider "libvirt" {
  alias = "storage"
  uri   = "qemu:///system" # URI подключения к libvirt локально
}

# Подключение к thin
provider "libvirt" {
  alias = "thin"
#  uri   = "qemu+ssh://${var.ssh_user}@${var.server2_ip}/system"
  uri   = "qemu+ssh://root@192.168.1.12/system"
}

# Подключение к CLO
provider "clo" {
  alias = "cloud"
  auth_url = "https://api.clo.ru"
  token = "ppzvf0jFJpyvkFgcjV7yzCo5inQnyZ6urAlHLZ5E5d0="
}
[lgc@localhost lf]$
[lgc@localhost lf]$ cat secret.backend.tfvars
access_key="Y**33"
secret_key="D*Nj"
[lgc@localhost lf]$
[lgc@localhost lf]$ terraform init -backend-config=secret.backend.tfvars -reconfigure
Initializing the backend...

Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...
- Reusing previous version of clo-ru/clo from the dependency lock file
- Reusing previous version of dmacvicar/libvirt from the dependency lock file
- Using previously-installed dmacvicar/libvirt v0.9.9
- Using previously-installed clo-ru/clo v2.8.0

╷
│ Warning: Deprecated Parameter
│
│   on provider.tf line 14, in terraform:
│   14:     force_path_style            = true
│
│ The parameter "force_path_style" is deprecated. Use parameter
│ "use_path_style" instead.
╵
Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
[lgc@localhost lf]$