RavinderReddyF5 / terraform-provider-bigip-version0.12

Terraform resources that can configure F5 BIGIP products
Mozilla Public License 2.0
0 stars 0 forks source link

[CLOSED] fix for Unable to modify/update data group #248 #288

Open RavinderReddyF5 opened 4 years ago

RavinderReddyF5 commented 4 years ago

Issue by papineni87 Tuesday Mar 17, 2020 at 12:14 GMT Originally opened as https://github.com/terraform-providers/terraform-provider-bigip/pull/257


To update data groups "type" is needed from bigip version 14 onwards. Check bigip version before update call , if it is bigip version 12,13 don't send type in api request call, and if it is bigip version 14 + , send type in api request.

Tested in bigip versions 12,13,14.


papineni87 included the following code: https://github.com/terraform-providers/terraform-provider-bigip/pull/257/commits

RavinderReddyF5 commented 4 years ago

Comment by papineni87 Wednesday Mar 18, 2020 at 03:01 GMT


Test logs:

Bigip version 12:

An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols: ~ update in-place

Terraform will perform the following actions:

bigip_ltm_datagroup.datagroup will be updated in-place

~ resource "bigip_ltm_datagroup" "datagroup" { id = "/Common/test-datagroup" name = "/Common/test-datagroup" type = "string" 2020/03/17 05:02:47 [DEBUG] command: asking for input: "Do you want to perform these actions?"

    record {
        data = "/core145"
        name = "/core145"
    }
  - record {
      - data = "/testing146" -> null
      - name = "/testing146" -> null
    }
  + record {
      + data = "/testing147"
      + name = "/testing147"
    }
}

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

Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve.

Enter a value: yes

2020/03/17 05:02:51 [INFO] backend/local: apply calling Apply 2020/03/17 05:02:51 [INFO] terraform: building graph: GraphTypeApply 2020/03/17 05:02:51 [DEBUG] ProviderTransformer: "bigip_ltm_datagroup.datagroup (prepare state)" (terraform.NodeApplyableResource) needs provider.bigip 2020/03/17 05:02:51 [DEBUG] ReferenceTransformer: "bigip_ltm_datagroup.datagroup (prepare state)" references: [] 2020/03/17 05:02:51 [DEBUG] ReferenceTransformer: "bigip_ltm_datagroup.datagroup" references: [] 2020/03/17 05:02:51 [DEBUG] ReferenceTransformer: "provider.bigip" references: [] 2020/03/17 05:02:51 [DEBUG] Starting graph walk: walkApply 2020-03-17T05:02:51.497-0700 [INFO] plugin: configuring client automatic mTLS 2020-03-17T05:02:51.535-0700 [DEBUG] plugin: starting plugin: path=/root/go/bin/terraform-provider-bigip args=[/root/go/bin/terraform-provider-bigip] 2020-03-17T05:02:51.537-0700 [DEBUG] plugin: plugin started: path=/root/go/bin/terraform-provider-bigip pid=22704 2020-03-17T05:02:51.537-0700 [DEBUG] plugin: waiting for RPC address: path=/root/go/bin/terraform-provider-bigip 2020-03-17T05:02:51.548-0700 [INFO] plugin.terraform-provider-bigip: configuring server automatic mTLS: timestamp=2020-03-17T05:02:51.548-0700 2020-03-17T05:02:51.580-0700 [DEBUG] plugin: using plugin: version=5 2020-03-17T05:02:51.580-0700 [DEBUG] plugin.terraform-provider-bigip: plugin address: address=/tmp/plugin847984706 network=unix timestamp=2020-03-17T05:02:51.580-0700 2020/03/17 05:02:51 [TRACE] BuiltinEvalContext: Initialized "bigip" provider for provider.bigip 2020/03/17 05:02:51 [TRACE] : eval: terraform.EvalNoop 2020/03/17 05:02:51 [TRACE] : eval: terraform.EvalNoop 2020/03/17 05:02:51 [TRACE] : eval: terraform.EvalOpFilter 2020/03/17 05:02:51 [TRACE] : eval: terraform.EvalSequence 2020/03/17 05:02:51 [TRACE] : eval: terraform.EvalGetProvider 2020/03/17 05:02:51 [TRACE] : eval: terraform.EvalOpFilter 2020/03/17 05:02:51 [TRACE] : eval: terraform.EvalSequence 2020/03/17 05:02:51 [TRACE] : eval: *terraform.EvalConfigProvider 2020/03/17 05:02:51 [TRACE] buildProviderConfig for provider.bigip: using explicit config only 2020/03/17 05:02:51 [TRACE] GRPCProvider: GetSchema 2020-03-17T05:02:51.682-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/17 05:02:51 [INFO] Initializing BigIP connection bigip_ltm_datagroup.datagroup: Modifying... [id=/Common/test-datagroup] 2020-03-17T05:02:51.751-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/17 05:02:51 [DEBUG] Modifying Data Group List /Common/test-datagroup 2020-03-17T05:02:51.757-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/17 05:02:51 [DEBUG] Bigip version is : [12] 2020-03-17T05:02:51.796-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/17 05:02:51 [DEBUG] Retrieving Data Group List /Common/test-datagroup bigip_ltm_datagroup.datagroup: Modifications complete after 0s [id=/Common/test-datagroup] 2020-03-17T05:02:51.809-0700 [DEBUG] plugin: plugin process exited: path=/root/go/bin/terraform-provider-bigip pid=22704 2020-03-17T05:02:51.809-0700 [DEBUG] plugin: plugin exited 2020/03/17 05:02:51 [TRACE] [walkApply] Exiting eval tree: provider.bigip (close) 2020/03/17 05:02:51 [TRACE] vertex "provider.bigip (close)": visit complete 2020/03/17 05:02:51 [TRACE] dag/walk: visiting "root" 2020/03/17 05:02:51 [TRACE] vertex "root": starting visit (terraform.graphNodeRoot) 2020/03/17 05:02:51 [TRACE] vertex "root": visit complete 2020/03/17 05:02:51 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old

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

