thomasfinstad / terraform-provider-vyos-rolling

Terraform provider for VyOS with a focus on automatic resource generation
6 stars 0 forks source link

Improve provider example #189

Open github-actions[bot] opened 7 months ago

github-actions[bot] commented 7 months ago

milestone:3

count \= 1

description \= "Another terraform test"

}

count \= length(vyos_firewall_ipv4_name.example2)

rule_id \= 99

code \= 0

type \= 0

}

}

https://github.com/thomasfinstad/terraform-provider-vyos/blob/c3bd4b16ebe7a43fe5699e92a09c689c41d3aa65/examples/provider/provider.tf#L1


# TODO Improve provider example
#  milestone:3

terraform {
  required_providers {
    vyos = {
      source = "local/providers/vyos"
    }
  }
}

provider "vyos" {
  endpoint = "https://192.168.2.252"
  api_key  = "FoFeMcws4XpbKk4TDceQWzUdDsHptAr7FcuApxiHUV"

  certificate = {
    disable_verify = true
  }

  #overwrite_existing_resources_on_create = true
}

/* resource "vyos_firewall_group_port_group" "example" {
  port_group_id = "TF-Examples"

  description = "Example of terraform created resource ${plantimestamp()}"
  port        = [8080, "27015-27020", 44]
}

resource "vyos_firewall_ipv4_name" "example" {
  name_id = "TF-Example"

  default_action = "accept"
  description    = "Another terraform t ${plantimestamp()}"
} */

# resource "vyos_firewall_ipv4_name" "example2" {
#   count = 1

#   name_id = "TF-Example2-${count.index}-${replace(plantimestamp(), ":", "-")}"

#   default_action = "accept"
#   description    = "Another terraform test"
# }

# resource "vyos_firewall_ipv4_name_rule" "example2" {
#   count = length(vyos_firewall_ipv4_name.example2)

#   name_id = vyos_firewall_ipv4_name.example2[count.index].name_id
#   rule_id = 99

#   action = "accept"

#   icmp = {
#     code = 0
#     type = 0
#   }
# }

// Empty named resource
resource "vyos_policy_access_list" "name" {
  access_list_id = 42
}

// Child of empty
resource "vyos_policy_access_list_rule" "name" {
  access_list_id = 42
  rule_id        = 69

  description = plantimestamp()
  action      = "permit"
  source = {
    host = "55.55.55.55"
  }
}

# vyos_policy_access_list_rule.name: Modifications complete after 10s [id=policy__access-list__42__rule__69]