Skip to content

Commit

Permalink
Merge branch 'main' into mawasile/cover-data-record-with-unit-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mawasile committed Jun 18, 2024
2 parents 8de0987 + 1857414 commit ed6fb88
Show file tree
Hide file tree
Showing 16 changed files with 1,827 additions and 65 deletions.
19 changes: 18 additions & 1 deletion docs/data-sources/data_loss_prevention_policies.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,24 @@ description: |-

Fetches the list of Data Loss Prevention Policies in a Power Platform tenant. See [Manage data loss prevention policies](https://learn.microsoft.com/power-platform/admin/prevent-data-loss) for more information.


## Example Usage

```terraform
terraform {
required_providers {
powerplatform = {
source = "microsoft/power-platform"
}
}
}
provider "powerplatform" {
use_cli = true
}
data "powerplatform_data_loss_prevention_policies" "tenant_data_loss_prevention_policies" {
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
408 changes: 408 additions & 0 deletions docs/data-sources/data_records.md

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions docs/resources/data_record.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ provider "powerplatform" {
use_cli = true
}
variable "parent_business_unit_id" {
type = string
description = "The parent business unit id"
data "powerplatform_data_records" "root_business_unit" {
environment_id = "a1e605fb-80ad-e1b2-bae0-f046efc0e641"
entity_collection = "businessunits"
filter = "parentbusinessunitid eq null"
select = ["name"]
}
resource "powerplatform_environment" "data_record_example_env" {
Expand All @@ -51,7 +53,7 @@ resource "powerplatform_data_record" "role" {
businessunitid = {
table_logical_name = "businessunit"
data_record_id = var.parent_business_unit_id
data_record_id = data.powerplatform_data_records.root_business_unit.rows[0].businessunitid
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion docs/resources/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ page_title: "powerplatform_user Resource - powerplatform"
subcategory: ""
description: |-
This resource associates a user to a Power Platform environment. Additional Resources:
Add users to an environment https://learn.microsoft.com/power-platform/admin/add-users-to-environmentOverview of User Security https://learn.microsoft.com/power-platform/admin/grant-users-access
Add users to an environment https://learn.microsoft.com/power-platform/admin/add-users-to-environment
Overview of User Security https://learn.microsoft.com/power-platform/admin/grant-users-access
---

# powerplatform_user (Resource)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
terraform {
required_providers {
powerplatform = {
source = "microsoft/power-platform"
}
}
}

provider "powerplatform" {
use_cli = true
}

data "powerplatform_data_loss_prevention_policies" "tenant_data_loss_prevention_policies" {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "all_applications" {
description = "All policies"
value = data.powerplatform_data_loss_prevention_policies.tenant_data_loss_prevention_policies.policies
}
42 changes: 42 additions & 0 deletions examples/data-sources/powerplatform_data_records/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
terraform {
required_providers {
powerplatform = {
source = "microsoft/power-platform"
}
}
}

provider "powerplatform" {
use_cli = true
}

resource "powerplatform_environment" "env" {
display_name = "powerplatform_data_record_example"
location = "europe"
environment_type = "Sandbox"
dataverse = {
language_code = "1033"
currency_code = "USD"
security_group_id = "00000000-0000-0000-0000-000000000000"
}
}

data "powerplatform_data_records" "data_query" {
environment_id = powerplatform_environment.env.id
entity_collection = "systemusers"
filter = "isdisabled eq false"
select = ["firstname", "lastname", "domainname"]
top = 2
order_by = "lastname asc"

expand = [
{
navigation_property = "systemuserroles_association",
select = ["name"],
},
{
navigation_property = "teammembership_association",
select = ["name"],
}
]
}
4 changes: 4 additions & 0 deletions examples/data-sources/powerplatform_data_records/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "query_result" {
description = "Query result"
value = data.powerplatform_data_records.data_query.rows
}
10 changes: 6 additions & 4 deletions examples/resources/powerplatform_data_record/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ provider "powerplatform" {
use_cli = true
}

variable "parent_business_unit_id" {
type = string
description = "The parent business unit id"

data "powerplatform_data_records" "root_business_unit" {
environment_id = "a1e605fb-80ad-e1b2-bae0-f046efc0e641"
entity_collection = "businessunits"
filter = "parentbusinessunitid eq null"
select = ["name"]
}

resource "powerplatform_environment" "data_record_example_env" {
Expand All @@ -36,7 +38,7 @@ resource "powerplatform_data_record" "role" {

businessunitid = {
table_logical_name = "businessunit"
data_record_id = var.parent_business_unit_id
data_record_id = data.powerplatform_data_records.root_business_unit.rows[0].businessunitid
}
}
}
Expand Down
Loading

0 comments on commit ed6fb88

Please sign in to comment.