Big Version 13:

Terraform will perform the following actions:

bigip_ltm_datagroup.datagroup will be updated in-place

~ resource "bigip_ltm_datagroup" "datagroup" { id = "/Common/test-datagroup" name = "/Common/test-datagroup" type = "string"

    record {
        data = "/core"
        name = "/core"
    }
  - record {
      - data = "/testing13" -> null
      - name = "/testing13" -> null
    }
  + record {
      + data = "/testing1313"
      + name = "/testing1313"
    }
}

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

Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve.

2020/03/16 03:17:41 [DEBUG] command: asking for input: "Do you want to perform these actions?" Enter a value: yes

2020/03/16 03:17:43 [INFO] backend/local: apply calling Apply 2020/03/16 03:17:43 [INFO] terraform: building graph: GraphTypeApply 2020/03/16 03:17:43 [DEBUG] ProviderTransformer: "bigip_ltm_datagroup.datagroup" (*terraform.NodeApplyableResourceInstance) needs provider.bigip 2020/03/16 03:17:43 [DEBUG] ReferenceTransformer: "bigip_ltm_datagroup.datagroup (prepare state)" references: [] 2020/03/16 03:17:43 [DEBUG] ReferenceTransformer: "bigip_ltm_datagroup.datagroup" references: [] 2020/03/16 03:17:43 [DEBUG] ReferenceTransformer: "provider.bigip" references: [] 2020/03/16 03:17:43 [DEBUG] Starting graph walk: walkApply 2020-03-16T03:17:43.391-0700 [INFO] plugin: configuring client automatic mTLS 2020-03-16T03:17:43.426-0700 [DEBUG] plugin: starting plugin: path=/root/go/src/github.com/terraform-providers/terraform-provider-bigip/terraform-provider-bigip args=[/root/go/src/github.com/terraform-providers/terraform-provider-bigip/terraform-provider-bigip] 2020-03-16T03:17:43.426-0700 [DEBUG] plugin: plugin started: path=/root/go/src/github.com/terraform-providers/terraform-provider-bigip/terraform-provider-bigip pid=18982 2020-03-16T03:17:43.426-0700 [DEBUG] plugin: waiting for RPC address: path=/root/go/src/github.com/terraform-providers/terraform-provider-bigip/terraform-provider-bigip 2020-03-16T03:17:43.435-0700 [INFO] plugin.terraform-provider-bigip: configuring server automatic mTLS: timestamp=2020-03-16T03:17:43.435-0700 2020-03-16T03:17:43.475-0700 [DEBUG] plugin.terraform-provider-bigip: plugin address: address=/tmp/plugin854242654 network=unix timestamp=2020-03-16T03:17:43.475-0700 2020-03-16T03:17:43.476-0700 [DEBUG] plugin: using plugin: version=5 2020-03-16T03:17:43.559-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:17:43 [INFO] Initializing BigIP connection 2020-03-16T03:17:43.604-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:17:43 [DEBUG] req is :&{get net/self application/json} 2020-03-16T03:17:43.604-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:17:43 [DEBUG] resp is :{"kind":"tm:net:self:selfcollectionstate","selfLink":"https://localhost/mgmt/tm/net/self?ver=13.1.0"} bigip_ltm_datagroup.datagroup: Modifying... [id=/Common/test-datagroup] 2020/03/16 03:17:43 [DEBUG] bigip_ltm_datagroup.datagroup: applying the planned Update change 2020-03-16T03:17:43.611-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:17:43 [DEBUG] Modifying Data Group List /Common/test-datagroup 2020-03-16T03:17:43.623-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:17:43 [DEBUG] req is :&{get mgmt/tm/cli/version application/json} 2020-03-16T03:17:43.623-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:17:43 [DEBUG] resp is :{"kind":"tm:cli:version:versionstats","selfLink":"https://localhost/mgmt/tm/cli/version?ver=13.1.0","entries":{"https://localhost/mgmt/tm/cli/version/0":{"nestedStats":{"entries":{"active":{"description":"13.1.0"},"latest":{"description":"13.1.0"},"supported":{"description":"{ 11.5.0 11.5.1 11.5.2 11.5.3 11.5.4 11.6.0 11.6.1 12.0.0 12.1.0 12.1.1 12.1.2 13.0.0 13.1.0 }"}}}}}} 2020-03-16T03:17:43.624-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:17:43 [DEBUG] bigip version is :13.1.0 2020-03-16T03:17:43.624-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:17:43 [DEBUG] Modifying Data group records &{/Common/test-datagroup 0 [{/testing1313 /testing1313} {/core /core}]} 2020-03-16T03:17:43.624-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:17:43 put, body is &{/Common/test-datagroup 0 [{/testing1313 /testing1313} {/core /core}]} 2020-03-16T03:17:43.624-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:17:43 put, marshllJson is [123 34 110 97 109 101 34 58 34 47 67 111 109 109 111 110 47 116 101 115 116 45 100 97 116 97 103 114 111 117 112 34 44 34 114 101 99 111 114 100 115 34 58 91 123 34 110 97 109 101 34 58 34 47 116 101 115 116 105 110 103 49 51 49 51 34 44 34 100 97 116 97 34 58 34 47 116 101 115 116 105 110 103 49 51 49 51 34 125 44 123 34 110 97 109 101 34 58 34 47 99 111 114 101 34 44 34 100 97 116 97 34 58 34 47 99 111 114 101 34 125 93 125 10] 2020-03-16T03:17:43.624-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:17:43 in put req is : &{put ltm/data-group/internal/~Common~test-datagroup {"name":"/Common/test-datagroup","records":[{"name":"/testing1313","data":"/testing1313"},{"name":"/core","data":"/core"}]} application/json} 2020-03-16T03:17:43.912-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:17:43 [DEBUG] Retrieving Data Group List /Common/test-datagroup 2020-03-16T03:17:43.923-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:17:43 [DEBUG] req is :&{get ltm/data-group/internal/~Common~test-datagroup application/json} 2020-03-16T03:17:43.923-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:17:43 [DEBUG] resp is :{"kind":"tm:ltm:data-group:internal:internalstate","name":"test-datagroup","partition":"Common","fullPath":"/Common/test-datagroup","generation":13,"selfLink":"https://localhost/mgmt/tm/ltm/data-group/internal/~Common~test-datagroup?ver=13.1.0","type":"string","records":[{"name":"/core","data":"/core"},{"name":"/testing1313","data":"/testing1313"}]} bigip_ltm_datagroup.datagroup: Modifications complete after 0s [id=/Common/test-datagroup] 2020-03-16T03:17:43.929-0700 [DEBUG] plugin: plugin process exited: path=/root/go/src/github.com/terraform-providers/terraform-provider-bigip/terraform-provider-bigip pid=18982 2020-03-16T03:17:43.929-0700 [DEBUG] plugin: plugin exited 2020/03/16 03:17:43 [TRACE] [walkApply] Exiting eval tree: provider.bigip (close)

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

