AWS v7.11.0 published on Wednesday, Nov 5, 2025 by Pulumi
aws.organizations.getPoliciesForTarget
Start a Neo task
Explain and create an aws.organizations.getPoliciesForTarget resource
Data source for managing an AWS Organizations Policies For Target.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as std from "@pulumi/std";
const example = aws.organizations.getOrganization({});
const exampleGetPoliciesForTarget = example.then(example => aws.organizations.getPoliciesForTarget({
targetId: example.roots?.[0]?.id,
filter: "SERVICE_CONTROL_POLICY",
}));
const exampleGetPolicy = exampleGetPoliciesForTarget.then(exampleGetPoliciesForTarget => std.toset({
input: exampleGetPoliciesForTarget.ids,
})).then(invoke => .reduce((__obj, [__key, __value]) => ({ ...__obj, [__key]: aws.organizations.getPolicy({
policyId: __value,
}) })));
import pulumi
import pulumi_aws as aws
import pulumi_std as std
example = aws.organizations.get_organization()
example_get_policies_for_target = aws.organizations.get_policies_for_target(target_id=example.roots[0].id,
filter="SERVICE_CONTROL_POLICY")
example_get_policy = {__key: aws.organizations.get_policy(policy_id=__value) for __key, __value in std.toset(input=example_get_policies_for_target.ids).result}
Example coming soon!
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var example = Aws.Organizations.GetOrganization.Invoke();
var exampleGetPoliciesForTarget = Aws.Organizations.GetPoliciesForTarget.Invoke(new()
{
TargetId = example.Apply(getOrganizationResult => getOrganizationResult.Roots[0]?.Id),
Filter = "SERVICE_CONTROL_POLICY",
});
var exampleGetPolicy = Std.Toset.Invoke(new()
{
Input = exampleGetPoliciesForTarget.Apply(getPoliciesForTargetResult => getPoliciesForTargetResult.Ids),
}).Apply(invoke => );
});
Example coming soon!
Example coming soon!
Using getPoliciesForTarget
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getPoliciesForTarget(args: GetPoliciesForTargetArgs, opts?: InvokeOptions): Promise<GetPoliciesForTargetResult>
function getPoliciesForTargetOutput(args: GetPoliciesForTargetOutputArgs, opts?: InvokeOptions): Output<GetPoliciesForTargetResult>def get_policies_for_target(filter: Optional[str] = None,
target_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetPoliciesForTargetResult
def get_policies_for_target_output(filter: Optional[pulumi.Input[str]] = None,
target_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetPoliciesForTargetResult]func GetPoliciesForTarget(ctx *Context, args *GetPoliciesForTargetArgs, opts ...InvokeOption) (*GetPoliciesForTargetResult, error)
func GetPoliciesForTargetOutput(ctx *Context, args *GetPoliciesForTargetOutputArgs, opts ...InvokeOption) GetPoliciesForTargetResultOutput> Note: This function is named GetPoliciesForTarget in the Go SDK.
public static class GetPoliciesForTarget
{
public static Task<GetPoliciesForTargetResult> InvokeAsync(GetPoliciesForTargetArgs args, InvokeOptions? opts = null)
public static Output<GetPoliciesForTargetResult> Invoke(GetPoliciesForTargetInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetPoliciesForTargetResult> getPoliciesForTarget(GetPoliciesForTargetArgs args, InvokeOptions options)
public static Output<GetPoliciesForTargetResult> getPoliciesForTarget(GetPoliciesForTargetArgs args, InvokeOptions options)
fn::invoke:
function: aws:organizations/getPoliciesForTarget:getPoliciesForTarget
arguments:
# arguments dictionaryThe following arguments are supported:
- Filter string
- Must supply one of the 5 different policy filters for a target (AISERVICES_OPT_OUT_POLICY | BACKUP_POLICY | RESOURCE_CONTROL_POLICY | SERVICE_CONTROL_POLICY | TAG_POLICY)
- Target
Id string - The root (string that begins with "r-" followed by 4-32 lowercase letters or digits), account (12 digit string), or Organizational Unit (string starting with "ou-" followed by 4-32 lowercase letters or digits. This string is followed by a second "-" dash and from 8-32 additional lowercase letters or digits.)
- Filter string
- Must supply one of the 5 different policy filters for a target (AISERVICES_OPT_OUT_POLICY | BACKUP_POLICY | RESOURCE_CONTROL_POLICY | SERVICE_CONTROL_POLICY | TAG_POLICY)
- Target
Id string - The root (string that begins with "r-" followed by 4-32 lowercase letters or digits), account (12 digit string), or Organizational Unit (string starting with "ou-" followed by 4-32 lowercase letters or digits. This string is followed by a second "-" dash and from 8-32 additional lowercase letters or digits.)
- filter String
- Must supply one of the 5 different policy filters for a target (AISERVICES_OPT_OUT_POLICY | BACKUP_POLICY | RESOURCE_CONTROL_POLICY | SERVICE_CONTROL_POLICY | TAG_POLICY)
- target
Id String - The root (string that begins with "r-" followed by 4-32 lowercase letters or digits), account (12 digit string), or Organizational Unit (string starting with "ou-" followed by 4-32 lowercase letters or digits. This string is followed by a second "-" dash and from 8-32 additional lowercase letters or digits.)
- filter string
- Must supply one of the 5 different policy filters for a target (AISERVICES_OPT_OUT_POLICY | BACKUP_POLICY | RESOURCE_CONTROL_POLICY | SERVICE_CONTROL_POLICY | TAG_POLICY)
- target
Id string - The root (string that begins with "r-" followed by 4-32 lowercase letters or digits), account (12 digit string), or Organizational Unit (string starting with "ou-" followed by 4-32 lowercase letters or digits. This string is followed by a second "-" dash and from 8-32 additional lowercase letters or digits.)
- filter str
- Must supply one of the 5 different policy filters for a target (AISERVICES_OPT_OUT_POLICY | BACKUP_POLICY | RESOURCE_CONTROL_POLICY | SERVICE_CONTROL_POLICY | TAG_POLICY)
- target_
id str - The root (string that begins with "r-" followed by 4-32 lowercase letters or digits), account (12 digit string), or Organizational Unit (string starting with "ou-" followed by 4-32 lowercase letters or digits. This string is followed by a second "-" dash and from 8-32 additional lowercase letters or digits.)
- filter String
- Must supply one of the 5 different policy filters for a target (AISERVICES_OPT_OUT_POLICY | BACKUP_POLICY | RESOURCE_CONTROL_POLICY | SERVICE_CONTROL_POLICY | TAG_POLICY)
- target
Id String - The root (string that begins with "r-" followed by 4-32 lowercase letters or digits), account (12 digit string), or Organizational Unit (string starting with "ou-" followed by 4-32 lowercase letters or digits. This string is followed by a second "-" dash and from 8-32 additional lowercase letters or digits.)
getPoliciesForTarget Result
The following output properties are available:
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
