Skip to content

Latest commit

 

History

History
145 lines (118 loc) · 5.91 KB

File metadata and controls

145 lines (118 loc) · 5.91 KB
page_title powerplatform_solution_git_branch Resource - Power Platform
subcategory
description Manages a solution-level Dataverse Git branch binding. This maps to the documented sourcecontrolbranchconfiguration Dataverse table and links a solution partition to a branch and folder beneath an environment Git integration.

powerplatform_solution_git_branch (Resource)

Manages a solution-level Dataverse Git branch binding. This maps to the documented sourcecontrolbranchconfiguration Dataverse table and links a solution partition to a branch and folder beneath an environment Git integration.

Example Usage

terraform {
  required_providers {
    local = {
      source  = "hashicorp/local"
      version = "2.6.2"
    }
    powerplatform = {
      source = "microsoft/power-platform"
    }
  }
}

provider "local" {}

provider "powerplatform" {
  use_cli = true
}

resource "local_file" "solution_settings_file" {
  filename = "${path.module}/solution_settings.json"
  content  = <<EOF
{
  "EnvironmentVariables": [
    {
      "SchemaName": "cra6e_SolutionVariableDataSource",
      "Value": "/sites/Shared Documents"
    },
    {
      "SchemaName": "cra6e_SolutionVariableJson",
      "Value": "{ \"value\": 1234, \"text\": \"abc\" }"
    },
    {
      "SchemaName": "cra6e_SolutionVariableText",
      "Value": "${powerplatform_environment.example.id}"
    }
  ],
  "ConnectionReferences": [
    {
      "LogicalName": "cra6e_ConnectionReferenceSharePoint",
      "ConnectionId": "00000000-0000-0000-0000-000000000000",
      "ConnectorId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline"
    }
  ]
}
EOF
}

resource "powerplatform_environment" "example" {
  display_name     = var.environment_display_name
  description      = "Example environment for validating Dataverse Git branch bindings."
  location         = var.location
  azure_region     = var.azure_region
  environment_type = "Sandbox"
  dataverse = {
    language_code     = "1033"
    currency_code     = "USD"
    security_group_id = var.security_group_id
  }
}

resource "powerplatform_solution" "example" {
  environment_id = powerplatform_environment.example.id
  solution_file  = coalesce(var.solution_file, "${path.module}/../powerplatform_solution/TerraformTestSolution_Complex_1_1_0_0.zip")
  settings_file  = local_file.solution_settings_file.filename
}

resource "powerplatform_environment_git_integration" "example" {
  count = var.enable_git_binding ? 1 : 0

  environment_id    = powerplatform_environment.example.id
  git_provider      = var.git_provider
  scope             = var.scope
  organization_name = var.organization_name
  project_name      = var.project_name
  repository_name   = var.repository_name
}

resource "powerplatform_solution_git_branch" "example" {
  count = var.enable_git_binding ? 1 : 0

  environment_id       = powerplatform_environment.example.id
  git_integration_id   = powerplatform_environment_git_integration.example[0].id
  solution_id          = powerplatform_solution.example.id
  branch_name          = var.branch_name
  upstream_branch_name = var.upstream_branch_name
  root_folder_path     = var.root_folder_path
}

Schema

Required

  • branch_name (String) Branch name to bind the solution partition to.
  • environment_id (String) Environment ID of the Dataverse environment where the branch binding exists.
  • git_integration_id (String) ID of the parent powerplatform_environment_git_integration resource.
  • root_folder_path (String) Repository folder path that stores the solution's files.
  • solution_id (String) ID of the existing powerplatform_solution resource to bind to the Git branch. This must use the provider solution ID format for the same environment.

Optional

  • timeouts (Attributes) (see below for nested schema)
  • upstream_branch_name (String) Upstream branch name. When omitted, the provider will use the same value as branch_name.

Read-Only

  • id (String) Unique identifier of the Dataverse source control branch configuration.

Nested Schema for timeouts

Optional:

  • create (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).
  • delete (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). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
  • 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.
  • update (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).

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# Solution Git branch resources can be imported using environment_id/git_integration_id/solution_id
# The final segment can be either the raw Dataverse solution id or the provider-formatted powerplatform_solution.id
terraform import powerplatform_solution_git_branch.example 00000000-0000-0000-0000-000000000000/11111111-1111-1111-1111-111111111111/00000000-0000-0000-0000-000000000000_22222222-2222-2222-2222-222222222222