Bigip version 14: Terraform will perform the following actions:

2020/03/16 03:19:46 [DEBUG] command: asking for input: "Do you want to perform these actions?"

bigip_ltm_datagroup.datagroup will be updated in-place

~ resource "bigip_ltm_datagroup" "datagroup" { id = "/Common/test-datagroup" name = "/Common/test-datagroup" type = "string"

    record {
        data = "/core"
        name = "/core"
    }
  - record {
      - data = "/test" -> null
      - name = "/test" -> null
    }
  + record {
      + data = "/testing1313"
      + name = "/testing1313"
    }
}

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

Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve.

Enter a value: yes

2020/03/16 03:19:51 [INFO] backend/local: apply calling Apply 2020/03/16 03:19:51 [INFO] terraform: building graph: GraphTypeApply 2020/03/16 03:19:51 [TRACE] Executing graph transform terraform.ConfigTransformer 2020/03/16 03:19:51 [TRACE] ConfigTransformer: Starting for path: 2020/03/16 03:19:51 [DEBUG] ReferenceTransformer: "bigip_ltm_datagroup.datagroup (prepare state)" references: [] 2020/03/16 03:19:51 [DEBUG] ReferenceTransformer: "bigip_ltm_datagroup.datagroup" references: [] 2020/03/16 03:19:51 [DEBUG] ReferenceTransformer: "provider.bigip" references: [] 2020/03/16 03:19:51 [TRACE] Completed graph transform terraform.ReferenceTransformer (no changes) 2020/03/16 03:19:51 [TRACE] Executing graph transform *terraform.CountBoundaryTransformer 2020-03-16T03:19:51.547-0700 [INFO] plugin: configuring client automatic mTLS 2020-03-16T03:19:51.585-0700 [DEBUG] plugin: starting plugin: path=/root/go/src/github.com/terraform-providers/terraform-provider-bigip/terraform-provider-bigip args=[/root/go/src/github.com/terraform-providers/terraform-provider-bigip/terraform-provider-bigip] 2020-03-16T03:19:51.585-0700 [DEBUG] plugin: plugin started: path=/root/go/src/github.com/terraform-providers/terraform-provider-bigip/terraform-provider-bigip pid=19052 2020-03-16T03:19:51.585-0700 [DEBUG] plugin: waiting for RPC address: path=/root/go/src/github.com/terraform-providers/terraform-provider-bigip/terraform-provider-bigip 2020-03-16T03:19:51.594-0700 [INFO] plugin.terraform-provider-bigip: configuring server automatic mTLS: timestamp=2020-03-16T03:19:51.594-0700 2020-03-16T03:19:51.628-0700 [DEBUG] plugin.terraform-provider-bigip: plugin address: network=unix address=/tmp/plugin525406009 timestamp=2020-03-16T03:19:51.628-0700 2020-03-16T03:19:51.628-0700 [DEBUG] plugin: using plugin: version=5 2020-03-16T03:19:51.723-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:19:51 [INFO] Initializing BigIP connection 2020-03-16T03:19:51.765-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:19:51 [DEBUG] req is :&{get net/self application/json} 2020-03-16T03:19:51.765-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:19:51 [DEBUG] resp is :{"kind":"tm:net:self:selfcollectionstate","selfLink":"https://localhost/mgmt/tm/net/self?ver=14.1.2","items":[]} bigip_ltm_datagroup.datagroup: Modifying... [id=/Common/test-datagroup] 2020-03-16T03:19:51.770-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:19:51 [DEBUG] Modifying Data Group List /Common/test-datagroup 2020-03-16T03:19:51.781-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:19:51 [DEBUG] req is :&{get mgmt/tm/cli/version application/json} 2020-03-16T03:19:51.781-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:19:51 [DEBUG] resp is :{"kind":"tm:cli:version:versionstats","selfLink":"https://localhost/mgmt/tm/cli/version?ver=14.1.2","entries":{"https://localhost/mgmt/tm/cli/version/0":{"nestedStats":{"entries":{"active":{"description":"14.1.2"},"latest":{"description":"14.1.2"},"supported":{"description":"{ 11.5.0 11.5.1 11.5.2 11.5.3 11.5.4 11.5.5 11.6.0 11.6.1 11.6.2 11.6.3 12.0.0 12.1.0 12.1.1 12.1.2 12.1.3 12.1.3.1 13.0.0 13.0.1 13.1.0 13.1.1 14.0.0 14.1.0 14.1.2 }"}}}}}} 2020-03-16T03:19:51.781-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:19:51 [DEBUG] bigip version is :14.1.2 2020-03-16T03:19:51.781-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:19:51 [DEBUG] Modifying Data group records &{/Common/test-datagroup 0 string [{/testing1313 /testing1313} {/core /core}]} 2020-03-16T03:19:51.782-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:19:51 put, body is &{/Common/test-datagroup 0 string [{/testing1313 /testing1313} {/core /core}]} 2020-03-16T03:19:51.782-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:19:51 put, marshllJson is [123 34 110 97 109 101 34 58 34 47 67 111 109 109 111 110 47 116 101 115 116 45 100 97 116 97 103 114 111 117 112 34 44 34 116 121 112 101 34 58 34 115 116 114 105 110 103 34 44 34 114 101 99 111 114 100 115 34 58 91 123 34 110 97 109 101 34 58 34 47 116 101 115 116 105 110 103 49 51 49 51 34 44 34 100 97 116 97 34 58 34 47 116 101 115 116 105 110 103 49 51 49 51 34 125 44 123 34 110 97 109 101 34 58 34 47 99 111 114 101 34 44 34 100 97 116 97 34 58 34 47 99 111 114 101 34 125 93 125 10] 2020-03-16T03:19:51.782-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:19:51 in put req is : &{put ltm/data-group/internal/~Common~test-datagroup {"name":"/Common/test-datagroup","type":"string","records":[{"name":"/testing1313","data":"/testing1313"},{"name":"/core","data":"/core"}]} application/json} 2020-03-16T03:19:51.880-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:19:51 [DEBUG] Retrieving Data Group List /Common/test-datagroup 2020-03-16T03:19:51.891-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:19:51 [DEBUG] req is :&{get ltm/data-group/internal/~Common~test-datagroup application/json} 2020-03-16T03:19:51.892-0700 [DEBUG] plugin.terraform-provider-bigip: 2020/03/16 03:19:51 [DEBUG] resp is :{"kind":"tm:ltm:data-group:internal:internalstate","name":"test-datagroup","partition":"Common","fullPath":"/Common/test-datagroup","generation":330,"selfLink":"https://localhost/mgmt/tm/ltm/data-group/internal/~Common~test-datagroup?ver=14.1.2","type":"string","records":[{"name":"/core","data":"/core"},{"name":"/testing1313","data":"/testing1313"}]} bigip_ltm_datagroup.datagroup: Modifications complete after 0s [id=/Common/test-datagroup] 2020-03-16T03:19:51.897-0700 [DEBUG] plugin: plugin process exited: path=/root/go/src/github.com/terraform-providers/terraform-provider-bigip/terraform-provider-bigip pid=19052 2020-03-16T03:19:51.897-0700 [DEBUG] plugin: plugin exited

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