Skip to content

Commit

Permalink
Updates filters description in datasource docs (#318)
Browse files Browse the repository at this point in the history
* Updates filters description in datasource docs

* Fixes terraform crashes with ttl nil pointer dereference

* Fixes Import issue for IP Allocation resource
  • Loading branch information
hemanthKa677 committed Oct 26, 2023
1 parent 757dcea commit 25f062a
Show file tree
Hide file tree
Showing 22 changed files with 112 additions and 75 deletions.
5 changes: 2 additions & 3 deletions docs/data-sources/infoblox_a_record.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ Use the `infoblox_a_record` data source to retrieve the following information fo

As there is new feature filters , the previous usage of combination of DNS view, IPv4 address and FQDN, has been removed.

For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object.
From the below list of supported arguments for filters, use only the searchable fields for retriving the matching records.

### Supported Arguments for filters

Expand Down
5 changes: 2 additions & 3 deletions docs/data-sources/infoblox_aaaa_record.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ Use the `infoblox_aaaa_record` data source to retrieve the following information

As there is new feature filters , the previous usage of combination of DNS view, IPv6 address and FQDN, has been removed.

For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object.
From the below list of supported arguments for filters, use only the searchable fields for retriving the matching records.

### Supported Arguments for filters

Expand Down
5 changes: 2 additions & 3 deletions docs/data-sources/infoblox_cname_record.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ Use the `infoblox_cname_record` data resource for the CNAME object to retrieve t

As there is new feature filters , the previous usage of combination of DNS view, alias and canonical name, has been removed.

For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object.
From the below list of supported arguments for filters, use only the searchable fields for retriving the matching records.

### Supported Arguments for filters

Expand Down
5 changes: 2 additions & 3 deletions docs/data-sources/infoblox_dns_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ Use the `infoblox_dns_view` data source to retrieve the following information fo
* `comment`: The description of the DNS View. This is a regular comment. Example `this is some text`.
* `ext_attrs`: the set of extensible attributes of the record, if any. The content is formatted as string of JSON map. Example: `"{\"Owner\":\"State Library\", \"Expires\":\"never\"}"`.

For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object.
From the below list of supported arguments for filters, use only the searchable fields for retriving the matching records.

### Supported Arguments for filters

Expand Down
5 changes: 2 additions & 3 deletions docs/data-sources/infoblox_ipv4_network.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ The data source for the network object allows you to get the following parameter
* `ext_attrs`: The set of extensible attributes, if any. The content is formatted as string of JSON map. Example: `"{\"Owner\":\"State Library\",\"Administrator\":\"unknown\"}"`.


For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object.
From the below list of supported arguments for filters, use only the searchable fields for retriving the matching records.

### Supported Arguments for filters

Expand Down
5 changes: 2 additions & 3 deletions docs/data-sources/infoblox_ipv4_network_container.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ object in NIOS:

As there is new feature filters , the previous usage of combination of Network view and address of the network block in CIDR format has been removed.

For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object.
From the below list of supported arguments for filters, use only the searchable fields for retriving the matching records.

### Supported Arguments for filters

Expand Down
5 changes: 2 additions & 3 deletions docs/data-sources/infoblox_mx_record.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ Use the data source to retrieve the following information for MX-record from the
* `comment`: the description of the record. This is a regular comment. Example: `spare node for the service`.
* `ext_attrs`: the set of extensible attributes of the record, if any. The content is formatted as stirng of JSON map. Example: `"{\"Owner\":\"State Library\", \"Expires\":\"never\"}"`.

For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object.
From the below list of supported arguments for filters, use only the searchable fields for retriving the matching records.

### Supported Arguments for filters

Expand Down
5 changes: 2 additions & 3 deletions docs/data-sources/infoblox_network_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ Use the data source to retrieve the following information for a network view res
* `comment`: a description of the network view. This is a regular comment. Example: `From the outside`.
* `ext_attrs`: the set of extensible attributes of the network view, if any. The content is formatted string of JSON map. Example: `"{\"Administrator\":\"jsw@telecom.ca\"}"`.

For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object.
From the below list of supported arguments for filters, use only the searchable fields for retriving the matching records.

### Supported Arguments for filters

Expand Down
5 changes: 2 additions & 3 deletions docs/data-sources/infoblox_ptr_record.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ Use the data source to retrieve the following information for PTR-record from th
As new feature filters are introduced, specifying combination DNS view , IPv4 address or IPv6 address or record name used instead of IP address
and ptrdname is removed.

For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object.
From the below list of supported arguments for filters, use only the searchable fields for retriving the matching records.

### Supported Arguments for filters

Expand Down
5 changes: 2 additions & 3 deletions docs/data-sources/infoblox_srv_record.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ Use the data source to retrieve the following information for SRV-record from th
* `comment`: the description of the record. This is a regular comment. Example: `spare node for the service`.
* `ext_attrs`: the set of extensible attributes of the record, if any. The content is formatted as string of JSON map. Example: `"{\"Owner\":\"State Library\", \"Expires\":\"never\"}"`.

For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object.
From the below list of supported arguments for filters, use only the searchable fields for retriving the matching records.

### Supported Arguments for filters

Expand Down
5 changes: 2 additions & 3 deletions docs/data-sources/infoblox_txt_record.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ Use the data source to retrieve the following information for TXT-record from th
* `comment`: the description of the record. This is a regular comment. Example: `spare node for the service`.
* `ext_attrs`: the set of extensible attributes of the record, if any. The content is formatted as string of JSON map. Example: `"{\"Owner\":\"State Library\", \"Expires\":\"never\"}"`.

For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object.
From the below list of supported arguments for filters, use only the searchable fields for retriving the matching records.

### Supported Arguments for filters

Expand Down
5 changes: 2 additions & 3 deletions docs/data-sources/infoblox_zone_auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ Use the `infoblox_zone_auth` data source to retrieve the following information f
* `comment`: The Description of Authoritative Zone Object. Example: `random authoritative zone`.
* `ext_attrs`: the set of extensible attributes of the record, if any. The content is formatted as string of JSON map. Example: `"{\"Location\":\"unknown\",\"TestEA\":\"ZoneTesting\"}"`.

For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object. Only searchable fields
from below list of supported arguments for filters, are allowed to use in filters, for retrieving one or more records or objects matching
filters.
For usage of filters, add the fields as keys and appropriate values to be passed to the keys like `name`, `view` corresponding to object.
From the below list of supported arguments for filters, use only the searchable fields for retriving the matching records.

### Supported Arguments for filters

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/infoblox_zone_auth.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Zone Auth Resource

The `infoblox_zone_auth` resource associates authoritative zone with in a DNS View.The resource represents the ‘zone_auth’ WAPI object in NIOS.
The `infoblox_zone_auth` resource associates authoritative zone with a DNS View.The resource represents the ‘zone_auth’ WAPI object in NIOS.

The following list describes the parameters you can define in the resource block of the zone auth object:

Expand Down
2 changes: 1 addition & 1 deletion examples/resources/infoblox_zone_auth.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ resource "infoblox_zone_auth" "zone2" {
}

//IPV6 reverse mapping zone, with minimal set of parameters
resource "infoblox_zone_auth" "zone2" {
resource "infoblox_zone_auth" "zone3" {
fqdn = "2002:1100::/64"
view = "non_defaultview"
zone_format = "IPV6"
Expand Down
10 changes: 8 additions & 2 deletions infoblox/resource_infoblox_a_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func resourceARecordCreate(d *schema.ResourceData, m interface{}) error {
}

func resourceARecordGet(d *schema.ResourceData, m interface{}) error {
var ttl int
extAttrJSON := d.Get("ext_attrs").(string)
extAttrs, err := terraformDeserializeEAs(extAttrJSON)
if err != nil {
Expand All @@ -171,7 +172,9 @@ func resourceARecordGet(d *schema.ResourceData, m interface{}) error {
return err
}

ttl := int(*obj.Ttl)
if obj.Ttl != nil {
ttl = int(*obj.Ttl)
}
if !*obj.UseTtl {
ttl = ttlUndef
}
Expand Down Expand Up @@ -377,6 +380,7 @@ func resourceARecordDelete(d *schema.ResourceData, m interface{}) error {
}

func resourceARecordImport(d *schema.ResourceData, m interface{}) ([]*schema.ResourceData, error) {
var ttl int
extAttrJSON := d.Get("ext_attrs").(string)
extAttrs, err := terraformDeserializeEAs(extAttrJSON)
if err != nil {
Expand All @@ -401,7 +405,9 @@ func resourceARecordImport(d *schema.ResourceData, m interface{}) ([]*schema.Res
return nil, err
}

ttl := int(*obj.Ttl)
if obj.Ttl != nil {
ttl = int(*obj.Ttl)
}
if !*obj.UseTtl {
ttl = ttlUndef
}
Expand Down
11 changes: 9 additions & 2 deletions infoblox/resource_infoblox_aaaa_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func resourceAAAARecordCreate(d *schema.ResourceData, m interface{}) error {
}

func resourceAAAARecordGet(d *schema.ResourceData, m interface{}) error {
var ttl int
extAttrJSON := d.Get("ext_attrs").(string)
extAttrs, err := terraformDeserializeEAs(extAttrJSON)
if err != nil {
Expand All @@ -169,7 +170,9 @@ func resourceAAAARecordGet(d *schema.ResourceData, m interface{}) error {
return err
}

ttl := int(*obj.Ttl)
if obj.Ttl != nil {
ttl = int(*obj.Ttl)
}
if !*obj.UseTtl {
ttl = ttlUndef
}
Expand Down Expand Up @@ -377,6 +380,7 @@ func resourceAAAARecordDelete(d *schema.ResourceData, m interface{}) error {
}

func resourceAAAARecordImport(d *schema.ResourceData, m interface{}) ([]*schema.ResourceData, error) {
var ttl int
extAttrJSON := d.Get("ext_attrs").(string)
extAttrs, err := terraformDeserializeEAs(extAttrJSON)
if err != nil {
Expand All @@ -399,7 +403,10 @@ func resourceAAAARecordImport(d *schema.ResourceData, m interface{}) ([]*schema.
return nil, err
}

ttl := int(*obj.Ttl)
if obj.Ttl != nil {
ttl = int(*obj.Ttl)
}

if !*obj.UseTtl {
ttl = ttlUndef
}
Expand Down
14 changes: 12 additions & 2 deletions infoblox/resource_infoblox_cname_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func resourceCNAMERecordCreate(d *schema.ResourceData, m interface{}) error {
}

func resourceCNAMERecordGet(d *schema.ResourceData, m interface{}) error {
var ttl int
extAttrJSON := d.Get("ext_attrs").(string)
extAttrs, err := terraformDeserializeEAs(extAttrJSON)
if err != nil {
Expand Down Expand Up @@ -127,7 +128,11 @@ func resourceCNAMERecordGet(d *schema.ResourceData, m interface{}) error {
if err = d.Set("comment", obj.Comment); err != nil {
return err
}
ttl := int(*obj.Ttl)

if obj.Ttl != nil {
ttl = int(*obj.Ttl)
}

if !*obj.UseTtl {
ttl = ttlUndef
}
Expand Down Expand Up @@ -264,6 +269,7 @@ func resourceCNAMERecordDelete(d *schema.ResourceData, m interface{}) error {
}

func resourceCNAMERecordImport(d *schema.ResourceData, m interface{}) ([]*schema.ResourceData, error) {
var ttl int
extAttrJSON := d.Get("ext_attrs").(string)
extAttrs, err := terraformDeserializeEAs(extAttrJSON)
if err != nil {
Expand Down Expand Up @@ -291,7 +297,11 @@ func resourceCNAMERecordImport(d *schema.ResourceData, m interface{}) ([]*schema
if err = d.Set("comment", obj.Comment); err != nil {
return nil, err
}
ttl := int(*obj.Ttl)

if obj.Ttl != nil {
ttl = int(*obj.Ttl)
}

if !*obj.UseTtl {
ttl = ttlUndef
}
Expand Down
40 changes: 17 additions & 23 deletions infoblox/resource_infoblox_ip_allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ func resourceAllocationRequest(d *schema.ResourceData, m interface{}) error {
}

func resourceAllocationGet(d *schema.ResourceData, m interface{}) error {
var ttl int
obj, err := getOrFindHostRec(d, m)
if err != nil {
if _, ok := err.(*ibclient.NotFoundError); ok {
Expand Down Expand Up @@ -344,7 +345,9 @@ func resourceAllocationGet(d *schema.ResourceData, m interface{}) error {
return err
}

ttl := int(*obj.Ttl)
if obj.Ttl != nil {
ttl = int(*obj.Ttl)
}
if !*obj.UseTtl {
ttl = ttlUndef
}
Expand Down Expand Up @@ -632,16 +635,18 @@ func resourceAllocationRelease(d *schema.ResourceData, m interface{}) error {
}

func ipAllocationImporter(d *schema.ResourceData, m interface{}) ([]*schema.ResourceData, error) {
var ttl int
internalId := newInternalResourceIdFromString(d.Id())
if internalId == nil {
return nil, fmt.Errorf("ID value provided is not in a proper format")
}

d.SetId(internalId.String())
if err := d.Set("internal_id", internalId.String()); err != nil {
return nil, err
}
obj, err := getOrFindHostRec(d, m)
if err != nil {
if _, ok := err.(*ibclient.NotFoundError); ok {
d.SetId("")
return nil, ibclient.NewNotFoundError(fmt.Sprintf(
"cannot find apropriate object on NIOS side for resource with ID '%s': %s;"+
" removing the resource from Terraform state",
d.Id(), err))
}

return nil, err
}

Expand Down Expand Up @@ -713,7 +718,9 @@ func ipAllocationImporter(d *schema.ResourceData, m interface{}) ([]*schema.Reso
return nil, err
}

ttl := int(*obj.Ttl)
if obj.Ttl != nil {
ttl = int(*obj.Ttl)
}
if !*obj.UseTtl {
ttl = ttlUndef
}
Expand All @@ -725,18 +732,5 @@ func ipAllocationImporter(d *schema.ResourceData, m interface{}) ([]*schema.Reso
return nil, err
}

internalId := newInternalResourceIdFromString(d.Id())
if internalId == nil {
return nil, fmt.Errorf("ID value provided is not in a proper format")
}

d.SetId(internalId.String())
if err := d.Set("internal_id", internalId.String()); err != nil {
return nil, err
}
if _, err := getOrFindHostRec(d, m); err != nil {
return nil, err
}

return []*schema.ResourceData{d}, nil
}
12 changes: 10 additions & 2 deletions infoblox/resource_infoblox_mx_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func resourceMXRecordCreate(d *schema.ResourceData, m interface{}) error {
}

func resourceMXRecordGet(d *schema.ResourceData, m interface{}) error {
var ttl int
extAttrJSON := d.Get("ext_attrs").(string)
extAttrs, err := terraformDeserializeEAs(extAttrJSON)
if err != nil {
Expand All @@ -137,7 +138,10 @@ func resourceMXRecordGet(d *schema.ResourceData, m interface{}) error {
return fmt.Errorf("failed getting MX-Record: %s", err)
}

ttl := int(*obj.Ttl)
if obj.Ttl != nil {
ttl = int(*obj.Ttl)
}

if !*obj.UseTtl {
ttl = ttlUndef
}
Expand Down Expand Up @@ -295,6 +299,7 @@ func resourceMXRecordDelete(d *schema.ResourceData, m interface{}) error {
}

func resourceMXRecordImport(d *schema.ResourceData, m interface{}) ([]*schema.ResourceData, error) {
var ttl int
extAttrJSON := d.Get("ext_attrs").(string)
extAttrs, err := terraformDeserializeEAs(extAttrJSON)
if err != nil {
Expand All @@ -315,7 +320,10 @@ func resourceMXRecordImport(d *schema.ResourceData, m interface{}) ([]*schema.Re
return nil, fmt.Errorf("failed getting MX-Record: %s", err)
}

ttl := int(*obj.Ttl)
if obj.Ttl != nil {
ttl = int(*obj.Ttl)
}

if !*obj.UseTtl {
ttl = ttlUndef
}
Expand Down
Loading

0 comments on commit 25f062a

Please sign in to comment.