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 opslevel_service_relationship resource #552

Merged
merged 4 commits into from
Dec 24, 2024

Conversation

davidbloss
Copy link
Contributor

@davidbloss davidbloss commented Dec 23, 2024

Resolves #469

🎗️ Testing relies on this PR

Problem

Solution

Checklist

  • I have run this code, and it appears to resolve the stated issue.
  • This PR does not reduce total test coverage
  • This PR has no user interface changes or has already received approval from product management to change the interface.
  • Make a changie entry that explains the customer facing outcome of this change

@davidbloss davidbloss self-assigned this Dec 23, 2024
@@ -140,6 +140,14 @@ func getDatasourceFilter(validFieldNames []string) schema.SingleNestedBlock {
}
}

// Temp wrapper until opslevel-go is updated
Copy link
Collaborator

Choose a reason for hiding this comment

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

💅 love it!

Id: &service.Id,
Parent: opslevel.NewIdentifier(),
}
_, _ = r.client.UpdateService(svcUpdate)
Copy link
Collaborator

@rocktavious rocktavious Dec 23, 2024

Choose a reason for hiding this comment

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

shouldn't we handle errors here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an odd one... Here we know the service exists with the parent matching the state, so if the unsetting the parent fails maybe we just print a TF warning? Throwing an error during delete would be too disruptive.
Also I have TF tests incoming

Copy link
Collaborator

@rocktavious rocktavious Dec 23, 2024

Choose a reason for hiding this comment

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

Ya lets at least raise a warning if for some reason the removal didn't work - silently swallowing errors that might produce infinite plan applies is worse.

Comment on lines +153 to +155
if err == nil && (service == nil || string(service.Id) == "") {
err = fmt.Errorf("service %s not found", serviceIdentifier)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

😍

@davidbloss davidbloss merged commit 3415858 into main Dec 24, 2024
7 checks passed
@davidbloss davidbloss deleted the db/add-service-relationship branch December 24, 2024 15:11
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.

2 participants