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

Refreshing state problem #52

Open
zahornyak opened this issue Sep 18, 2023 · 4 comments
Open

Refreshing state problem #52

zahornyak opened this issue Sep 18, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@zahornyak
Copy link

Currently when you create resources using Terraform and delete them on UI, terraform will give an error like this:

╷
│ Error: Non-200 response on getting the organization
│ body=500: Internal Server Error
│ 
│   with module.test_org.pritunl_organization.this,
│   on ../../modules/pritunl_org/main.tf line 1, in resource "pritunl_organization" "this":
│    1: resource "pritunl_organization" "this" {
│ 
╵
@disc
Copy link
Owner

disc commented Sep 19, 2023

Hey @zahornyak. It looks weird and strange, but for non-exists resources, foe example organizations, Pritunl API returns status code 500 (internal server error) instead of 404 (not found):

when I directly make a HTTP requests
image

or do an import of an organizations that doesn't exist

terraform import pritunl_organization.guests abcd123
pritunl_organization.guests: Importing from ID "abcd123"...
pritunl_organization.guests: Import prepared!
  Prepared pritunl_organization for import
pritunl_organization.guests: Refreshing state... [id=abcd123]
╷
│ Error: Non-200 response on getting the organization
│ body=500: Internal Server Error
│
│

@disc
Copy link
Owner

disc commented Sep 19, 2023

I faced with an issue when I started working on the provider, but didn't find a solution. Probably I will look into it again.

@disc disc added the bug Something isn't working label Sep 19, 2023
@QuentinBtd
Copy link
Contributor

Hello,

I got the same issue with server resource:

│ Error: Error on starting server: Non-200 response on starting the server
│ body=500: Internal Server Error
│ 
│   with pritunl_server.server["my_server"],
│   on main.tf line 15, in resource "pritunl_server" "server":15: resource "pritunl_server" "server" {

Maybe a retry could be added and configured in the provider declaration?

@disc
Copy link
Owner

disc commented Sep 27, 2023

Unfortunately, the issue reproduces with various resources (servers and organizations) due to a possible issue in the Pritunl servers API. It has no validation if a requested resource does exist and it fails on a json-marshaling stage of a nil object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants