Show / Hide Table of Contents

Class GetOrganization

Inheritance
System.Object
GetOrganization
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.Organizations
Assembly: Pulumi.Aws.dll
Syntax
public static class GetOrganization

Methods

View Source

InvokeAsync(InvokeOptions)

Get information about the organization that the user's account belongs to

{{% examples %}}

Example Usage

{{% example %}}

List all account IDs for the organization

using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var example = Output.Create(Aws.Organizations.GetOrganization.InvokeAsync());
    this.AccountIds = example.Apply(example => example.Accounts.Select(__item => __item.Id).ToList());
}

[Output("accountIds")]
public Output<string> AccountIds { get; set; }
}

{{% /example %}} {{% example %}}

SNS topic that can be interacted by the organization only

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var example = Output.Create(Aws.Organizations.GetOrganization.InvokeAsync());
    var snsTopic = new Aws.Sns.Topic("snsTopic", new Aws.Sns.TopicArgs
    {
    });
    var snsTopicPolicyPolicyDocument = Output.Tuple(example, snsTopic.Arn).Apply(values =>
    {
        var example = values.Item1;
        var arn = values.Item2;
        return Aws.Iam.GetPolicyDocument.InvokeAsync(new Aws.Iam.GetPolicyDocumentArgs
        {
            Statements = 
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementArgs
                {
                    Actions = 
                    {
                        "SNS:Subscribe",
                        "SNS:Publish",
                    },
                    Condition = 
                    {

                        {
                            { "test", "StringEquals" },
                            { "values", 
                            {
                                example.Id,
                            } },
                            { "variable", "aws:PrincipalOrgID" },
                        },
                    },
                    Effect = "Allow",
                    Principals = 
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalArgs
                        {
                            Identifiers = 
                            {
                                "*",
                            },
                            Type = "AWS",
                        },
                    },
                    Resources = 
                    {
                        arn,
                    },
                },
            },
        });
    });
    var snsTopicPolicyTopicPolicy = new Aws.Sns.TopicPolicy("snsTopicPolicyTopicPolicy", new Aws.Sns.TopicPolicyArgs
    {
        Arn = snsTopic.Arn,
        Policy = snsTopicPolicyPolicyDocument.Apply(snsTopicPolicyPolicyDocument => snsTopicPolicyPolicyDocument.Json),
    });
}

}

{{% /example %}} {{% /examples %}}

Declaration
public static Task<GetOrganizationResult> InvokeAsync(InvokeOptions options = null)
Parameters
Type Name Description
InvokeOptions options
Returns
Type Description
System.Threading.Tasks.Task<GetOrganizationResult>
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.