infobloxopen / terraform-provider-infoblox

Infoblox NIOS Terraform Provider
https://github.com/infobloxopen/terraform-provider-infoblox
Mozilla Public License 2.0
67 stars 77 forks source link

Error while retrieving information about DNS view '<dns_view_name>': not found #268

Closed ghost closed 6 months ago

ghost commented 1 year ago

There is a bug with latest Infoblox provider (2.2.0), while creating resource infoblox_a_record it throws below error, though it create a record we get this error. All next plan get errored unless this half created resource is removed from state.

Error: while retrieving information about DNS view '': not found

Terraform : 1.2.7 Infoblox Provider : 2.2.0

Workaround: Pin Infoblox provider to specific version 2.1 or less than 2.1.

skudriavtsev commented 1 year ago

Could you please provide some more information? At least, exact resource definition which causes the problem. Some minimal portion of configuration.

And some details about your NIOS setup: maybe the result of WAPI call to show details about network view and DNS view which are mentioned in the TF resource's configuration and are supposed to exist.

This information, of course, should be cleaned up from any sensitive and personal data and secrets.

P.S.: I do not think it is important in this case but you are using Terraform v1.2.7 while the plugin supports only v0.14, and is not guaranteed to work with other Terraform's versions.

ghost commented 1 year ago

@skudriavtsev

I am deploying below resource, though my DNS view is present with latest provider version I get error like DNS view not found. when i use older version of provider, same code works fine without any changes.

I am passing INFOBLOX_SERVER, INFOBLOX_USERNAME, INFOBLOX_PASSWORD for authentication with my Infoblox server.

resource "infoblox_a_record" "a_record" { fqdn = abc.test.com ip_addr = 10.10.80.5 dns_view = "test-internal" comment = "Managed by Terraform" }

ghost commented 1 year ago

@skudriavtsev Any update on this ??

skudriavtsev commented 1 year ago

I do not see any information from you about the results of sending WAPI requests to the Grid ('curl' tool output would be enough). Without this, it is hard to guess, what is happening.

ghost commented 1 year ago

@skudriavtsev is there any specific endpoint on which you want to perform curl ? Can you share exact command for which output you need ?

ghost commented 1 year ago

@skudriavtsev any update on this ?

ghost commented 1 year ago

I do not see any information from you about the results of sending WAPI requests to the Grid ('curl' tool output would be enough). Without this, it is hard to guess, what is happening.

does this output helps you ??

image

ghost commented 1 year ago

@skudriavtsev any update on this ?

ranjishmp commented 1 year ago

@gmi-vishal, @skudriavtsev is on vacation. he will respond as soon as he is available

rvdh commented 1 year ago

This provider is broken while this is unresolved, we also had to pin the version to 2.1.0.

skudriavtsev commented 1 year ago

@gmi-vishal

is there any specific endpoint on which you want to perform curl ?

You provided an example of resource block for static resource allocation.

During static A-record creation, there are only two operations performed by Infoblox provider: A-record CREATE and then READ; both via WAPI, the 2nd one is done by reference.

But your initial request says about dynamic A-record resource allocation: "Error: while retrieving information about DNS view '': not found". This is about DNS view's name retrieval, which corresponds to the network view, which contains the network you want to allocate an IP address from. Double-check that the network view does exist and that it contains the DNS view you want to create the A-record in.

So... I see your information is a bit inconsistent. Besides, as I did mention, we do not support Terraform version other than v0.14 so far.

skudriavtsev commented 1 year ago

@rvdh

This provider is broken while this is unresolved, we also had to pin the version to 2.1.0.

Could you please provide a bit more information about your use case?

skudriavtsev commented 1 year ago

I do not see any information from you about the results of sending WAPI requests to the Grid ('curl' tool output would be enough). Without this, it is hard to guess, what is happening.

does this output helps you ??

image

From the screenshot I can assume that you try to work not with a Grid Master node but with some other node. This use case is not supported.

ghost commented 1 year ago

@gmi-vishal

is there any specific endpoint on which you want to perform curl ?

You provided an example of resource block for static resource allocation.

During static A-record creation, there are only two operations performed by Infoblox provider: A-record CREATE and then READ; both via WAPI, the 2nd one is done by reference.

But your initial request says about dynamic A-record resource allocation: "Error: while retrieving information about DNS view '': not found". This is about DNS view's name retrieval, which corresponds to the network view, which contains the network you want to allocate an IP address from. Double-check that the network view does exist and that it contains the DNS view you want to create the A-record in.

So... I see your information is a bit inconsistent. Besides, as I did mention, we do not support Terraform version other than v0.14 so far.

@skudriavtsev I am creating a static DNS record with TF resource (infoblox_a_record), as you mentioned provider does 2 operations for this resource record creation and Read, I have observed that its able to create a record and failed while read operation. DNS view specified in TF resource is available.

This works perfect in 2.1 Infoblox provider, this functionality has break in 2.2 version.

Sorry if my information are inconsistent, if you could tell me what information you need I will share them again.

We were able to create Infoblox resource with 2.1 provider on latest TF version, 0.14 is very old are you still insisting to use older TF version only ??

Similar issue is reported by @rvdh @mirestrepo

skudriavtsev commented 1 year ago

@gmi-vishal Please provide a minimal portion of TF file which causes the issue. Specify the type of the node you use in the Terraform provider configuration, preferably, provide the configuration itself (with privacy in mind, of course).

Besides, I need exact messages from Terraform while it is executing the plan. Maybe it makes sense to turn on Terraform's debugging, for example, by specifying TF_LOG=debug environment variable.

rvdh commented 1 year ago

@rvdh

