openstack_identity_auth_scope_v3

Use this data source to get authentication information about the current auth scope in use. This can be used as self-discovery or introspection of the username or project name currently in use as well as the service catalog.

Example Usage

Simple

data "openstack_identity_auth_scope_v3" "scope" {
  name = "my_scope"
}

To find the the public object storage endpoint for "region1" as listed in the service catalog:

locals {
  object_store_service    = [for entry in data.openstack_identity_auth_scope_v3.scope.service_catalog:
                                 entry if entry.type=="object-store"][0]
  object_store_endpoint   = [for endpoint in local.object_store_service.endpoints:
                                 endpoint if (endpoint.interface=="public" && endpoint.region=="region1")][0]
  object_store_public_url = local.object_store_endpoint.url
}

In a combination with an http data source provider

See http provider for reference.

data "openstack_identity_auth_scope_v3" "scope" {
  name = "my_scope"
}
locals {
  object_store_service    = [for entry in data.openstack_identity_auth_scope_v3.scope.service_catalog:
                                 entry if entry.type=="object-store"][0]
  object_store_endpoint   = [for endpoint in local.object_store_service.endpoints:
                                 endpoint if (endpoint.interface=="public" && endpoint.region=="region1")][0]
  object_store_public_url = local.object_store_endpoint.url
}

data "http" "example" {
  url = local.object_store_public_url

  request_headers = {
    "Accept"       = "application/json"
    "X-Auth-Token" = data.openstack_identity_auth_scope_v3.scope.token_id
  }
}

# print object storage containers in JSON format
output "containers" {
  value = data.http.example.response_body
}

Argument Reference

Attributes Reference

id is set to the name given to the scope. In addition, the following attributes are exported:

The roles block contains:

The service_catalog block contains:

The endpoints block contains: