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

Wrong type for id when modifying or destroying a nameserver_record resource #7

Closed
ygabuev opened this issue Feb 22, 2023 · 1 comment · Fixed by #8
Closed

Wrong type for id when modifying or destroying a nameserver_record resource #7

ygabuev opened this issue Feb 22, 2023 · 1 comment · Fixed by #8
Assignees
Labels
bug Something isn't working

Comments

@ygabuev
Copy link

ygabuev commented Feb 22, 2023

Hello!

I am getting errors when trying to modify the inwx_nameserver_record resource that was created by using this plugin. The error implies that the id parameter that is sent to the INWX API doesn't have the correct type, which should be int or maybe an array of ints for some cases.

My versions are

[~/terraform_project] terraform version
Terraform v1.3.9
on linux_amd64
+ provider registry.terraform.io/inwx/inwx v1.2.0

To reproduce, do the following. We create a CNAME record for hello.domain.com with value example.org.

  1. Have a configuration similar to this:
provider "inwx" {
  username = "user@domain.com"
  password = "password"
}

resource "inwx_nameserver_record" "record" {
  domain  = "domain.com"
  type    = "CNAME"
  name    = "hello"
  content = "example.org"
}
  1. Run terraform apply, verify that the record is created.
  2. Modify the record resource or remove it from configuration, run terraform apply again.

I am getting the following error when destroying the resource:

inwx_nameserver_record.record: Destroying... [id=domain.com:1012250634]
╷
│ Error: Could not delete nameserver record
│
│ API response not status code 1000 pr 1001. Got response:
│ {"code":2005,"msg":"Parameter value syntax error","reason":"The given parameter
│ value for 'id' does not match the expected parameter type
│ 'int'","reasonCode":"The given parameter value for 'id' does not match the
│ expected parameter type 'int'"}

When changing the name (suggests an in-place update):

inwx_nameserver_record.record: Modifying... [id=domain.com:1012250634]
╷
│ Error: Could not update nameserver record
│
│   with inwx_nameserver_record.record,
│   on main.tf line 792, in resource "inwx_nameserver_record" "record":
│  792: resource "inwx_nameserver_record" "record" {
│
│ API response not status code 1000. Got response: {"code":2005,"msg":"Parameter
│ value syntax error","reason":"The given parameter value for 'id' does not match
│ the expected parameter type 'array_int'","reasonCode":"The given parameter value
│ for 'id' does not match the expected parameter type 'array_int'"}

When changing the content, the error message is that same as when changing the name.

Thank you!

@ygabuev
Copy link
Author

ygabuev commented Feb 22, 2023

It seems to me that this is the result of a bug in the code - when modifying a resource, the client doesn't process the id field that is stored in the resource state and sends the id as domain.com:12345678 instead of 12345678.

@fsoederhuyzen fsoederhuyzen self-assigned this Feb 22, 2023
@fsoederhuyzen fsoederhuyzen added the bug Something isn't working label Feb 22, 2023
fsoederhuyzen added a commit that referenced this issue Feb 22, 2023
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

Successfully merging a pull request may close this issue.

2 participants