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

Common tenant is trying to be updated without modification in the json file #869

Closed
Cesar-EF opened this issue Sep 13, 2023 · 1 comment · Fixed by #932
Closed

Common tenant is trying to be updated without modification in the json file #869

Cesar-EF opened this issue Sep 13, 2023 · 1 comment · Fixed by #932
Labels
Backlog issue will be tracked by JIRA in backlog bug
Milestone

Comments

@Cesar-EF
Copy link

Environment

  • TMOS/Bigip Version: 3.46.0
  • Terraform Version: 1.3.7, 1.5.7
  • Terraform bigip provider Version: v.1.19.0

Summary

Common tenant tries to update after second run of terraform apply.

Steps To Reproduce

Steps to reproduce the behavior:

Example of resource config:

terraform {
  required_providers {
    bigip = {
      source = "F5Networks/bigip"
      version = "1.19.0"
    }
  }
  required_version = "= 1.5.7"
}

provider "bigip" {
  address  = "10.2.3.4"
  username = "user"
  password = "pass"
}
resource "bigip_as3" "exampletask" {
  as3_json       = "${file("test.json")}"
}

Run:
terraform apply
Result: It successfully created the resources:
Plan: 1 to add, 0 to change, 0 to destroy.

Example of json that creates A GSLB wide IP (domain) named example.edu. Example json taken from this documentation:
https://clouddocs.f5.com/products/extensions/f5-appsvcs-extension/latest/declarations/gslb.html

{
    "class": "AS3",
    "action": "deploy",
    "persist": true,
    "declaration": 
    {
        "class": "ADC",
        "schemaVersion": "3.37.0",
        "id": "GSLB_Sample",
        "Sample_non_http_05": {
            "class": "Tenant",
            "Application": {
                "class": "Application",
                "testDomain": {
                    "class": "GSLB_Domain",
                    "domainName": "example.edu",
                    "aliases": [
                        "another.example*" ],
                    "resourceRecordType": "A",
                    "poolLbMode": "ratio",
                    "pools": [
                        {
                            "ratio": 2,
                            "use": "testPool"
                        },
                        {
                            "ratio": 3,
                            "use": "testPool2"
                        }
                    ],
                    "iRules": [
                        "testGSLB_iRule"
                    ]
                },
                "testPool": {
                   "class": "GSLB_Pool",
                    "enabled": false,
                    "lbModeAlternate": "ratio",
                    "lbModeFallback": "ratio",
                    "manualResumeEnabled": true,
                    "verifyMemberEnabled": false,
                    "qosHitRatio": 10,
                    "qosHops": 11,
                    "qosKbps": 8,
                    "qosLinkCapacity": 35,
                    "qosPacketRate": 5,
                    "qosRoundTripTime": 75,
                    "qosTopology": 3,
                    "qosVirtualServerCapacity": 2,
                    "qosVirtualServerScore": 1,
                    "members": [
                        {
                            "ratio": 10,
                            "server": {
                                "use": "/Common/Shared/testServer"
                            },
                            "virtualServer": "0"
                        }
                    ],
                    "bpsLimit": 5,
                    "bpsLimitEnabled": true,
                    "ppsLimit": 4,
                    "ppsLimitEnabled": true,
                    "connectionsLimit": 3,
                    "connectionsLimitEnabled": true,
                    "maxAnswersReturned": 10,
                    "monitors": [
                        {
                            "bigip": "/Common/http"
                        },
                        {
                            "bigip": "/Common/https"
                        }
                    ],
                    "resourceRecordType": "A",
                    "fallbackIP": "1.1.1.1"
                },
                "testPool2": {
                    "class": "GSLB_Pool",
                    "resourceRecordType": "A"
                },
                "testGSLB_iRule": {
                    "class": "GSLB_iRule",
                    "iRule": {
                        "base64": "d2hlbiBETlNfUkVRVUVTVCB7CiAgICBsb2cgbG9jYWwyLiAiR1RNIGlydWxlOiBBIEROUyByZXF1ZXN0IHdhcyBzZWVuIGZvciBbRE5TOjpxdWVzdGlvbiBuYW1lXSBzZWVuIGZyb20gW0lQOjpjbGllbnRfYWRkcl0iCn0="
                    }
                }
            }
        },
        "Common": {
            "class": "Tenant",
            "Shared": {
                "class": "Application",
                "template": "shared",
                "testDataCenter": {
                    "class": "GSLB_Data_Center"
                },
                "testProberPool": {
                    "class": "GSLB_Prober_Pool",
                    "enabled": true,
                    "lbMode": "round-robin",
                    "members": [
                        {
                            "server": {
                                "use": "testServer"
                            },
                            "memberOrder": 0
                        }
                    ]
                },
                "testServer": {
                    "class": "GSLB_Server",
                    "dataCenter": {
                        "use": "testDataCenter"
                    },
                    "devices": [
                        {
                            "address": "1.2.3.7"
                        }
                    ],
                    "proberPreferred": "pool",
                    "proberPool": {
                        "use": "testProberPool"
                    },
                    "virtualServers": [
                        {
                            "address": "1.2.3.8",
                            "port": 5050
                        },
                        {
                            "address": "2001:0db8:85a3:0000:0000:8a2e:0370:7334",
                            "port": 5051
                        }
                    ]
                }
    
            }
        }
    }
}

Expected Behavior

Terraform should not update the Common tenant since there was no changes made.

It should return:

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

Apply complete! Resources: 0 added, 0 changed, 0 destroyed

Actual Behavior

Run again with no modification in the json file:
terraform apply
Result is trying to update the Common tenant:

