Skip to content

Instantly share code, notes, and snippets.

@gowatana

gowatana/avi.tf Secret

Created May 9, 2024 00:01
Show Gist options
  • Save gowatana/435fe4605c9f4c7806ee8d8944181ec8 to your computer and use it in GitHub Desktop.
Save gowatana/435fe4605c9f4c7806ee8d8944181ec8 to your computer and use it in GitHub Desktop.
data "avi_tenant" "default_tenant" {
name = "admin"
}
data "avi_applicationprofile" "system_http_profile" {
name = "System-HTTP"
tenant_ref = data.avi_tenant.default_tenant.id
}
data "avi_healthmonitor" "monitor" {
name = "System-HTTP"
tenant_ref = data.avi_tenant.default_tenant.id
}
data "avi_cloud" "default_cloud" {
name = "Defaul-Cloud"
tenant_ref = data.avi_tenant.default_tenant.id
}
resource "avi_pool" "testpool" {
name = "tf-pool-01"
tenant_ref = data.avi_tenant.default_tenant.id
cloud_ref = data.avi_cloud.default_cloud.id
servers {
ip {
type = "V4"
#addr = "192.168.62.72"
addr = local.vm_ip_addr[0]
}
port = 80
}
lb_algorithm = "LB_ALGORITHM_ROUND_ROBIN"
fail_action {
type = "FAIL_ACTION_CLOSE_CONN"
}
}
resource "avi_vsvip" "vip" {
name = "tf-vip-01"
vip {
vip_id = "0"
ip_address {
type = "V4"
addr = "192.168.61.241"
}
auto_allocate_ip = false
}
cloud_ref = data.avi_cloud.default_cloud.id
tenant_ref = data.avi_tenant.default_tenant.id
}
resource "avi_virtualservice" "http_vs" {
name = "tf-vs-01"
tenant_ref = data.avi_tenant.default_tenant.id
pool_ref = avi_pool.testpool.id
vsvip_ref = avi_vsvip.vip.id
cloud_ref = data.avi_cloud.default_cloud.id
application_profile_ref = data.avi_applicationprofile.system_http_profile.id
cloud_type = "CLOUD_VCENTER"
services {
port = 80
enable_ssl = false
}
}
@gowatana
Copy link
Author

gowatana commented May 9, 2024

下記の投稿むけ。

Avi Load Balancer を Terraform で操作してみる。(vSphere といっしょに)
https://vm.gowatana.jp/entry/2024/05/09/235916

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment