Skip to content

Commit 9ce3d0d

Browse files
authored
feat: added resource group_policy_uploaded_definition_files and datasource group_policy_category (#753)
# Pull Request Description ## Summary [Provide a brief description of the changes in this PR] ### Issue Reference Fixes #[Issue Number] ### Motivation and Context - Why is this change needed? - What problem does it solve? - If it fixes an open issue, please link to the issue here ### Dependencies - List any dependencies that are required for this change - Include any configuration changes needed - Note any version updates required ## Type of Change Please mark the relevant option with an `x`: - [ ] 🐛 Bug fix (non-breaking change which fixes an issue) - [ ] ✨ New feature (non-breaking change which adds functionality) - [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 📝 Documentation update (Wiki/README/Code comments) - [ ] ♻️ Refactor (code improvement without functional changes) - [ ] 🎨 Style update (formatting, renaming) - [ ] 🔧 Configuration change - [ ] 📦 Dependency update ## Testing - [ ] I have added unit tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] I have tested this code in the following browsers/environments: [list environments] ## Quality Checklist - [ ] I have reviewed my own code before requesting review - [ ] I have verified there are no other open Pull Requests for the same update/change - [ ] All CI/CD pipelines pass without errors or warnings - [ ] My code follows the established style guidelines of this project - [ ] I have added necessary documentation (if appropriate) - [ ] I have commented my code, particularly in complex areas - [ ] I have made corresponding changes to the README and other relevant documentation - [ ] My changes generate no new warnings - [ ] I have performed a self-review of my own code - [ ] My code is properly formatted according to project standards ## Screenshots/Recordings (if appropriate) [Add screenshots or recordings that demonstrate the changes] ## Additional Notes [Add any additional information that might be helpful for reviewers]
2 parents d212c1e + 742258b commit 9ce3d0d

File tree

36 files changed

+2941
-1
lines changed

36 files changed

+2941
-1
lines changed
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
---
2+
page_title: "microsoft365_graph_beta_device_management_group_policy_category Data Source - terraform-provider-microsoft365"
3+
subcategory: "Device Management"
4+
5+
description: |-
6+
This data source retrieves comprehensive information about a specific Group Policy setting by performing three sequential Microsoft Graph API calls:
7+
GET /deviceManagement/groupPolicyCategories?$expand=parent,definitions&$select=id,displayName,isRoot,ingestionSource - Retrieves all categories with their definitionsGET /deviceManagement/groupPolicyDefinitions('{id}') - Gets detailed information about the specific policy definitionGET /deviceManagement/groupPolicyDefinitions('{id}')/presentations - Retrieves all presentation configurations for the policy
8+
The data source consolidates information from all three API calls into a single Terraform resource, making it easy to access category details, policy definitions, and presentation configurations (including dropdown options, text boxes, checkboxes, etc.) for a given Group Policy setting.
9+
Permissions
10+
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions https://docs.microsoft.com/en-us/graph/permissions-reference.
11+
|Permission type|Permissions (from least to most privileged)|
12+
|:---|:---|
13+
|Delegated (work or school account)|DeviceManagementConfiguration.Read.All, DeviceManagementConfiguration.ReadWrite.All|
14+
|Delegated (personal Microsoft account)|Not supported.|
15+
|Application|DeviceManagementConfiguration.Read.All, DeviceManagementConfiguration.ReadWrite.All|
16+
---
17+
18+
# microsoft365_graph_beta_device_management_group_policy_category (Data Source)
19+
20+
The Microsoft 365 Intune group policy category data source returns detailed information on every available group
21+
policy available for configuration. This data source supports a search by group policy name and will return all matching
22+
group policies, there settings and presentations. PResentations in this context, means the possible configuration choices
23+
that are support for a given group policy setting.
24+
25+
## Microsoft Documentation
26+
27+
- [groupPolicyCategory resource type](https://learn.microsoft.com/en-us/graph/api/resources/intune-grouppolicy-grouppolicycategory?view=graph-rest-beta)
28+
29+
## API Permissions
30+
31+
The following API permissions are required in order to use this data source.
32+
33+
### Microsoft Graph
34+
35+
- **Application**: `DeviceManagementConfiguration.Read.All`
36+
37+
## Version History
38+
39+
| Version | Status | Notes |
40+
|---------|--------|-------|
41+
| v0.29.0-alpha | Experimental | Initial release |
42+
43+
## Example Usage
44+
45+
```terraform
46+
# Get the WSL networking configuration setting
47+
data "microsoft365_graph_beta_device_management_group_policy_category" "wsl_networking" {
48+
setting_name = "Configure default networking mode" // Define the group policy item you wish to return
49+
50+
timeouts = {
51+
read = "5m"
52+
}
53+
}
54+
55+
# Output the complete data structure
56+
output "wsl_networking_setting" {
57+
description = "Complete group policy setting information from all three API calls"
58+
value = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking
59+
}
60+
61+
# Access group policy top tier list
62+
output "category_info" {
63+
description = "Category information from the first API call"
64+
value = {
65+
id = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.category.id
66+
display_name = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.category.display_name
67+
is_root = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.category.is_root
68+
ingestion_source = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.category.ingestion_source
69+
parent_category = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.category.parent
70+
}
71+
}
72+
73+
# Access group policy definition by id (from 2nd API call)
74+
output "definition_info" {
75+
description = "Detailed policy definition from the second API call"
76+
value = {
77+
id = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.definition.id
78+
display_name = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.definition.display_name
79+
explain_text = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.definition.explain_text
80+
category_path = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.definition.category_path
81+
class_type = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.definition.class_type
82+
policy_type = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.definition.policy_type
83+
version = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.definition.version
84+
has_related_definitions = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.definition.has_related_definitions
85+
group_policy_category_id = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.definition.group_policy_category_id
86+
min_device_csp_version = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.definition.min_device_csp_version
87+
min_user_csp_version = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.definition.min_user_csp_version
88+
supported_on = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.definition.supported_on
89+
last_modified_date_time = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.definition.last_modified_date_time
90+
}
91+
}
92+
93+
# Access presentation information (from 3rd API call) - now properly populated!
94+
output "presentation_info" {
95+
description = "Presentation configuration from the third API call - dropdown with options"
96+
value = {
97+
presentation_id = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.presentations[0].id
98+
odata_type = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.presentations[0].odata_type
99+
label = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.presentations[0].label
100+
required = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.presentations[0].required
101+
last_modified_date_time = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.presentations[0].last_modified_date_time
102+
103+
# Dropdown-specific properties.
104+
default_item = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.presentations[0].default_item
105+
available_options = data.microsoft365_graph_beta_device_management_group_policy_category.wsl_networking.presentations[0].items
106+
}
107+
}
108+
```
109+
110+
<!-- schema generated by tfplugindocs -->
111+
## Schema
112+
113+
### Required
114+
115+
- `setting_name` (String) The display name of the Group Policy setting to search for (case-insensitive)
116+
117+
### Optional
118+
119+
- `timeouts` (Attributes) (see [below for nested schema](#nestedatt--timeouts))
120+
121+
### Read-Only
122+
123+
- `category` (Attributes) The Group Policy category information from the first API call (see [below for nested schema](#nestedatt--category))
124+
- `definition` (Attributes) The detailed Group Policy definition information from the second API call (see [below for nested schema](#nestedatt--definition))
125+
- `id` (String) The unique identifier for this data source
126+
- `presentations` (Attributes List) The list of presentations associated with the group policy definition from the third API call (see [below for nested schema](#nestedatt--presentations))
127+
128+
<a id="nestedatt--timeouts"></a>
129+
### Nested Schema for `timeouts`
130+
131+
Optional:
132+
133+
- `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).
134+
- `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.
135+
- `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.
136+
- `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).
137+
138+
139+
<a id="nestedatt--category"></a>
140+
### Nested Schema for `category`
141+
142+
Read-Only:
143+
144+
- `display_name` (String) The display name of the category
145+
- `id` (String) The unique identifier of the category
146+
- `ingestion_source` (String) The source of the category (e.g., builtIn, custom)
147+
- `is_root` (Boolean) Indicates if the category is a root category
148+
- `parent` (Attributes) The parent category if this is not a root category (see [below for nested schema](#nestedatt--category--parent))
149+
150+
<a id="nestedatt--category--parent"></a>
151+
### Nested Schema for `category.parent`
152+
153+
Read-Only:
154+
155+
- `display_name` (String) The display name of the parent category
156+
- `id` (String) The unique identifier of the parent category
157+
- `is_root` (Boolean) Indicates if the parent category is a root category
158+
159+
160+
161+
<a id="nestedatt--definition"></a>
162+
### Nested Schema for `definition`
163+
164+
Read-Only:
165+
166+
- `category_path` (String) The category path of the definition
167+
- `class_type` (String) The class type of the definition (e.g., machine, user)
168+
- `display_name` (String) The display name of the definition
169+
- `explain_text` (String) The explanation text for the definition
170+
- `group_policy_category_id` (String) The ID of the group policy category this definition belongs to
171+
- `has_related_definitions` (Boolean) Indicates if the definition has related definitions
172+
- `id` (String) The unique identifier of the definition
173+
- `last_modified_date_time` (String) The date and time the definition was last modified
174+
- `min_device_csp_version` (String) The minimum device CSP version required
175+
- `min_user_csp_version` (String) The minimum user CSP version required
176+
- `policy_type` (String) The policy type of the definition
177+
- `supported_on` (String) The supported platforms for the definition
178+
- `version` (String) The version of the definition
179+
180+
181+
<a id="nestedatt--presentations"></a>
182+
### Nested Schema for `presentations`
183+
184+
Read-Only:
185+
186+
- `default_checked` (Boolean) Whether the checkbox is checked by default
187+
- `default_decimal_value` (Number) The default decimal value for decimal text box presentations
188+
- `default_item` (Attributes) The default item for dropdown list presentations (see [below for nested schema](#nestedatt--presentations--default_item))
189+
- `default_value` (String) The default value for text box presentations
190+
- `explicit_value` (Boolean) Whether the user must specify the registry subkey value and name for list box presentations
191+
- `id` (String) The ID of the presentation
192+
- `items` (Attributes List) The list of items for dropdown list presentations (see [below for nested schema](#nestedatt--presentations--items))
193+
- `label` (String) The localized text label for the presentation
194+
- `last_modified_date_time` (String) The date and time the entity was last modified
195+
- `max_length` (Number) The maximum length for text box presentations
196+
- `max_value` (Number) The maximum value for decimal text box presentations
197+
- `min_value` (Number) The minimum value for decimal text box presentations
198+
- `odata_type` (String) The OData type of the presentation (e.g., #microsoft.graph.groupPolicyPresentationDropdownList)
199+
- `required` (Boolean) Whether a value is required for the parameter box (if applicable)
200+
- `spin` (Boolean) Whether spin controls are enabled for decimal text box presentations
201+
- `spin_step` (Number) The spin step for decimal text box presentations
202+
- `value_prefix` (String) The value prefix for list box presentations
203+
204+
<a id="nestedatt--presentations--default_item"></a>
205+
### Nested Schema for `presentations.default_item`
206+
207+
Read-Only:
208+
209+
- `display_name` (String) The display name of the default item
210+
- `value` (String) The value of the default item
211+
212+
213+
<a id="nestedatt--presentations--items"></a>
214+
### Nested Schema for `presentations.items`
215+
216+
Read-Only:
217+
218+
- `display_name` (String) The display name of the item
219+
- `value` (String) The value of the item
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
page_title: "microsoft365_graph_beta_device_management_group_policy_uploaded_definition_files Resource - terraform-provider-microsoft365"
3+
subcategory: "Device Management"
4+
5+
description: |-
6+
Manages group policy uploaded definition files in Microsoft Intune using the /deviceManagement/groupPolicyUploadedDefinitionFiles endpoint. Group policy uploaded definition files are ADMX files that define group policies that can be deployed to devices.
7+
---
8+
9+
# microsoft365_graph_beta_device_management_group_policy_uploaded_definition_files (Resource)
10+
11+
Manages group policy uploaded definition files in Microsoft Intune using the `/deviceManagement/groupPolicyUploadedDefinitionFiles` endpoint. Group policy uploaded definition files are ADMX files that define group policies that can be deployed to devices.
12+
13+
## Microsoft Documentation
14+
15+
- [groupPolicyUploadedDefinitionFiles resource type](https://learn.microsoft.com/en-us/graph/api/resources/intune-grouppolicy-grouppolicyuploadeddefinitionfile?view=graph-rest-beta)
16+
- [Create groupPolicyUploadedDefinitionFiles](https://learn.microsoft.com/en-us/graph/api/intune-grouppolicy-grouppolicyuploadeddefinitionfile-create?view=graph-rest-beta)
17+
- [Update groupPolicyUploadedDefinitionFiles](https://learn.microsoft.com/en-us/graph/api/intune-grouppolicy-grouppolicyuploadeddefinitionfile-update?view=graph-rest-beta)
18+
- [Delete groupPolicyUploadedDefinitionFiles](https://learn.microsoft.com/en-us/graph/api/intune-grouppolicy-grouppolicyuploadeddefinitionfile-delete?view=graph-rest-beta)
19+
20+
## API Permissions
21+
22+
The following API permissions are required in order to use this resource.
23+
24+
### Microsoft Graph
25+
26+
- **Application**: `DeviceManagementConfiguration.ReadWrite.All`
27+
28+
## Version History
29+
30+
| Version | Status | Notes |
31+
|---------|--------|-------|
32+
| v0.29.0-alpha | Experimental | Initial release |
33+
34+
## Example Usage
35+
36+
```terraform
37+
# admx/adml for mozilla. which is a pre-req for the firefox files of the same
38+
resource "microsoft365_graph_beta_device_management_group_policy_uploaded_definition_files" "moziila" {
39+
file_name = "mozilla.admx"
40+
content = <<-EOT
41+
<?xml version="1.0" ?>
42+
<policyDefinitions revision="4.8" schemaVersion="1.0">
43+
<policyNamespaces>
44+
<target namespace="Mozilla.Policies" prefix="Mozilla"/>
45+
</policyNamespaces>
46+
<resources minRequiredRevision="4.8" />
47+
<categories>
48+
<category displayName="$(string.mozilla)" name="Cat_Mozilla"/>
49+
</categories>
50+
</policyDefinitions>
51+
EOT
52+
53+
group_policy_uploaded_language_files = [
54+
{
55+
file_name = "mozilla.adml"
56+
language_code = "en-US"
57+
content = <<-EOT
58+
<?xml version="1.0" ?>
59+
<policyDefinitionResources revision="4.8" schemaVersion="1.0">
60+
<displayName/>
61+
<description/>
62+
<resources>
63+
<stringTable>
64+
<string id="mozilla">Mozilla</string>
65+
</stringTable>
66+
</resources>
67+
</policyDefinitionResources>
68+
EOT
69+
}
70+
]
71+
72+
timeouts = {
73+
create = "10m" // allow a generous amount of time for the upload to complete
74+
read = "5m"
75+
update = "10m"
76+
delete = "5m"
77+
}
78+
}
79+
```
80+
81+
<!-- schema generated by tfplugindocs -->
82+
## Schema
83+
84+
### Required
85+
86+
- `content` (String) The content of the group policy uploaded definition file. Request is sent as raw bytes. This is a write-only field and will not be stored in state.
87+
- `file_name` (String) The file name of the group policy uploaded definition file.
88+
89+
### Optional
90+
91+
- `description` (String) The description of the group policy uploaded definition file.
92+
- `display_name` (String) The display name of the group policy uploaded definition file.
93+
- `group_policy_uploaded_language_files` (Attributes Set) The language files associated with the group policy uploaded definition file. (see [below for nested schema](#nestedatt--group_policy_uploaded_language_files))
94+
- `timeouts` (Attributes) (see [below for nested schema](#nestedatt--timeouts))
95+
96+
### Read-Only
97+
98+
- `default_language_code` (String) The default language code of the group policy uploaded definition file.
99+
- `id` (String) The ID of the group policy uploaded definition file.
100+
- `language_codes` (List of String) The language codes supported by the group policy uploaded definition file.
101+
- `last_modified_date_time` (String) The date and time when the group policy uploaded definition file was last modified.
102+
- `policy_type` (String) The policy type of the group policy uploaded definition file.
103+
- `revision` (String) The revision of the group policy uploaded definition file.
104+
- `status` (String) The status of the group policy uploaded definition file. Possible values are: uploadInProgress, available, uploadFailed.
105+
- `target_namespace` (String) The target namespace of the group policy uploaded definition file.
106+
- `target_prefix` (String) The target prefix of the group policy uploaded definition file.
107+
- `upload_date_time` (String) The date and time when the group policy uploaded definition file was uploaded.
108+
109+
<a id="nestedatt--group_policy_uploaded_language_files"></a>
110+
### Nested Schema for `group_policy_uploaded_language_files`
111+
112+
Required:
113+
114+
- `content` (String) The content of the group policy uploaded language file. Request is sent as raw bytes. This is a write-only field and will not be stored in state.
115+
- `file_name` (String) The file name of the group policy uploaded language file.
116+
- `language_code` (String) The language code of the group policy uploaded language file.
117+
118+
119+
<a id="nestedatt--timeouts"></a>
120+
### Nested Schema for `timeouts`
121+
122+
Optional:
123+
124+
- `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).
125+
- `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.
126+
- `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.
127+
- `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).
128+
129+
## Import
130+
131+
Import is supported using the following syntax:
132+
133+
```shell
134+
# {resource_id}
135+
terraform import microsoft365_graph_beta_device_management_group_policy_uploaded_definition_files.example 976886d5-f758-4cd9-9c80-b30b7355bfcb
136+
```

0 commit comments

Comments
 (0)