Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_virtual_network_gateway - modifies the default properties #1817

Closed
tekollt opened this issue Aug 23, 2018 · 5 comments · Fixed by #7168
Closed

azurerm_virtual_network_gateway - modifies the default properties #1817

tekollt opened this issue Aug 23, 2018 · 5 comments · Fixed by #7168

Comments

@tekollt
Copy link

tekollt commented Aug 23, 2018

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.11.8

  • provider.azurerm v1.13.0
  • provider.null v1.0.0

Affected Resource(s)

azurerm_virtual_network_gateway

Terraform Configuration Files

resource "azurerm_virtual_network_gateway" "default" {

  name                  = "vng-we-internal-prod"
  location              = "${var.location}"
  resource_group_name   = "${var.resource_group_name}"

  type          = "${var.vngtype}"
  vpn_type      = "${var.vpntype}"
  active_active = false
  enable_bgp    = false
  sku           = "${var.vngsku}"


  ip_configuration {
    name                            = "vnetGatewayConfig"
    public_ip_address_id            = "${azurerm_public_ip.default.id}"
    private_ip_address_allocation   = "Dynamic"
    subnet_id                       = "${azurerm_subnet.GatewaySubnet.id}"
  }

   vpn_client_configuration {
    address_space = [ "10.40.1.0/24" ]  
   }
  
}

Expected Behavior

When creating an virtual network gateway, without using the root_certificate configuration, Azure automatically creates and manages the certificate.

Expected no modifications to the resources on additional runs.

Actual Behavior

When re-running terraform, it removes the automatically created certificate and other defaults.

vpn_client_configuration.0.root_certificate.#: "1" => "0"
vpn_client_configuration.0.root_certificate.24147563.name: "AppServiceCertificate.cer" => ""
vpn_client_configuration.0.root_certificate.24147563.public_cert_data: "MIIDZTCCAlGgAwIBAgIQTmeGdqSdGrFH/Kh+cVGYSDAJBgUrD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PqUu1vemXlwjvn1AInNUSO40LOaW4lXvBrFcdN/utN" => ""
vpn_client_configuration.0.vpn_client_protocols.#: "1" => "0"
vpn_client_configuration.0.vpn_client_protocols.2936918: "SSTP" => ""

Steps to Reproduce

  1. terraform apply
  • #0000
@jamielennox
Copy link

Makes sense as azure will generate the certificate on first connection rather than on creation. I tried setting it to Computed: true in the provider and didn't really work how i wanted it to.

Working around with standard:

   lifecycle {
     ignore_changes = ["vpn_client_configuration"]
   }

for now

@tesharp
Copy link
Contributor

tesharp commented Feb 14, 2019

Having same problem when defining root_certificate. Every run it tries to change the values even when I have not made any changes. It removes the old entry and then adds a new one with exact same values. Should just recognize that entry with same name already exists.

Ended up just ignoring it:

lifecycle {
    ignore_changes = [ "vpn_client_configuration.0.root_certificate" ]
  }

@Lucretius
Copy link
Contributor

@tombuildsstuff - I think this can be fixed by specifying root_certificate and vpn_client_protocols as Computed in addition to it already being Optional, so that they will be calculated if not specified and the diff will no longer be generated. Is this a correct understanding of the terraform diff algorithm? If so, I can do this work.

@katbyte
Copy link
Collaborator

katbyte commented Oct 21, 2019

@Lucretius,

that is the correct approach to take in situations like this.

@ghost
Copy link

ghost commented Jul 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Jul 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
7 participants