Skip to content

feat: add support for alarms#2600

Merged
tenthirtyam merged 1 commit intovmware:mainfrom
emriver:feat/add-alarm-mgmt
Sep 11, 2025
Merged

feat: add support for alarms#2600
tenthirtyam merged 1 commit intovmware:mainfrom
emriver:feat/add-alarm-mgmt

Conversation

@emriver
Copy link
Copy Markdown
Contributor

@emriver emriver commented Sep 4, 2025

Summary

This new feature allows to manage alarms with Terraform.
This will allow to easily duplicate alarm configurations across datacenters, clusters, or even virtual machines.

Type

  • fix: Bug Fix
  • feat: Feature or Enhancement
  • docs: Documentation
  • refactor: Refactoring
  • chore: Build, Dependencies, Workflows, etc.
  • other: Other (Please describe.)

Breaking Changes?

  • Yes, there are breaking changes.
  • No, there are no breaking changes.

Tests

  • Tests have been added or updated.
  • Tests have been completed.

Output:

$ TF_ACC=1 go test -timeout 5m -run TestAccResourceVsphereAlarm* github.com/vmware/terraform-provider-vsphere/vsphere -count=1
ok      github.com/vmware/terraform-provider-vsphere/vsphere    218.109s
$ TF_VAR_VSPHERE_DATACENTER=xxx TF_ACC=1 go test -timeout 5m -run TestAccDataSourceVSphereAlarm_* g
ithub.com/vmware/terraform-provider-vsphere/vsphere -count=1
ok      github.com/vmware/terraform-provider-vsphere/vsphere    37.547s

Documentation

  • Documentation has been added or updated.

Issue References

Resolves #1312

Release Note

- `r/vsphere_alarm` - Added a new resource for alarms.

Additional Information

Alarms can have a lot of possible parameters and options, I didn't find a way to hide all the complexity (like using a metric_counter_id instead of a user friendly name).
Some of the tests only work with vSphere >= 8.

@emriver emriver requested a review from a team as a code owner September 4, 2025 07:51
@github-actions github-actions bot added documentation Documentation provider Provider needs-review Needs Review size/xl Relative Sizing: Extra-Large labels Sep 4, 2025
@emriver emriver force-pushed the feat/add-alarm-mgmt branch 2 times, most recently from 59027ec to 8f4efb0 Compare September 4, 2025 12:16
@tenthirtyam tenthirtyam added this to the v2.x.y milestone Sep 4, 2025
@tenthirtyam
Copy link
Copy Markdown
Contributor

Hi @emriver, 👋🏻 Thanks for the contribution - we'll check this one out soon! IN the meantime, would you be open to including the data source as well? This would likely follow a similar structure of the Read structure from the resource.

Ryan Johnson, VMware by Broadcom

@emriver
Copy link
Copy Markdown
Contributor Author

emriver commented Sep 4, 2025

Hi @emriver, 👋🏻 Thanks for the contribution - we'll check this one out soon! IN the meantime, would you be open to including the data source as well? This would likely follow a similar structure of the Read structure from the resource.

Ryan Johnson, VMware by Broadcom

Hi, I will try to do it asap. I didn't do it at first because I had doubts about its utility.

@emriver emriver force-pushed the feat/add-alarm-mgmt branch from 8f4efb0 to 5ee7615 Compare September 4, 2025 16:19
@tenthirtyam tenthirtyam changed the title feat: create alarm resource feat: add support for alarms Sep 4, 2025
@emriver emriver force-pushed the feat/add-alarm-mgmt branch 2 times, most recently from 306e9a8 to 665263b Compare September 5, 2025 10:13
Copy link
Copy Markdown
Contributor

@spacegospod spacegospod left a comment

Choose a reason for hiding this comment

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

Looks good, thank you for adding comprehensive tests!

Copy link
Copy Markdown
Contributor

@tenthirtyam tenthirtyam left a comment

Choose a reason for hiding this comment

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

Just some minor changes requested to the test examples.

@emriver emriver force-pushed the feat/add-alarm-mgmt branch from 665263b to 657cbaa Compare September 10, 2025 15:49
@github-actions github-actions bot added dependencies Dependencies chore Chore labels Sep 10, 2025
@tenthirtyam
Copy link
Copy Markdown
Contributor

@emriver Can you mark comments as resolved once the update(s) is commited?

@emriver emriver force-pushed the feat/add-alarm-mgmt branch from 657cbaa to d6e3081 Compare September 11, 2025 06:55
@emriver
Copy link
Copy Markdown
Contributor Author

emriver commented Sep 11, 2025

@emriver Can you mark comments as resolved once the update(s) is commited?

This should be good now.

Copy link
Copy Markdown
Contributor

@tenthirtyam tenthirtyam left a comment

Choose a reason for hiding this comment

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

Two more mino nits, but once cleared this should be ready to merge.

Adds support for vSphere alarms resource and datasource.

Ref: vmware#1312
Copy link
Copy Markdown
Contributor

@tenthirtyam tenthirtyam left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@tenthirtyam tenthirtyam merged commit 9d3d599 into vmware:main Sep 11, 2025
4 checks passed
@tenthirtyam tenthirtyam removed the needs-review Needs Review label Sep 11, 2025
@github-actions
Copy link
Copy Markdown

I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

chore Chore dependencies Dependencies documentation Documentation provider Provider size/xl Relative Sizing: Extra-Large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for vSphere alarm definitions

3 participants