This provider is broken while this is unresolved, we also had to pin the version to 2.1.0.

Could you please provide a bit more information about your use case?

resource "infoblox_a_record" "a_record" {
  for_each = { for rr in var.resource_records : rr.fqdn => rr if rr.type == "A" }

  fqdn     = each.value.fqdn
  ip_addr  = each.value.ip_addr
  dns_view = var.dns_view
  ttl      = 300
}

var.dns_view is "Medium/High Trust".

This results in:

╷
│ Error: error while retrieving information about DNS view 'Medium/High Trust': not found
│ 
│   with module.cluster.module.infoblox.infoblox_a_record.a_record["api.dev-rvdh-10.dev.paas.local"],
│   on /home/asgard/terraform-rke/.terraform/modules/cluster.infoblox/main.tf line 1, in resource "infoblox_a_record" "a_record":
│    1: resource "infoblox_a_record" "a_record" {

Unfortunately this is all I have for now, I can try later with TF_LOG set to trace if that's needed. And as mentioned, this code works perfectly fine with 2.1.0, on terraform 1.3.7.

ghost commented 1 year ago

makes sense to turn on Terraform' s debugging, for example, by specifying TF_LOG=debug environment variable.

@skudriavtsev Please find attached debug logs from different version, also note that this provider version is broken even for TF 0.14 version.

Error : error while retrieving information about DNS view 'dns-view': not found

TF Code: ` terraform { required_providers { infoblox = { source = "infobloxopen/infoblox" version = "2.2.0" } } }

provider "infoblox" { password = "password1234$" username = "infoblox" server = "ipam.xyz.com" } resource "infoblox_a_record" "a_record" { fqdn = "test12356.xyz.com" ttl = 3600 ip_addr = "10.62.32.37" dns_view = "dns-view" comment = "Managed by Terraform" }

`

infoblox_Provider_2.2.0.log
infoblox_TF_0.14.0.log infoblox_Provider_2.1.0.log

ghost commented 1 year ago

@skudriavtsev Any update on this ?

k0da commented 1 year ago

I'm facing the same. I'm able to reproduce it with dummy golang program.

        resp, err := objMgr.GetDNSView("default")
                if err != nil {
                       fmt.Printf("Error %s\n", err)
                }

Error not found

k0da commented 1 year ago

Provider fails here: https://github.com/infobloxopen/terraform-provider-infoblox/blob/master/infoblox/resource_infoblox_a_record.go#L125

Even I can see in a UI view exists. I'm using wapi_version 2.3.1

k0da commented 1 year ago

running curl: https://<ib_host>/wapi/v2.9.7/networkview?name=default and https://<ib_host>/wapi/v2.9.7/view?name=default

Returns empty reply

k0da commented 1 year ago

solved mine by setting dnsview RO permissions

mmcelreath commented 1 year ago

solved mine by setting dnsview RO permissions

What were the specifics of your permissions solution? I'm having this issue (version 2.1 works as stated above) and I'm working with our Infoblox admins. Trying to figure out if we need to modify the permissions of the account running this.

rg-irm commented 1 year ago

solved mine by setting dnsview RO permissions

@k0da Can you provide the specifics of your permissions solution? I'm having the same issue. Thanks!

swies0wl commented 1 year ago

Administration > Administrators > Permissions > Roles > Select Role Add permission: Permission Type: DNS Permissions Resource: "the DNS View to which you require access" Resource Type: DNS View Permission: RO

xgcssch commented 7 months ago

Any progress here?

Same situation: A record is created but message is issued. Message is even issued when only the "plan" command is used.

The requesting user has no read access to the DNS View.

Best regards Sönke

akshaykagarwal277 commented 6 months ago

I am facing the same issue even with 2.5.0 version. So I think the bug/issue has been carried on to the latest version as well. When I work with 2.1.0 version, it works just fine without any issues.

JkhatriInfobox commented 6 months ago

Hi @akshaykagarwal277 ,

Thank you for your patience. After debugging the issue, it appears that the problem may be related to nios permissions.

We suspect that the user might have been created with a custom permission group where the DNS View does not have read permissions. This lack of permissions could be causing an error during the get operation.

As a solution, we recommend providing object-level permissions for all required parent and child objects. This will ensure smooth operations and prevent such issues from occurring.

Additionally, we would like to inform you that in version 2.1, the state file had a null value for the network view. To handle and maintain the network view data, version 2.2 and above has an extra call after record creation with respect to DNS View.

Please try this solution and let us know if it resolves the issue. If you continue to experience problems, provide more details so we can further assist you.

akshaykagarwal277 commented 6 months ago

Hi @akshaykagarwal277 ,

Thank you for your patience. After debugging the issue, it appears that the problem may be related to nios permissions.

We suspect that the user might have been created with a custom permission group where the DNS View does not have read permissions. This lack of permissions could be causing an error during the get operation.

As a solution, we recommend providing object-level permissions for all required parent and child objects. This will ensure smooth operations and prevent such issues from occurring.

Additionally, we would like to inform you that in version 2.1, the state file had a null value for the network view. To handle and maintain the network view data, version 2.2 and above has an extra call after record creation with respect to DNS View.

Please try this solution and let us know if it resolves the issue. If you continue to experience problems, provide more details so we can further assist you.

Hi @JkhatriInfobox , I was able to fix the issue by the solution given by @swies0wl above.

JkhatriInfobox commented 6 months ago

@akshaykagarwal277 , I'm glad to hear that the solution provided by @swies0wl was able to resolve your issue. Thank you for confirming this.

As the issue has been resolved, I'll be closing this issue now. If you encounter any other problems in the future, please don't hesitate to open a new issue. We're here to help!