F5Networks / terraform-provider-bigip

Terraform resources that can configure F5 BIG-IP products
https://registry.terraform.io/providers/F5Networks/bigip/latest/docs
Mozilla Public License 2.0
103 stars 119 forks source link

Unable to create resource 'bigip_ltm_policy' with 'published_copy' attribute. #856

Closed kloveday2 closed 11 months ago

kloveday2 commented 1 year ago

Environment

Summary

Unable to create resource 'bigip_ltm_policy' with 'published_copy' attribute. It will create it in draft form but fails to create it as published and errors out.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Provide terraform resource config which you are facing trouble along with the output of it.
    
    resource "bigip_ltm_pool" "mypool" {
    name                = "/Common/test-pool"
    allow_nat           = "yes"
    allow_snat          = "yes"
    load_balancing_mode = "round-robin"

} resource "bigip_ltm_policy" "test-policy" { name = "/Common/test-policy" strategy = "first-match" requires = ["http"] controls = ["forwarding"] published_copy = "Shared/test-policy" rule { name = "rule6" action { forward = true connection = false pool = bigip_ltm_pool.mypool.name } }

depends_on = [bigip_ltm_pool.mypool] }


2. To get to know more about the issue, provide terraform debug logs

3. To capture debug logs, export TF_LOG variable with debug ( export TF_LOG= DEBUG ) before 
  runnning terraform apply/plan

2023-08-28T17:47:21.257Z [INFO] provider.terraform-provider-bigip_v1.19.0: Initializing BigIP connection: timestamp=2023-08-28T17:47:21.257Z 2023-08-28T17:47:24.159Z [INFO] Starting apply for bigip_ltm_policy.test-policy 2023-08-28T17:47:24.159Z [DEBUG] bigip_ltm_policy.test-policy: applying the planned Create change 2023-08-28T17:47:24.162Z [INFO] provider.terraform-provider-bigip_v1.19.0: Creating Policy : test-policy in partion : /Common: timestamp=2023-08-28T17:47:24.162Z 2023-08-28T17:47:24.300Z [ERROR] vertex "bigip_ltm_policy.test-policy" error: 01020036:3: The requested Policy (/Common/Shared/test-policy) was not found.



### Expected Behavior
I believe it is expected to finish creating the policy and publish it

### Actual Behavior
It will create the policy in draft form and save it. However it never leaves draft and publishes it.
Further applies note that the draft already exists. It must be deleted before another apply attempt can be made.
The policy never reaches published state.
pgouband commented 1 year ago

Hi,

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

kloveday2 commented 1 year ago

FWIW, Tested on BIG-IP v16 with the same behavior.

Main Package Product BIG-IP Version 16.1.4 Build 0.0.2 Edition Final

urohit011 commented 1 year ago

The published_copy is not required anymore and will be deprecated in future release. This is because the resource now automatically creates published policy without needing the published_copy. But if you still want to use the attribute before it's removed from the resource, the correct value for published_copy should be like Drafts/<policy_name>.

kloveday2 commented 1 year ago

Ah, okay. The documentation threw me for a loop as it was once required.

published_copy - (Optional) If you want to publish the policy else it will be deployed in Drafts mode.

Confirmed that it will publish the policy without 'published_copy' and it is useable.

urohit011 commented 1 year ago

Yes @kloveday2, I confirm it'll publish the policy without using the publish_copy attribute. I'll also update the document very soon

RavinderReddyF5 commented 11 months ago

hi @kloveday2, documentation updated for published_copy - (Deprecated) If you want to publish the policy else it will be deployed in Drafts mode. This attribute is deprecated and will be removed in a future release.

please open new issue for any problem noticed