ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
832 stars 1.53k forks source link

Terraform: better diff on check mode (show the hostname) #8564

Open GuillaumeSeren opened 4 months ago

GuillaumeSeren commented 4 months ago

Summary

Hey, thank you for this nice project, I think it is very useful.

From #7896 the terraform module now display a nice diff for the check mode, it is nice, but if you compare to the terraform plan output you can see we are dropping the hostname of the element:

...                                                                                                                                                               
Terraform will perform the following actions:                                                                                                                                               

  # module.containers.proxmox_virtual_environment_container.container["hidden_hostname_1"] will be updated in-place
  ~ resource "proxmox_virtual_environment_container" "container" {
        id            = "104"
        tags          = [
            "ct",
            "pp",
        ]
        # (7 unchanged attributes hidden)

      ~ cpu {
          ~ cores        = 4 -> 3
            # (2 unchanged attributes hidden)
        }

      ~ memory {
          ~ swap      = 8192 -> 1024
            # (1 unchanged attribute hidden)
        }

        # (5 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

And this is the output, when running throught the terraform module in check_mode:

...
TASK [Apply Terraform plan] ****************************************************************************************************************************************************************
--- before
+++ after
@@ -7,7 +7,7 @@
                 "cpu": [
                     {
                         "architecture": "amd64",
-                        "cores": 4,
+                        "cores": 3,
                         "units": 1024
                     }
                 ],
@@ -60,7 +60,7 @@
                 "memory": [
                     {
                         "dedicated": 50144,
-                        "swap": 8192
+                        "swap": 1024
                     }
                 ],
                 "mount_point": [],

changed: [localhost]

So it would be nice addition to get the hidden_hostname_1 as we can get from terraform command itself, would you be interested for a patch around this ?

Issue Type

Feature Idea

Component Name

terraform

Code of Conduct

ansibullbot commented 4 months ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 4 months ago

cc @m-yosefpor @rainerleber click here for bot help