Skip to content

Commit abc20e0

Browse files
authored
adding powerplatform_connection and powerplatform_connection_share (#377)
* wip * Squashed commit of the following: commit 1b8c806 Author: mawasile <[email protected]> Date: Wed May 15 01:37:57 2024 +0200 resource/datasource primary id should not changes on reapply (#292) * chore: making unique resource/datasource id stable & fixing unit tests * chore: fixing acceptance tests * chore: update display_name in powerplatform environment resources * adding new acceptance tests for dlp policies --------- Co-authored-by: Eduardo Sanchez <[email protected]> commit 6142aaf Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue May 14 17:21:38 2024 -0600 Bump hashicorp/local in /examples/resources/powerplatform_solution (#298) Bumps [hashicorp/local](https://github.com/hashicorp/terraform-provider-local) from 2.4.0 to 2.5.1. - [Release notes](https://github.com/hashicorp/terraform-provider-local/releases) - [Changelog](https://github.com/hashicorp/terraform-provider-local/blob/main/CHANGELOG.md) - [Commits](hashicorp/terraform-provider-local@v2.4.0...v2.5.1) --- updated-dependencies: - dependency-name: hashicorp/local dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 54a1173 Author: Matt Dotson <[email protected]> Date: Mon May 13 23:46:54 2024 -0700 Addition of example directories for dependabot scanning (#296) * manual addition of example directories * fix duplicate path commit b6b0eec Author: Eduardo Sanchez <[email protected]> Date: Mon May 13 15:30:55 2024 -0600 Updating Go version and modify tfproviderlint actions to use specified go version (#284) * Updating Go version. * Disable tfproviderlint. * Testing with go vet. * Changing run order. * Placing all runs inside one job. * testing with: /usr/bin/tfproviderlint ./... * changing path for tfproviderlint. * testing setup go. * Show directory path. * Applying comments and updating version. * Updating devcontainer version. * Disabling tfproviderlint. --------- Co-authored-by: Eduardo Sanchez <[email protected]> Co-authored-by: mawasile <[email protected]> commit 236a1bf Author: mawasile <[email protected]> Date: Mon May 13 20:02:26 2024 +0200 Updating developer guide with additional Information (#290) * chore: Update documentation for developer workflow and setup instructions * chore: Update developer documentation and add unit tests for new feature * update docs * chore: Update developer documentation, add unit tests, and regenerate docs * Update DEVELOPER.md Co-authored-by: Matt Dotson <[email protected]> --------- Co-authored-by: Matt Dotson <[email protected]> commit ff470f7 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon May 13 11:25:35 2024 -0600 Bump goreleaser/goreleaser-action from 5.0.0 to 5.1.0 (#293) Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 5.0.0 to 5.1.0. - [Release notes](https://github.com/goreleaser/goreleaser-action/releases) - [Commits](goreleaser/goreleaser-action@7ec5c2b...5742e2a) --- updated-dependencies: - dependency-name: goreleaser/goreleaser-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit dce39d9 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon May 13 11:25:04 2024 -0600 Bump goreleaser/goreleaser-action in /.github/workflows (#294) Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 5.0.0 to 5.1.0. - [Release notes](https://github.com/goreleaser/goreleaser-action/releases) - [Commits](goreleaser/goreleaser-action@7ec5c2b...5742e2a) --- updated-dependencies: - dependency-name: goreleaser/goreleaser-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 0db25c3 Author: Raphael Pothin <[email protected]> Date: Fri May 10 11:12:33 2024 -0400 Fix proposition for the inversion between "Business" and "Non-business" connectors groups in Power Platform DLP policies (#291) * addind datasource_connections * wip * feat: Add GetConnectorDefinition method to ConnectionsClient * wip * ading basic functionality * lint fix * connection shares datsource * feat: Add Azure OpenAI connection output The code changes add a new output for the Azure OpenAI connection in the `powerplatform_connection` module. This output provides the description, value, and sensitivity of the connection. * change to documentation * adding TestAccConnectionssDataSource_Validate_Read * adding tests * adding test * adding acceptance tests * adding unit tests * chore: Add connection shares data source * removing unused method * filename typo fix
1 parent 32cd4c3 commit abc20e0

File tree

33 files changed

+2673
-10
lines changed

33 files changed

+2673
-10
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "powerplatform_connection_shares Data Source - powerplatform"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# powerplatform_connection_shares (Data Source)
10+
11+
12+
13+
## Example Usage
14+
15+
```terraform
16+
terraform {
17+
required_providers {
18+
powerplatform = {
19+
source = "microsoft/power-platform"
20+
}
21+
}
22+
}
23+
24+
provider "powerplatform" {
25+
use_cli = true
26+
}
27+
28+
data "powerplatform_connection_shares" "all_shares" {
29+
environment_id = var.environment_id
30+
connector_name = "shared_azureopenai"
31+
connection_id = var.azure_openai_connection_id
32+
}
33+
```
34+
35+
<!-- schema generated by tfplugindocs -->
36+
## Schema
37+
38+
### Required
39+
40+
- `connection_id` (String) Connection Id. The unique identifier of the connection that the shares are associated with.
41+
- `connector_name` (String) Connector Name. The unique identifier of the connector that the connection are associated with.
42+
- `environment_id` (String) Environment Id. The unique identifier of the environment that the connection are associated with.
43+
44+
### Read-Only
45+
46+
- `id` (String) The ID of this resource.
47+
- `shares` (Attributes List) List of shares for a given connection. (see [below for nested schema](#nestedatt--shares))
48+
49+
<a id="nestedatt--shares"></a>
50+
### Nested Schema for `shares`
51+
52+
Read-Only:
53+
54+
- `id` (String) Unique share id
55+
- `principal` (Attributes) (see [below for nested schema](#nestedatt--shares--principal))
56+
- `role_name` (String) Role name of the share
57+
58+
<a id="nestedatt--shares--principal"></a>
59+
### Nested Schema for `shares.principal`
60+
61+
Read-Only:
62+
63+
- `display_name` (String) Principal Display Name
64+
- `entra_object_id` (String) Entra Object Id of the principal

docs/data-sources/connections.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "powerplatform_connections Data Source - powerplatform"
4+
subcategory: ""
5+
description: |-
6+
Fetches a list of Connection https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/add-manage-connections for a given environment. Each connection represents an connection instance to an external data source or service.
7+
---
8+
9+
# powerplatform_connections (Data Source)
10+
11+
Fetches a list of [Connection](https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/add-manage-connections) for a given environment. Each connection represents an connection instance to an external data source or service.
12+
13+
## Example Usage
14+
15+
```terraform
16+
terraform {
17+
required_providers {
18+
powerplatform = {
19+
source = "microsoft/power-platform"
20+
}
21+
}
22+
}
23+
24+
provider "powerplatform" {
25+
use_cli = true
26+
}
27+
28+
data "powerplatform_environments" "all_environments" {}
29+
30+
data "powerplatform_connections" "all_connections" {
31+
environment_id = data.powerplatform_environments.all_environments.environments[0].id
32+
}
33+
```
34+
35+
<!-- schema generated by tfplugindocs -->
36+
## Schema
37+
38+
### Required
39+
40+
- `environment_id` (String) Environment Id. The unique identifier of the environment that the connection are associated with.
41+
42+
### Read-Only
43+
44+
- `connections` (Attributes List) List of Connections (see [below for nested schema](#nestedatt--connections))
45+
- `id` (String) The ID of this resource.
46+
47+
<a id="nestedatt--connections"></a>
48+
### Nested Schema for `connections`
49+
50+
Read-Only:
51+
52+
- `connection_parameters` (String) Connection parameters. Json string containing the authentication connection parameters (if connection is interactive, leave blank), (for example)[https://learn.microsoft.com/en-us/power-automate/desktop-flows/alm/alm-connection#create-a-connection-using-your-service-principal]. Depending on required authentication parameters of a given connector, the connection parameters can vary.
53+
- `connection_parameters_set` (String) Set of connection parameters. Json string containing the authentication connection parameters (if connection is interactive, leave blank), (for example)[https://learn.microsoft.com/en-us/power-automate/desktop-flows/alm/alm-connection#create-a-connection-using-your-service-principal]. Depending on required authentication parameters of a given connector, the connection parameters can vary.
54+
- `display_name` (String) Display name of the connection.
55+
- `id` (String) Unique connection id
56+
- `name` (String) Name of the connection.
57+
- `status` (Set of String) List of connection statuses

docs/resources/connection.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "powerplatform_connection Resource - powerplatform"
4+
subcategory: ""
5+
description: |-
6+
Manages a Connection https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/add-manage-connections. A connection in Power Platform serves as a means to integrate external data sources and services with your Power Platform apps, flows, and other solutions. It acts as a bridge, facilitating secure communication between your solutions and various external systems.
7+
---
8+
9+
# powerplatform_connection (Resource)
10+
11+
Manages a [Connection](https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/add-manage-connections). A connection in Power Platform serves as a means to integrate external data sources and services with your Power Platform apps, flows, and other solutions. It acts as a bridge, facilitating secure communication between your solutions and various external systems.
12+
13+
## Example Usage
14+
15+
```terraform
16+
terraform {
17+
required_providers {
18+
powerplatform = {
19+
source = "microsoft/power-platform"
20+
}
21+
}
22+
}
23+
24+
provider "powerplatform" {
25+
use_cli = true
26+
}
27+
28+
29+
resource "powerplatform_connection" "azure_openai_connection" {
30+
environment_id = var.environment_id
31+
name = "shared_azureopenai"
32+
display_name = "OpenAI Connection"
33+
connection_parameters = jsonencode({
34+
"azureOpenAIResourceName" : "${var.azure_openai_resource_name}",
35+
"azureOpenAIApiKey" : "${var.azure_openai_api_key}"
36+
"azureSearchEndpointUrl" : "${var.azure_search_endpoint_url}",
37+
"azureSearchApiKey" : "${var.azure_search_api_key}"
38+
})
39+
40+
lifecycle {
41+
ignore_changes = [
42+
connection_parameters
43+
]
44+
}
45+
}
46+
```
47+
48+
<!-- schema generated by tfplugindocs -->
49+
## Schema
50+
51+
### Required
52+
53+
- `display_name` (String) Display name of the connection
54+
- `environment_id` (String) Environment id where the connection is to be created
55+
- `name` (String) Name of the connection. This can be found using `powerplatform_connectors` data source by using the `name` attribute
56+
57+
### Optional
58+
59+
- `connection_parameters` (String) Connection parameters. Json string containing the authentication connection parameters (if connection is interactive, leave blank), (for example)[https://learn.microsoft.com/en-us/power-automate/desktop-flows/alm/alm-connection#create-a-connection-using-your-service-principal]. Depending on required authentication parameters of a given connector, the connection parameters can vary. Due to how connection parameters and served by the platform, not all values are retrieved. If you don't want the connection to requried in-place-update all the time, consider using `ignore_changes` in the resource block.
60+
- `connection_parameters_set` (String) Set of connection parameters. Json string containing the authentication connection parameters (if connection is interactive, leave blank), (for example)[https://learn.microsoft.com/en-us/power-automate/desktop-flows/alm/alm-connection#create-a-connection-using-your-service-principal]. Depending on required authentication parameters of a given connector, the connection parameters can vary. Due to how connection parameters and served by the platform, not all values are retrieved. If you don't want the connection to requried in-place-update all the time, consider using `ignore_changes` in the resource block.
61+
62+
### Read-Only
63+
64+
- `id` (String) Unique connection id
65+
- `status` (Set of String) List of connection statuses

docs/resources/connection_share.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "powerplatform_connection_share Resource - powerplatform"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# powerplatform_connection_share (Resource)
10+
11+
12+
13+
## Example Usage
14+
15+
```terraform
16+
terraform {
17+
required_providers {
18+
powerplatform = {
19+
source = "microsoft/power-platform"
20+
}
21+
}
22+
}
23+
24+
provider "powerplatform" {
25+
use_cli = true
26+
}
27+
28+
29+
resource "powerplatform_connection" "new_sql_connection" {
30+
environment_id = var.environment_id
31+
name = "shared_sql"
32+
display_name = "My SQL Connection"
33+
connection_parameters_set = jsonencode({
34+
"name" : "oauthSP",
35+
"values" : {
36+
"token" : {
37+
"value" : "https://global.consent.azure-apim.net/redirect/sql"
38+
},
39+
"token:TenantId" : {
40+
"value" : "${var.tenant_id}"
41+
},
42+
"token:clientId" : {
43+
"value" : "${var.client_id}"
44+
},
45+
"token:clientSecret" : {
46+
"value" : "${var.client_secret}"
47+
}
48+
}
49+
})
50+
51+
lifecycle {
52+
ignore_changes = [
53+
connection_parameters_set
54+
]
55+
}
56+
}
57+
58+
resource "powerplatform_connection_share" "share_with_admin" {
59+
environment_id = var.environment_id
60+
connector_name = powerplatform_connection.new_sql_connection.name
61+
connection_id = powerplatform_connection.new_sql_connection.id
62+
role_name = "CanEdit"
63+
principal = {
64+
entra_object_id = var.user_object_id
65+
}
66+
}
67+
```
68+
69+
<!-- schema generated by tfplugindocs -->
70+
## Schema
71+
72+
### Required
73+
74+
- `connection_id` (String) Unique identifier of the connection
75+
- `connector_name` (String) Name of the connector
76+
- `environment_id` (String) Unique identifier of the environment
77+
- `principal` (Attributes) Principal to share the connection with (see [below for nested schema](#nestedatt--principal))
78+
- `role_name` (String) Name of the role to assign to the principal
79+
80+
### Read-Only
81+
82+
- `id` (String) Unique identifier of the connection share
83+
84+
<a id="nestedatt--principal"></a>
85+
### Nested Schema for `principal`
86+
87+
Required:
88+
89+
- `entra_object_id` (String) Entra Object Id of the principal
90+
91+
Read-Only:
92+
93+
- `display_name` (String) Display name of the principal
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
terraform {
2+
required_providers {
3+
powerplatform = {
4+
source = "microsoft/power-platform"
5+
}
6+
}
7+
}
8+
9+
provider "powerplatform" {
10+
use_cli = true
11+
}
12+
13+
data "powerplatform_connection_shares" "all_shares" {
14+
environment_id = var.environment_id
15+
connector_name = "shared_azureopenai"
16+
connection_id = var.azure_openai_connection_id
17+
}
18+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "all_shared_connections" {
2+
description = "All shares for a given connection and a given environment"
3+
value = data.powerplatform_connection_shares.all_shares
4+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
variable "environment_id" {
2+
default = "00000000-0000-0000-0000-000000000001"
3+
description = "Unique identifier of the environment"
4+
type = string
5+
}
6+
7+
variable "azure_openai_connection_id" {
8+
default = "00000000-0000-0000-0000-000000000002"
9+
description = "Unique identifier of the connection"
10+
type = string
11+
12+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
terraform {
2+
required_providers {
3+
powerplatform = {
4+
source = "microsoft/power-platform"
5+
}
6+
}
7+
}
8+
9+
provider "powerplatform" {
10+
use_cli = true
11+
}
12+
13+
data "powerplatform_environments" "all_environments" {}
14+
15+
data "powerplatform_connections" "all_connections" {
16+
environment_id = data.powerplatform_environments.all_environments.environments[0].id
17+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "all_connections" {
2+
description = "All connections avaiable in Power Platform for a given environment"
3+
value = data.powerplatform_connections.all_connections
4+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
output "azure_openai_connection" {
3+
description = "New Azure Open AI connection"
4+
value = powerplatform_connection.azure_openai_connection
5+
sensitive = true
6+
}

0 commit comments

Comments
 (0)