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

Terraform does not ignore internal_domain_name_suffix on Azure #29759

Closed
AlbMor opened this issue Oct 14, 2021 · 3 comments
Closed

Terraform does not ignore internal_domain_name_suffix on Azure #29759

AlbMor opened this issue Oct 14, 2021 · 3 comments
Labels
bug new new issue not yet triaged

Comments

@AlbMor
Copy link

AlbMor commented Oct 14, 2021

Terraform Version

Terraform v1.0.9
on linux_amd64
+ provider registry.terraform.io/hashicorp/azurerm v2.65.0
If you are not running the latest version of Terraform, please try upgrading because your issue may have already been fixed.
### Terraform Configuration Files

#create the network interface
resource "azurerm_network_interface" "vm" {
  count                         = var.num_instances
  name                          = "${var.vm_hostname}-${count.index}-nic"
  resource_group_name           = data.azurerm_resource_group.vm.name
  location                      = data.azurerm_resource_group.vm.location

  ip_configuration {
    name                          = "${var.vm_hostname}-${count.index}-ip"
    subnet_id                     = var.vnet_subnet_id
    private_ip_address_allocation = "Dynamic"
  }

  lifecycle {
    ignore_changes = [
      # Ignore changes to internal_domain_name_suffix, e.g. because a management agent
      # updates these based on some ruleset managed elsewhere.
      internal_domain_name_suffix
    ]
  }

  tags = var.tags
}

Debug Output

Expected Behavior

What should have happened?
Terraform is ignoring the changes to internal_domain_name_suffix that are managed by Azure

Actual Behavior

What actually happened?
When running terrafom plan I get

# module.build_server_compute_lower.azurerm_network_interface.vm[10] has been changed
  ~ resource "azurerm_network_interface" "vm" {
        id                            = "/subscriptions/f1c77d69-f5d9-4/resourceGroups/-buildvm-rg/providers/Microsoft.Network/networkInterfaces/bldLo-10-nic"
      + internal_domain_name_suffix   = "q00govt3vp2epfsh3ypbyp3xdc.ax.internal.cloudapp.net"
        name                          = "bldLo-10-nic"
        tags                          = {
            "dfSegment" = "dri"
            "scope"     = "BuildServers"
        }
        # (10 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, the following plan may include actions to undo or respond to
these changes.

No changes. Your infrastructure matches the configuration.

Your configuration already matches the changes detected above. If you'd like to update the Terraform state to match, create and apply a refresh-only plan:
  terraform apply -refresh-only 

Steps to Reproduce

  1. terraform init
  2. terraform plan
@AlbMor AlbMor added bug new new issue not yet triaged labels Oct 14, 2021
@jbardin
Copy link
Member

jbardin commented Oct 14, 2021

Hi @AlbMor,

Thanks for filing the issue. The ignore_changes features ignore changes that would be imposed by the configuration, but this output is only reporting changes caused by the provider. This is what is meant by the "Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, ..." part of the message, implying that ignore_changes will still prevent Terraform from reverting these based on the configuration.

As for preventing this particular output, you may be interested in #28803.

Thanks!

@jbardin jbardin closed this as completed Oct 14, 2021
@AlbMor
Copy link
Author

AlbMor commented Oct 18, 2021

Hi @jbardin

What dos it mean?

shall I run terraform apply -refresh-only each time there is a change from the provider?

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug new new issue not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants