V2Policy Orchestrator For Organization
PolicyOrchestrator helps managing project+zone level policy resources (e.g. OS Policy Assignments), by providing tools to create, update and delete them across projects and locations, at scale.
Example Usage
Osconfigv2 Policy Orchestrator For Organization Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const policyOrchestratorForOrganization = new gcp.osconfig.V2PolicyOrchestratorForOrganization("policy_orchestrator_for_organization", {
policyOrchestratorId: "po-org",
organizationId: "123456789",
state: "ACTIVE",
action: "UPSERT",
orchestratedResource: {
id: "test-orchestrated-resource-org",
osPolicyAssignmentV1Payload: {
osPolicies: [{
id: "test-os-policy-org",
mode: "VALIDATION",
resourceGroups: [{
resources: [{
id: "resource-tf",
file: {
content: "file-content-tf",
path: "file-path-tf-1",
state: "PRESENT",
},
}],
}],
}],
instanceFilter: {
inventories: [{
osShortName: "windows-10",
}],
},
rollout: {
disruptionBudget: {
percent: 100,
},
minWaitDuration: "60s",
},
},
},
labels: {
state: "active",
},
orchestrationScope: {
selectors: [{
locationSelector: {
includedLocations: [""],
},
}],
},
});
import pulumi
import pulumi_gcp as gcp
policy_orchestrator_for_organization = gcp.osconfig.V2PolicyOrchestratorForOrganization("policy_orchestrator_for_organization",
policy_orchestrator_id="po-org",
organization_id="123456789",
state="ACTIVE",
action="UPSERT",
orchestrated_resource={
"id": "test-orchestrated-resource-org",
"os_policy_assignment_v1_payload": {
"os_policies": [{
"id": "test-os-policy-org",
"mode": "VALIDATION",
"resource_groups": [{
"resources": [{
"id": "resource-tf",
"file": {
"content": "file-content-tf",
"path": "file-path-tf-1",
"state": "PRESENT",
},
}],
}],
}],
"instance_filter": {
"inventories": [{
"os_short_name": "windows-10",
}],
},
"rollout": {
"disruption_budget": {
"percent": 100,
},
"min_wait_duration": "60s",
},
},
},
labels={
"state": "active",
},
orchestration_scope={
"selectors": [{
"location_selector": {
"included_locations": [""],
},
}],
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var policyOrchestratorForOrganization = new Gcp.OsConfig.V2PolicyOrchestratorForOrganization("policy_orchestrator_for_organization", new()
{
PolicyOrchestratorId = "po-org",
OrganizationId = "123456789",
State = "ACTIVE",
Action = "UPSERT",
OrchestratedResource = new Gcp.OsConfig.Inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceArgs
{
Id = "test-orchestrated-resource-org",
OsPolicyAssignmentV1Payload = new Gcp.OsConfig.Inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadArgs
{
OsPolicies = new[]
{
new Gcp.OsConfig.Inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyArgs
{
Id = "test-os-policy-org",
Mode = "VALIDATION",
ResourceGroups = new[]
{
new Gcp.OsConfig.Inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyResourceGroupArgs
{
Resources = new[]
{
new Gcp.OsConfig.Inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyResourceGroupResourceArgs
{
Id = "resource-tf",
File = new Gcp.OsConfig.Inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyResourceGroupResourceFileArgs
{
Content = "file-content-tf",
Path = "file-path-tf-1",
State = "PRESENT",
},
},
},
},
},
},
},
InstanceFilter = new Gcp.OsConfig.Inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadInstanceFilterArgs
{
Inventories = new[]
{
new Gcp.OsConfig.Inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadInstanceFilterInventoryArgs
{
OsShortName = "windows-10",
},
},
},
Rollout = new Gcp.OsConfig.Inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadRolloutArgs
{
DisruptionBudget = new Gcp.OsConfig.Inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadRolloutDisruptionBudgetArgs
{
Percent = 100,
},
MinWaitDuration = "60s",
},
},
},
Labels =
{
{ "state", "active" },
},
OrchestrationScope = new Gcp.OsConfig.Inputs.V2PolicyOrchestratorForOrganizationOrchestrationScopeArgs
{
Selectors = new[]
{
new Gcp.OsConfig.Inputs.V2PolicyOrchestratorForOrganizationOrchestrationScopeSelectorArgs
{
LocationSelector = new Gcp.OsConfig.Inputs.V2PolicyOrchestratorForOrganizationOrchestrationScopeSelectorLocationSelectorArgs
{
IncludedLocations = new[]
{
"",
},
},
},
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/osconfig"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := osconfig.NewV2PolicyOrchestratorForOrganization(ctx, "policy_orchestrator_for_organization", &osconfig.V2PolicyOrchestratorForOrganizationArgs{
PolicyOrchestratorId: pulumi.String("po-org"),
OrganizationId: pulumi.String("123456789"),
State: pulumi.String("ACTIVE"),
Action: pulumi.String("UPSERT"),
OrchestratedResource: &osconfig.V2PolicyOrchestratorForOrganizationOrchestratedResourceArgs{
Id: pulumi.String("test-orchestrated-resource-org"),
OsPolicyAssignmentV1Payload: &osconfig.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadArgs{
OsPolicies: osconfig.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyArray{
&osconfig.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyArgs{
Id: pulumi.String("test-os-policy-org"),
Mode: pulumi.String("VALIDATION"),
ResourceGroups: osconfig.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyResourceGroupArray{
&osconfig.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyResourceGroupArgs{
Resources: osconfig.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyResourceGroupResourceArray{
&osconfig.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyResourceGroupResourceArgs{
Id: pulumi.String("resource-tf"),
File: &osconfig.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyResourceGroupResourceFileArgs{
Content: pulumi.String("file-content-tf"),
Path: pulumi.String("file-path-tf-1"),
State: pulumi.String("PRESENT"),
},
},
},
},
},
},
},
InstanceFilter: &osconfig.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadInstanceFilterArgs{
Inventories: osconfig.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadInstanceFilterInventoryArray{
&osconfig.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadInstanceFilterInventoryArgs{
OsShortName: pulumi.String("windows-10"),
},
},
},
Rollout: &osconfig.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadRolloutArgs{
DisruptionBudget: &osconfig.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadRolloutDisruptionBudgetArgs{
Percent: pulumi.Int(100),
},
MinWaitDuration: pulumi.String("60s"),
},
},
},
Labels: pulumi.StringMap{
"state": pulumi.String("active"),
},
OrchestrationScope: &osconfig.V2PolicyOrchestratorForOrganizationOrchestrationScopeArgs{
Selectors: osconfig.V2PolicyOrchestratorForOrganizationOrchestrationScopeSelectorArray{
&osconfig.V2PolicyOrchestratorForOrganizationOrchestrationScopeSelectorArgs{
LocationSelector: &osconfig.V2PolicyOrchestratorForOrganizationOrchestrationScopeSelectorLocationSelectorArgs{
IncludedLocations: pulumi.StringArray{
pulumi.String(""),
},
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.osconfig.V2PolicyOrchestratorForOrganization;
import com.pulumi.gcp.osconfig.V2PolicyOrchestratorForOrganizationArgs;
import com.pulumi.gcp.osconfig.inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceArgs;
import com.pulumi.gcp.osconfig.inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadArgs;
import com.pulumi.gcp.osconfig.inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadInstanceFilterArgs;
import com.pulumi.gcp.osconfig.inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadRolloutArgs;
import com.pulumi.gcp.osconfig.inputs.V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadRolloutDisruptionBudgetArgs;
import com.pulumi.gcp.osconfig.inputs.V2PolicyOrchestratorForOrganizationOrchestrationScopeArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var policyOrchestratorForOrganization = new V2PolicyOrchestratorForOrganization("policyOrchestratorForOrganization", V2PolicyOrchestratorForOrganizationArgs.builder()
.policyOrchestratorId("po-org")
.organizationId("123456789")
.state("ACTIVE")
.action("UPSERT")
.orchestratedResource(V2PolicyOrchestratorForOrganizationOrchestratedResourceArgs.builder()
.id("test-orchestrated-resource-org")
.osPolicyAssignmentV1Payload(V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadArgs.builder()
.osPolicies(V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyArgs.builder()
.id("test-os-policy-org")
.mode("VALIDATION")
.resourceGroups(V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyResourceGroupArgs.builder()
.resources(V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyResourceGroupResourceArgs.builder()
.id("resource-tf")
.file(V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadOsPolicyResourceGroupResourceFileArgs.builder()
.content("file-content-tf")
.path("file-path-tf-1")
.state("PRESENT")
.build())
.build())
.build())
.build())
.instanceFilter(V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadInstanceFilterArgs.builder()
.inventories(V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadInstanceFilterInventoryArgs.builder()
.osShortName("windows-10")
.build())
.build())
.rollout(V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadRolloutArgs.builder()
.disruptionBudget(V2PolicyOrchestratorForOrganizationOrchestratedResourceOsPolicyAssignmentV1PayloadRolloutDisruptionBudgetArgs.builder()
.percent(100)
.build())
.minWaitDuration("60s")
.build())
.build())
.build())
.labels(Map.of("state", "active"))
.orchestrationScope(V2PolicyOrchestratorForOrganizationOrchestrationScopeArgs.builder()
.selectors(V2PolicyOrchestratorForOrganizationOrchestrationScopeSelectorArgs.builder()
.locationSelector(V2PolicyOrchestratorForOrganizationOrchestrationScopeSelectorLocationSelectorArgs.builder()
.includedLocations("")
.build())
.build())
.build())
.build());
}
}
resources:
policyOrchestratorForOrganization:
type: gcp:osconfig:V2PolicyOrchestratorForOrganization
name: policy_orchestrator_for_organization
properties:
policyOrchestratorId: po-org
organizationId: '123456789'
state: ACTIVE
action: UPSERT
orchestratedResource:
id: test-orchestrated-resource-org
osPolicyAssignmentV1Payload:
osPolicies:
- id: test-os-policy-org
mode: VALIDATION
resourceGroups:
- resources:
- id: resource-tf
file:
content: file-content-tf
path: file-path-tf-1
state: PRESENT
instanceFilter:
inventories:
- osShortName: windows-10
rollout:
disruptionBudget:
percent: 100
minWaitDuration: 60s
labels:
state: active
orchestrationScope:
selectors:
- locationSelector:
includedLocations:
- ""
Import
PolicyOrchestratorForOrganization can be imported using any of these accepted formats:
organizations/{{organization_id}}/locations/global/policyOrchestrators/{{policy_orchestrator_id}}
{{organization_id}}/{{policy_orchestrator_id}}
When using thepulumi import
command, PolicyOrchestratorForOrganization can be imported using one of the formats above. For example:
$ pulumi import gcp:osconfig/v2PolicyOrchestratorForOrganization:V2PolicyOrchestratorForOrganization default organizations/{{organization_id}}/locations/global/policyOrchestrators/{{policy_orchestrator_id}}
$ pulumi import gcp:osconfig/v2PolicyOrchestratorForOrganization:V2PolicyOrchestratorForOrganization default {{organization_id}}/{{policy_orchestrator_id}}
Properties
Output only. Timestamp when the policy orchestrator resource was created.
Optional. Freeform text describing the purpose of the resource.
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
Represents a resource that is being orchestrated by the policy orchestrator. Structure is documented below.
Defines a set of selectors which drive which resources are in scope of policy orchestration.
Describes the state of the orchestration process. Structure is documented below.
Part of parent
. Required. The parent resource name in the form of:
Required. The logical identifier of the policy orchestrator, with the following restrictions:
The combination of labels configured directly on the resource and default labels configured on the provider.
Output only. Set to true, if the there are ongoing changes being applied by the orchestrator.
Output only. Timestamp when the policy orchestrator resource was last modified.