Is your feature request related to a problem? Please describe.
Synthetic monitors can only be assigned to a single Kibana space via the space_id attribute. The Kibana UI and API support sharing a monitor across multiple spaces using the spaces / kibana_spaces field (which maps to saved object initialNamespaces), but the Terraform provider doesn't expose this. This means users who need a monitor visible in multiple spaces must either duplicate the monitor or manage sharing out-of-band via API calls after terraform apply.
Describe the resource you would like to have implemented.
The Kibana Synthetics Monitor API (Add Monitor API) accepts a spaces field (array of strings) in the request body. Internally this is stored as ConfigKey.KIBANA_SPACES and sets initialNamespaces on the saved object, allowing the monitor to appear in multiple Kibana spaces without duplication.
Relevant Kibana source:
x-pack/solutions/observability/plugins/synthetics/server/services/monitor_config_repository.ts — uses initialNamespaces: spaces on saved object creation
x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/edit_monitor.ts — handles KIBANA_SPACES on update
- A wildcard value
["*"] shares to all spaces
Describe the solution you'd like
Add an optional kibana_spaces attribute (list of strings) to elasticstack_kibana_synthetics_monitor:
resource "elasticstack_kibana_synthetics_monitor" "my_monitor" {
name = "My Monitor"
space_id = "y"
kibana_spaces = ["y", "infrastructure"]
# ... other fields
}
When kibana_spaces is set, the provider should include the spaces field in the Kibana API request body. The space_id remains the "owner" space for the API endpoint path, while kibana_spaces controls visibility. A value of ["*"] should share to all spaces.
Describe alternatives you've considered
- Duplicating monitors in each space (doubles cost, creates drift risk)
- Using a
null_resource with local-exec to call the Kibana API after monitor creation (fragile, out-of-band state)
- Using
elasticstack_kibana_import_saved_objects to copy the monitor SO to additional spaces (doesn't maintain sharing link)
Additional context
- Provider version tested:
0.14.4
- Latest provider version checked:
0.15.2 (still missing this field)
- Kibana versions with this feature: 8.x+
- The Kibana UI exposes this under "Advanced > Kibana Spaces" in the monitor edit form
Is your feature request related to a problem? Please describe.
Synthetic monitors can only be assigned to a single Kibana space via the
space_idattribute. The Kibana UI and API support sharing a monitor across multiple spaces using thespaces/kibana_spacesfield (which maps to saved objectinitialNamespaces), but the Terraform provider doesn't expose this. This means users who need a monitor visible in multiple spaces must either duplicate the monitor or manage sharing out-of-band via API calls afterterraform apply.Describe the resource you would like to have implemented.
The Kibana Synthetics Monitor API (Add Monitor API) accepts a
spacesfield (array of strings) in the request body. Internally this is stored asConfigKey.KIBANA_SPACESand setsinitialNamespaceson the saved object, allowing the monitor to appear in multiple Kibana spaces without duplication.Relevant Kibana source:
x-pack/solutions/observability/plugins/synthetics/server/services/monitor_config_repository.ts— usesinitialNamespaces: spaceson saved object creationx-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/edit_monitor.ts— handlesKIBANA_SPACESon update["*"]shares to all spacesDescribe the solution you'd like
Add an optional
kibana_spacesattribute (list of strings) toelasticstack_kibana_synthetics_monitor:When
kibana_spacesis set, the provider should include thespacesfield in the Kibana API request body. Thespace_idremains the "owner" space for the API endpoint path, whilekibana_spacescontrols visibility. A value of["*"]should share to all spaces.Describe alternatives you've considered
null_resourcewithlocal-execto call the Kibana API after monitor creation (fragile, out-of-band state)elasticstack_kibana_import_saved_objectsto copy the monitor SO to additional spaces (doesn't maintain sharing link)Additional context
0.14.40.15.2(still missing this field)