terraform-provider-openvpn-cloud
terraform-provider-openvpn-cloud copied to clipboard
"openvpncloud_service" strange output every "terraform plan"
Hello, I'm trying to create resource "openvpncloud_service" with next code:
resource "openvpncloud_service" "name" {
name = "test1234"
type = "IP_SOURCE"
description = "test"
routes = ["10.0.0.2/32"]
network_item_type = "NETWORK"
network_item_id = data.openvpncloud_network.mynetwork.network_id
}
When i execute "terraform apply" -> resource being created OK, but when i re-run "terraform plan" i see next output:
# openvpncloud_service.name will be updated in-place
~ resource "openvpncloud_service" "name" {
id = "0a88ff52-30e3-466c-8149-a78b35900e66"
name = "test1234"
~ routes = [
- "",
+ "10.0.0.2/32",
]
# (4 unchanged attributes hidden)
- config {
- service_types = [
- "ANY",
] -> null
}
}
Interesting that when i open WebUI of CloudConnexa and navigate to this menu in UI -> before and after applying -> in UI there is no visible changes.
In file "resource_service.go" section "config" is not marked as "required", but without it Terraform plan shows output above ^^
config {
service_types = ["ANY"]
}
When i add "config" section and try to apply terraform with next block:
resource "openvpncloud_service" "name" {
name = "test1234"
type = "IP_SOURCE"
description = "test"
routes = ["10.0.0.2/32"]
network_item_type = "NETWORK"
network_item_id = data.openvpncloud_network.mynetwork.network_id
config {
service_types = ["ANY"]
}
}
i see next output:
Terraform will perform the following actions:
# openvpncloud_service.name will be updated in-place
~ resource "openvpncloud_service" "name" {
id = "0a88ff52-30e3-466c-8149-a78b35900e66"
name = "test1234"
~ routes = [
- "",
+ "10.0.0.2/32",
]
# (4 unchanged attributes hidden)
# (1 unchanged block hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
I don't understand what can i do with "routes" so "terraform plan" would not show-up "changes"
I ran into this bug also. A work-around is
# TODO workaround for https://github.com/OpenVPN/terraform-provider-openvpn-cloud/issues/80
lifecycle {
ignore_changes = [
routes,
]
}
Be aware that if the route ever needs to change after initial creation, this should be removed.
I ran into this bug also. A work-around is
# TODO workaround for https://github.com/OpenVPN/terraform-provider-openvpn-cloud/issues/80 lifecycle { ignore_changes = [ routes, ] }
Be aware that if the route ever needs to change after initial creation, this should be removed.
I think this is a bad solution, terraform needs to be dynamic, in my use case every day a new route can be added, and this will prevent it from running...
for me, this is a big problem because it fails my drift detection
We've published new version of Terraform Provider to Registry: https://registry.terraform.io/providers/OpenVPN/cloudconnexa/latest
Going forward only https://registry.terraform.io/providers/OpenVPN/cloudconnexa/latest will be developed.
Please give new provider a try, hopefully it will fix your issue.
In case if problem persists - please open new "Issue" (https://github.com/OpenVPN/terraform-provider-cloudconnexa/issues)
Sorry for inconvenience.