|
| 1 | +--- |
| 2 | +# generated by https://github.com/hashicorp/terraform-plugin-docs |
| 3 | +page_title: "powerplatform_solution_git_branch Resource - Power Platform" |
| 4 | +subcategory: "" |
| 5 | +description: |- |
| 6 | + 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. |
| 7 | +--- |
| 8 | + |
| 9 | +# powerplatform_solution_git_branch (Resource) |
| 10 | + |
| 11 | +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. |
| 12 | + |
| 13 | +## Example Usage |
| 14 | + |
| 15 | +```terraform |
| 16 | +terraform { |
| 17 | + required_providers { |
| 18 | + local = { |
| 19 | + source = "hashicorp/local" |
| 20 | + version = "2.6.2" |
| 21 | + } |
| 22 | + powerplatform = { |
| 23 | + source = "microsoft/power-platform" |
| 24 | + } |
| 25 | + } |
| 26 | +} |
| 27 | +
|
| 28 | +provider "local" {} |
| 29 | +
|
| 30 | +provider "powerplatform" { |
| 31 | + use_cli = true |
| 32 | +} |
| 33 | +
|
| 34 | +resource "local_file" "solution_settings_file" { |
| 35 | + filename = "${path.module}/solution_settings.json" |
| 36 | + content = <<EOF |
| 37 | +{ |
| 38 | + "EnvironmentVariables": [ |
| 39 | + { |
| 40 | + "SchemaName": "cra6e_SolutionVariableDataSource", |
| 41 | + "Value": "/sites/Shared Documents" |
| 42 | + }, |
| 43 | + { |
| 44 | + "SchemaName": "cra6e_SolutionVariableJson", |
| 45 | + "Value": "{ \"value\": 1234, \"text\": \"abc\" }" |
| 46 | + }, |
| 47 | + { |
| 48 | + "SchemaName": "cra6e_SolutionVariableText", |
| 49 | + "Value": "${powerplatform_environment.example.id}" |
| 50 | + } |
| 51 | + ], |
| 52 | + "ConnectionReferences": [ |
| 53 | + { |
| 54 | + "LogicalName": "cra6e_ConnectionReferenceSharePoint", |
| 55 | + "ConnectionId": "00000000-0000-0000-0000-000000000000", |
| 56 | + "ConnectorId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" |
| 57 | + } |
| 58 | + ] |
| 59 | +} |
| 60 | +EOF |
| 61 | +} |
| 62 | +
|
| 63 | +resource "powerplatform_environment" "example" { |
| 64 | + display_name = var.environment_display_name |
| 65 | + description = "Example environment for validating Dataverse Git branch bindings." |
| 66 | + location = var.location |
| 67 | + azure_region = var.azure_region |
| 68 | + environment_type = "Sandbox" |
| 69 | + dataverse = { |
| 70 | + language_code = "1033" |
| 71 | + currency_code = "USD" |
| 72 | + security_group_id = var.security_group_id |
| 73 | + } |
| 74 | +} |
| 75 | +
|
| 76 | +resource "powerplatform_solution" "example" { |
| 77 | + environment_id = powerplatform_environment.example.id |
| 78 | + solution_file = coalesce(var.solution_file, "${path.module}/../powerplatform_solution/TerraformTestSolution_Complex_1_1_0_0.zip") |
| 79 | + settings_file = local_file.solution_settings_file.filename |
| 80 | +} |
| 81 | +
|
| 82 | +resource "powerplatform_environment_git_integration" "example" { |
| 83 | + count = var.enable_git_binding ? 1 : 0 |
| 84 | +
|
| 85 | + environment_id = powerplatform_environment.example.id |
| 86 | + git_provider = var.git_provider |
| 87 | + scope = var.scope |
| 88 | + organization_name = var.organization_name |
| 89 | + project_name = var.project_name |
| 90 | + repository_name = var.repository_name |
| 91 | +} |
| 92 | +
|
| 93 | +resource "powerplatform_solution_git_branch" "example" { |
| 94 | + count = var.enable_git_binding ? 1 : 0 |
| 95 | +
|
| 96 | + environment_id = powerplatform_environment.example.id |
| 97 | + git_integration_id = powerplatform_environment_git_integration.example[0].id |
| 98 | + solution_id = powerplatform_solution.example.id |
| 99 | + branch_name = var.branch_name |
| 100 | + upstream_branch_name = var.upstream_branch_name |
| 101 | + root_folder_path = var.root_folder_path |
| 102 | +} |
| 103 | +``` |
| 104 | + |
| 105 | +<!-- schema generated by tfplugindocs --> |
| 106 | +## Schema |
| 107 | + |
| 108 | +### Required |
| 109 | + |
| 110 | +- `branch_name` (String) Branch name to bind the solution partition to. |
| 111 | +- `environment_id` (String) Environment ID of the Dataverse environment where the branch binding exists. |
| 112 | +- `git_integration_id` (String) ID of the parent `powerplatform_environment_git_integration` resource. |
| 113 | +- `root_folder_path` (String) Repository folder path that stores the solution's files. |
| 114 | +- `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. |
| 115 | + |
| 116 | +### Optional |
| 117 | + |
| 118 | +- `timeouts` (Attributes) (see [below for nested schema](#nestedatt--timeouts)) |
| 119 | +- `upstream_branch_name` (String) Upstream branch name. When omitted, the provider will use the same value as `branch_name`. |
| 120 | + |
| 121 | +### Read-Only |
| 122 | + |
| 123 | +- `id` (String) Unique identifier of the Dataverse source control branch configuration. |
| 124 | + |
| 125 | +<a id="nestedatt--timeouts"></a> |
| 126 | +### Nested Schema for `timeouts` |
| 127 | + |
| 128 | +Optional: |
| 129 | + |
| 130 | +- `create` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). |
| 131 | +- `delete` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) 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. |
| 132 | +- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) 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. |
| 133 | +- `update` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). |
| 134 | + |
| 135 | +## Import |
| 136 | + |
| 137 | +Import is supported using the following syntax: |
| 138 | + |
| 139 | +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: |
| 140 | + |
| 141 | +```shell |
| 142 | +# Solution Git branch resources can be imported using environment_id/git_integration_id/solution_id |
| 143 | +# The final segment can be either the raw Dataverse solution id or the provider-formatted powerplatform_solution.id |
| 144 | +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 |
| 145 | +``` |
0 commit comments