CheckPointSW / terraform-provider-checkpoint

Terraform provider for Check Point
https://www.terraform.io/docs/providers/checkpoint/
Mozilla Public License 2.0
28 stars 40 forks source link

Resources 500 Server Error #55

Closed biderise closed 3 years ago

biderise commented 3 years ago

Hello,

We are using the terraform resources "checkpoint_management_add_updatable_object" and "checkpoint_management_add_data_center_object" but when an object has already imported then we take the error below:

Error: failed to execute API call
Status: 500 Server Error
Code: generic_error
Message: Object is already imported. please use the existing object

IIs this an error with the resource or with our configuration?

Regards, Vangelis

chkp-royl commented 3 years ago

Hi @biderise, The mentioned resources are consider as 'command resource' and used only to create new resource but cannot be modified since they have no set API call.

Thanks, Roy

biderise commented 3 years ago

Hi Roy,

We don't try to update an "updatable_object" or "data_center_object". The objects have already created. When we run terraform apply to make another change then we take the "500 Server Error". How can this error not show up?

Regards, Vangelis

chkp-royl commented 3 years ago

Hi @biderise , If the objects have already created why do you think it's related to them? Maybe it's show up because of the other changes you try to make? It's hard for me to tell if the error is with the resource or with your configuration. I need to see logs in order to understand why that's happen.

Thanks, Roy

biderise commented 3 years ago

Hi Roy,

We have created a Terraform project with the resources "checkpoint_management_add_updatable_object" and "checkpoint_management_add_data_center_object". When we run the command "terraform apply" for the first time, there is not any alarm or error and the resources work fine. When we run again the command "terraform apply", the "500 Server Error" shows up. There are not any changes on .tf or .tfvars files and we don't try to add new objects. According the error, the resources "checkpoint_management_add_updatable_object" and "checkpoint_management_add_data_center_object" don't check if the objects exist and try to create them again.

Regards, Vangelis

chkp-royl commented 3 years ago

Hi @biderise, I tried to reproduce this issue but I get no error like you said and the second 'terraform apply' run ok for me. Maybe error related to your configuration and not to the resource. If you want you can enable debugging and send me logs to royl@checkpoint.com for further investigation.

Here is my test: image

Thanks, Roy

biderise commented 3 years ago

Hi Roy,

We have created the updatable object manual and then we try to create this with terraform. Because the updatable object exists on Checkpoint, terraform shows up this error and doesn’t add the object in tfstate file. We add the object with “terraform import” command and works fine.

One more question: the only way to create tfstate of an existing checkpoint is with the command “terraform import”. With “terraform import”, we have to add the state of the objects one by one. Is there any better/sooner way to import all the objects’ state?

Regards, Vangelis

chkp-royl commented 3 years ago

Hi @biderise , Happy to hear that :) The current implementation of Terraform import can only import resources into the state. It does not generate configuration. A future version of Terraform will also generate configuration. This thing is known for us and need to wait for Terraform to support that feature. You may ask them as well. See here: https://www.terraform.io/docs/import/index.html

Thanks, Roy