PaloAltoNetworks / terraform-provider-sase

Terraform provider for SASE API
Apache License 2.0
1 stars 2 forks source link

Resource build fails for sase_ipsec_tunnels when object exists: error: "Object Not Found" #9

Open ancoleman opened 1 year ago

ancoleman commented 1 year ago

Describe the bug

Error in building a resource when objects exist. The error is "object not found"

Expected behavior

Options:

  1. Reformat error with: object already exists
  2. Decision Tree on if new object with the same name but a different UUID is generated.... Something to discuss with the API team.

Current behavior

(venv) (base) acoleman@M-KGYXTTH2MF remote_networks % terraform apply --auto-approve
╷
│ Warning: Provider development overrides are in effect
│ 
│ The following provider development overrides are set in the CLI configuration:
│  - paloaltonetworks-local/sase in /Users/acoleman/Documents/Projects/PracticeDevelopment/github/terraform-provider-sase
│ 
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published releases.
╵
data.sase_bandwidth_allocations_list.this: Reading...
data.sase_remote_networks_list.before: Reading...
data.sase_ike_gateways_list.before: Reading...
data.sase_ipsec_tunnels_list.before: Reading...
module.remote_networks_with_yaml.sase_ike_crypto_profiles.this["terraform-ike-crypto-test1"]: Refreshing state... [id=Remote Networks:70f75684-81e7-46b8-acd2-359a4af9d9c2]
module.remote_networks_with_yaml.sase_ike_crypto_profiles.this["terraform-ike-crypto-test2"]: Refreshing state... [id=Remote Networks:761f620d-3496-4489-978e-c04f65a36dca]
module.remote_networks_with_yaml.sase_ipsec_crypto_profiles.this["terraform-ipsec-crypto-test1"]: Refreshing state... [id=Remote Networks:ae2bf50f-c6aa-4704-b901-818e94b197e2]
module.remote_networks_with_yaml.sase_ipsec_crypto_profiles.this["terraform-ipsec-crypto-test2"]: Refreshing state... [id=Remote Networks:098e974d-c101-4d33-9782-59e1d3261f2d]
data.sase_bandwidth_allocations_list.this: Read complete after 0s [id=0:0]
module.remote_networks_with_yaml.sase_remote_networks.this["terraform-rn-1"]: Refreshing state... [id=Remote Networks:570663d6-f81a-4887-bc34-96d77c2bf031]
module.remote_networks_with_yaml.sase_remote_networks.this["terraform-rn-2"]: Refreshing state... [id=Remote Networks:9f08fbe3-0dbf-4c80-a39e-ed72c2777590]
data.sase_remote_networks_list.before: Read complete after 0s [id=0:0::Remote Networks]
data.sase_ipsec_tunnels_list.before: Read complete after 0s [id=0:0::Remote Networks]
data.sase_ike_gateways_list.before: Read complete after 0s [id=0:0::Remote Networks]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.remote_networks_with_yaml.sase_ipsec_tunnels.this["terraform-ipsec-tunnel1"] will be created
  + resource "sase_ipsec_tunnels" "this" {
      + anti_replay              = false
      + auto_key                 = {
          + ike_gateway          = [
              + {
                  + name = "terraform-ike-1"
                },
            ]
          + ipsec_crypto_profile = "Others-IPSec-Crypto-Default"
        }
      + copy_tos                 = false
      + enable_gre_encapsulation = false
      + folder                   = "Remote Networks"
      + id                       = (known after apply)
      + name                     = "terraform-ipsec-tunnel1"
      + object_id                = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.
module.remote_networks_with_yaml.sase_ipsec_tunnels.this["terraform-ipsec-tunnel1"]: Creating...
╷
│ Error: Error in create
│ 
│   with module.remote_networks_with_yaml.sase_ipsec_tunnels.this["terraform-ipsec-tunnel1"],
│   on ../../modules/remote_networks/main.tf line 56, in resource "sase_ipsec_tunnels" "this":
│   56: resource "sase_ipsec_tunnels" "this" {
│ 
│ object not found
╵

Possible solution

Review expected behavior options.

Steps to reproduce

  1. Create resource either with different state or in UI
  2. Try to create a new resource with a fresh state but the name of the resource stays the same.

Screenshots

Context

I am trying to build a new IPsec tunnel, but if the tunnel name is already taken a failure is presented.

Your Environment