bigip_as3.exampletask: Refreshing state... [id=Sample_non_http_05,Common]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # bigip_as3.exampletask will be updated in-place
  ~ resource "bigip_as3" "exampletask" {
      ~ as3_json         = jsonencode(
          ~ {
              ~ declaration = {
                  + Common             = {
                      + Shared = {
                          + class          = "Application"
                          + template       = "shared"
                          + testDataCenter = {
                              + class = "GSLB_Data_Center"
                            }
                          + testProberPool = {
                              + class   = "GSLB_Prober_Pool"
                              + enabled = true
                              + lbMode  = "round-robin"
                              + members = [
                                  + {
                                      + memberOrder = 0
                                      + server      = {
                                          + use = "testServer"
                                        }
                                    },
                                ]
                            }
                          + testServer     = {
                              + class           = "GSLB_Server"
                              + dataCenter      = {
                                  + use = "testDataCenter"
                                }
                              + devices         = [
                                  + {
                                      + address = "1.2.3.7"
                                    },
                                ]
                              + proberPool      = {
                                  + use = "testProberPool"
                                }
                              + proberPreferred = "pool"
                              + virtualServers  = [
                                  + {
                                      + address = "1.2.3.8"
                                      + port    = 5050
                                    },
                                  + {
                                      + address = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
                                      + port    = 5051
                                    },
                                ]
                            }
                        }
                      + class  = "Tenant"
                    }
                    id                 = "GSLB_Sample"
                    # (3 unchanged attributes hidden)
                }
                # (3 unchanged attributes hidden)
            }
        )
        id               = "Sample_non_http_05,Common"
        # (4 unchanged attributes hidden)
    }

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

Example of tfstate file where the Common tenant resource is not being added.

{
  "version": 4,
  "terraform_version": "1.5.7",
  "serial": 1,
  "lineage": "cfc30d60-768a-dee7-ba59-9b63f59a4ebf",
  "outputs": {},
  "resources": [
    {
      "mode": "managed",
      "type": "bigip_as3",
      "name": "exampletask",
      "provider": "provider[\"registry.terraform.io/f5networks/bigip\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "application_list": "Application,Shared",
            "as3_json": "{\"action\":\"deploy\",\"class\":\"AS3\",\"declaration\":{\"Sample_non_http_05\":{\"Application\":{\"class\":\"Application\",\"testDomain\":{\"aliases\":[\"another.example*\"],\"class\":\"GSLB_Domain\",\"domainName\":\"example.edu\",\"iRules\":[\"testGSLB_iRule\"],\"poolLbMode\":\"ratio\",\"pools\":[{\"ratio\":2,\"use\":\"testPool\"},{\"ratio\":3,\"use\":\"testPool2\"}],\"resourceRecordType\":\"A\"},\"testGSLB_iRule\":{\"class\":\"GSLB_iRule\",\"iRule\":{\"base64\":\"d2hlbiBETlNfUkVRVUVTVCB7CiAgICBsb2cgbG9jYWwyLiAiR1RNIGlydWxlOiBBIEROUyByZXF1ZXN0IHdhcyBzZWVuIGZvciBbRE5TOjpxdWVzdGlvbiBuYW1lXSBzZWVuIGZyb20gW0lQOjpjbGllbnRfYWRkcl0iCn0=\"}},\"testPool\":{\"bpsLimit\":5,\"bpsLimitEnabled\":true,\"class\":\"GSLB_Pool\",\"connectionsLimit\":3,\"connectionsLimitEnabled\":true,\"enabled\":false,\"fallbackIP\":\"1.1.1.1\",\"lbModeAlternate\":\"ratio\",\"lbModeFallback\":\"ratio\",\"manualResumeEnabled\":true,\"maxAnswersReturned\":10,\"members\":[{\"ratio\":10,\"server\":{\"use\":\"/Common/Shared/testServer\"},\"virtualServer\":\"0\"}],\"monitors\":[{\"bigip\":\"/Common/http\"},{\"bigip\":\"/Common/https\"}],\"ppsLimit\":4,\"ppsLimitEnabled\":true,\"qosHitRatio\":10,\"qosHops\":11,\"qosKbps\":8,\"qosLinkCapacity\":35,\"qosPacketRate\":5,\"qosRoundTripTime\":75,\"qosTopology\":3,\"qosVirtualServerCapacity\":2,\"qosVirtualServerScore\":1,\"resourceRecordType\":\"A\",\"verifyMemberEnabled\":false},\"testPool2\":{\"class\":\"GSLB_Pool\",\"resourceRecordType\":\"A\"}},\"class\":\"Tenant\"},\"class\":\"ADC\",\"id\":\"GSLB_Sample\",\"schemaVersion\":\"3.37.0\"},\"persist\":true}",
            "id": "Sample_non_http_05,Common",
            "ignore_metadata": false,
            "task_id": "cc99cd3b-d8f4-47d4-93a4-795a34410612",
            "tenant_filter": null,
            "tenant_list": "Sample_non_http_05,Common",
            "tenant_name": null
          },
          "sensitive_attributes": [],
          "private": "bnVsbA=="
        }
      ]
    }
  ],
  "check_results": null
}

@Cesar-EF Cesar-EF added the bug label Sep 13, 2023
@Cesar-EF Cesar-EF changed the title Common tenant is trying to be recreated without modification in the json file Common tenant is trying to be updated without modification in the json file Sep 13, 2023
@pgouband
Copy link
Collaborator

Hi,

Thanks for reporting. Added to the backlog and internal tracking ID for this request is: INFRAANO-1414.

@pgouband pgouband added Backlog issue will be tracked by JIRA in backlog and removed In Review labels Jan 15, 2024
@RavinderReddyF5 RavinderReddyF5 added this to the v1.21.0 milestone Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backlog issue will be tracked by JIRA in backlog bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants