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

Add infoblox_zone_delegated resource #217

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ngarratt
Copy link
Contributor

Add a new resource to support Zone Delegation

Features:

  • CRUD and Import supported
  • Acceptance test
  • Documentation and examples

Caveats:

@msuter-cbre
Copy link

Thank you for creating this resource, this is amazing!

@ngarratt
Copy link
Contributor Author

ngarratt commented Oct 5, 2022

Is there a blocker for merging this?

Required: true,
Description: "The FQDN of the delegated zone.",
},
"delegate_to": resourceNameServer(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you move delegate_to schema definition into a separate function? There's no complex initialization logic involved, and this function is used only here.

extAttrs := make(map[string]interface{})
if extAttrJSON != "" {
if err := json.Unmarshal([]byte(extAttrJSON), &extAttrs); err != nil {
return fmt.Errorf("cannot process 'ext_attrs' field: %s", err.Error())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to wrap the error:

Suggested change
return fmt.Errorf("cannot process 'ext_attrs' field: %s", err.Error())
return fmt.Errorf("cannot process 'ext_attrs' field: %w", err)

https://pkg.go.dev/fmt#Errorf

delegatedFQDN,
nameServers)
if err != nil {
return fmt.Errorf("Error creating Zone Delegated: %s", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fmt.Errorf("Error creating Zone Delegated: %s", err)
return fmt.Errorf("Error creating Zone Delegated: %w", err)

if err != nil {
zoneDelegatedObj, err = objMgr.GetZoneDelegated(d.Id())
if err != nil {
return fmt.Errorf("Getting Zone Delegated failed: %s", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fmt.Errorf("Getting Zone Delegated failed: %s", err)
return fmt.Errorf("Getting Zone Delegated failed: %w", err)

extAttrs := make(map[string]interface{})
if extAttrJSON != "" {
if err := json.Unmarshal([]byte(extAttrJSON), &extAttrs); err != nil {
return fmt.Errorf("cannot process 'ext_attrs' field: %s", err.Error())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fmt.Errorf("cannot process 'ext_attrs' field: %s", err.Error())
return fmt.Errorf("cannot process 'ext_attrs' field: %w", err)


zoneDelegatedUpdated, err := objMgr.UpdateZoneDelegated(d.Id(), nameServers)
if err != nil {
return fmt.Errorf("Updating of Zone Delegated failed : %s", err.Error())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fmt.Errorf("Updating of Zone Delegated failed : %s", err.Error())
return fmt.Errorf("Updating of Zone Delegated failed : %w", err)

extAttrs := make(map[string]interface{})
if extAttrJSON != "" {
if err := json.Unmarshal([]byte(extAttrJSON), &extAttrs); err != nil {
return fmt.Errorf("cannot process 'ext_attrs' field: %s", err.Error())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fmt.Errorf("cannot process 'ext_attrs' field: %s", err.Error())
return fmt.Errorf("cannot process 'ext_attrs' field: %w", err)


_, err := objMgr.DeleteZoneDelegated(d.Id())
if err != nil {
return fmt.Errorf("Deletion of Zone Delegated failed : %s", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fmt.Errorf("Deletion of Zone Delegated failed : %s", err)
return fmt.Errorf("Deletion of Zone Delegated failed : %w", err)

doughepi pushed a commit to doughepi/terraform-provider-infoblox that referenced this pull request May 16, 2024
Aish-sp pushed a commit to Aish-sp/terraform-provider-infoblox that referenced this pull request Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants