Skip to content

Conversation

epostea
Copy link
Contributor

@epostea epostea commented May 26, 2025

Implemented the automation framework resources:

  • instana_automation_action (resource and data source)
  • instana_automation_policy

Included two new data sources to help with the automation policy resource definition:

  • instana_host_agents
  • instana_custom_event_spec


### Condition Argument Reference

* `query` - Required - Dynamic Focus Query string that selects a list of entities on which the policy is run.
Copy link

@spbarbieri spbarbieri May 27, 2025

Choose a reason for hiding this comment

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

I don't think this is required.
Update: after testing, if the policy is both manual and automatic and if you want a specific DFQ then this field is required in both type_configuration objects. It is not required if the policy is manual only. It is also not required if you don't want a specific DFQ.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My logic was the condition is optional, but query is required within the condition. Is it confusing? Probably I can remove the condition block and just have a condition_query attribute for Type Configuration.

Choose a reason for hiding this comment

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

Thanks, makes sense now.

}

func (ds *customEventSpecificationDataSource) findCustomEventByNameAndEntityType(name string, entityType string, data *[]*restapi.CustomEventSpecification) (*restapi.CustomEventSpecification, error) {
for _, customEvent := range *data {

Choose a reason for hiding this comment

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

I think this is fine, but just note that I was able to create two custom events with the same name and entity type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, the builtin events data source returns just one entry as well, but it might not be correct. I can change the implementation and have a data source that returns multiple "items". What do you think?

Choose a reason for hiding this comment

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

I think it's fine for now. It's really an edge case. It can be addressed later if needed.


## Argument Reference

* `name` - Required - The name of the automation action.

Choose a reason for hiding this comment

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

I don't know if it's needed, but you also get the acton id.

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 the resource documentation and we don't specify the id argument. Right?

Choose a reason for hiding this comment

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

correct, on the resource you don't specify an ID.

@epostea epostea merged commit cfd61f7 into main Jun 2, 2025
2 checks passed
@epostea epostea deleted the automation_resources branch June 2, 2025 12:30
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