0

I am trying to extract multiple host with regex pattern but it is returning none

We are having below 3 servers

application-host-ad1-01
application-host-ad1-02
application-host-ad1-03

Running below content in a file, using terraform plan

data "oci_core_instances" "service_host" {
  compartment_id = "safdkjhgskdjfgjksdjkfjkdj"
  display_name   = "application-host-ad1-[0-3-]*"
}
output "service_list" {
  value = data.oci_core_instances.service_host
}

it is returning just one host id

Changes to Outputs:
  + service_list = {
      + availability_domain     = null
      + capacity_reservation_id = null
      + compartment_id          = "sdflkhlksdkl"
      + display_name            = "application-host-ad1-[0-3-]*"
      + filter                  = null
      + id                      = "CoreInstancesDataSource-2394868969823"
      + instances               = []
      + state                   = null
    }
LOrD_ARaGOrN
  • 3,884
  • 3
  • 27
  • 49
  • It actually is returning none of the hosts because the argument value type is a literal string and not a regular expression. If you want to filter only those instances, then you would need to use other `data` arguments according to your environment. – Matthew Schuchard Mar 21 '23 at 12:23

0 Answers0