powerplatform_rest_query (Data Source)

Datasource to fetch api requests

Example Usage

terraform {
  required_providers {
    powerplatform = {
      source = "microsoft/power-platform"
    }
  }
}

provider "powerplatform" {
  use_cli = true
}

resource "powerplatform_environment" "development" {
  display_name     = "example_environment"
  location         = "europe"
  azure_region     = "northeurope"
  environment_type = "Sandbox"
  dataverse = {
    language_code     = "1033"
    currency_code     = "USD"
    security_group_id = "00000000-0000-0000-0000-000000000000"
  }
}

data "powerplatform_rest_query" "webapi_query" {
  scope                = "${powerplatform_environment.development.dataverse.url}/.default"
  url                  = "${powerplatform_environment.development.dataverse.url}/api/data/v9.2/RetrieveCurrentOrganization(AccessType=@p1)?@p1=Microsoft.Dynamics.CRM.EndpointAccessType'Default'"
  method               = "GET"
  expected_http_status = [200]
}

Schema

Required

  • method (String) HTTP method
  • scope (String) Authentication scope for the request. See more: Authentication Scopes
  • url (String) Absolute url of the api call

Optional

  • body (String) Body of the request
  • expected_http_status (List of Number) Expected HTTP status code. If the response status code does not match any of the expected status codes, the operation will fail.
  • headers (Attributes List) Headers of the request (see below for nested schema)
  • timeouts (Attributes) (see below for nested schema)

Read-Only

Nested Schema for headers

Required:

  • name (String) Header name
  • value (String) Header value

Nested Schema for timeouts

Optional:

  • read (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.

Nested Schema for output

Read-Only:

  • body (String) Response body after executing the web api request