pycloud/tofu
Laurent Gourvenec e5420fb516 cosmetics 2024-01-25 10:40:59 +01:00
..
modules/pycloud cosmetics 2024-01-25 10:40:59 +01:00
README.md feat(tofy): adding first version of the tofu module 2024-01-25 10:40:54 +01:00
deployments.tf feat(tofu): adding information outputs 2024-01-25 10:40:59 +01:00
main.tf cosmetics 2024-01-25 10:40:59 +01:00
pytofu cosmetics 2024-01-25 10:40:59 +01:00

README.md

How to use pycloud tofu module

Step 1

Create a file named "main.tf" with this basic content :

module "deployment" {
  source = "./modules/pycloud"

  vra_url = var.vra_url 
  vra_refresh_token = var.vra_refresh_token
  vra_insecure_ssl  = true

  deployments = local.deployments
}

Create a file for your "deployments" named as you like deployments.tf for example

locals {
    deployments = {}
}

Step 2

Get a refresh token from VRA (your problem not mine). Or if you are lazy, use pytofu ;)

Step 3

Test your tofu, with pytofu we are lazy

$ pytofu -a https://vra-ng-ppd.iaas.in.cloe.education.gouv.fr plan

Step 4

Add some deployments to the deployments.tf file, like ... MonoVM-DEV

module "deployment" {
  source = "./modules/pycloud"

  vra_url = var.vra_url 
  vra_refresh_token = var.vra_refresh_token 
  vra_insecure_ssl = true

  deployments = {
    "test-pc-vf" = {
      name = "test-pc-vf"
      description = "test deployment"
      catalog_item_name = "MonoVM-Dev"
      project_name = "GRP-CLOE-TSS-DEV"

      inputs = {
        MonoVM_cpu = 2
        MonoVM_memory = 2048
        MonoVM_securityTag = "DEV-TIER-APP"
        MonoVM_service = "app"
        MonoVM_disks = jsonencode([
          { 
            mountpoint = "/toto",
            size = 10
          },
          { 
            mountpoint = "/titi",
            size = 20
          }
        ])
        MonoVM_image = "DEB10X"
        MonoVM_instances = 1
        MonoVM_startOrder = "1"
        leaseDays = "1"
      }
    }
  }
}