Resource for managing an AWS User Notifications Organizational Unit Association. This resource associates an organizational unit with a notification configuration.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as time from "@pulumi/time";
const example = aws.organizations.getOrganization({});
const exampleNotificationConfiguration = new aws.notifications.NotificationConfiguration("example", {
name: "example-notification-config",
description: "Example notification configuration",
});
const exampleOrganizationalUnit = new aws.organizations.OrganizationalUnit("example", {
name: "example-ou",
parentId: example.then(example => example.roots?.[0]?.id),
});
// Allow time for organizational unit creation to propagate
const wait = new time.index.Sleep("wait", {createDuration: "5s"}, {
dependsOn: [
exampleOrganizationalUnit,
exampleNotificationConfiguration,
],
});
const exampleOrganizationalUnitAssociation = new aws.notifications.OrganizationalUnitAssociation("example", {
organizationalUnitId: exampleOrganizationalUnit.id,
notificationConfigurationArn: exampleNotificationConfiguration.arn,
}, {
dependsOn: [wait],
});
import pulumi
import pulumi_aws as aws
import pulumi_time as time
example = aws.organizations.get_organization()
example_notification_configuration = aws.notifications.NotificationConfiguration("example",
name="example-notification-config",
description="Example notification configuration")
example_organizational_unit = aws.organizations.OrganizationalUnit("example",
name="example-ou",
parent_id=example.roots[0].id)
# Allow time for organizational unit creation to propagate
wait = time.index.Sleep("wait", create_duration=5s,
opts = pulumi.ResourceOptions(depends_on=[
example_organizational_unit,
example_notification_configuration,
]))
example_organizational_unit_association = aws.notifications.OrganizationalUnitAssociation("example",
organizational_unit_id=example_organizational_unit.id,
notification_configuration_arn=example_notification_configuration.arn,
opts = pulumi.ResourceOptions(depends_on=[wait]))
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/notifications"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/organizations"
"github.com/pulumi/pulumi-time/sdk/go/time"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := organizations.LookupOrganization(ctx, &organizations.LookupOrganizationArgs{}, nil)
if err != nil {
return err
}
exampleNotificationConfiguration, err := notifications.NewNotificationConfiguration(ctx, "example", ¬ifications.NotificationConfigurationArgs{
Name: pulumi.String("example-notification-config"),
Description: pulumi.String("Example notification configuration"),
})
if err != nil {
return err
}
exampleOrganizationalUnit, err := organizations.NewOrganizationalUnit(ctx, "example", &organizations.OrganizationalUnitArgs{
Name: pulumi.String("example-ou"),
ParentId: pulumi.String(example.Roots[0].Id),
})
if err != nil {
return err
}
// Allow time for organizational unit creation to propagate
wait, err := time.NewSleep(ctx, "wait", &time.SleepArgs{
CreateDuration: "5s",
}, pulumi.DependsOn([]pulumi.Resource{
exampleOrganizationalUnit,
exampleNotificationConfiguration,
}))
if err != nil {
return err
}
_, err = notifications.NewOrganizationalUnitAssociation(ctx, "example", ¬ifications.OrganizationalUnitAssociationArgs{
OrganizationalUnitId: exampleOrganizationalUnit.ID(),
NotificationConfigurationArn: exampleNotificationConfiguration.Arn,
}, pulumi.DependsOn([]pulumi.Resource{
wait,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
using Time = Pulumi.Time;
return await Deployment.RunAsync(() =>
{
var example = Aws.Organizations.GetOrganization.Invoke();
var exampleNotificationConfiguration = new Aws.Notifications.NotificationConfiguration("example", new()
{
Name = "example-notification-config",
Description = "Example notification configuration",
});
var exampleOrganizationalUnit = new Aws.Organizations.OrganizationalUnit("example", new()
{
Name = "example-ou",
ParentId = example.Apply(getOrganizationResult => getOrganizationResult.Roots[0]?.Id),
});
// Allow time for organizational unit creation to propagate
var wait = new Time.Index.Sleep("wait", new()
{
CreateDuration = "5s",
}, new CustomResourceOptions
{
DependsOn =
{
exampleOrganizationalUnit,
exampleNotificationConfiguration,
},
});
var exampleOrganizationalUnitAssociation = new Aws.Notifications.OrganizationalUnitAssociation("example", new()
{
OrganizationalUnitId = exampleOrganizationalUnit.Id,
NotificationConfigurationArn = exampleNotificationConfiguration.Arn,
}, new CustomResourceOptions
{
DependsOn =
{
wait,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.organizations.OrganizationsFunctions;
import com.pulumi.aws.organizations.inputs.GetOrganizationArgs;
import com.pulumi.aws.notifications.NotificationConfiguration;
import com.pulumi.aws.notifications.NotificationConfigurationArgs;
import com.pulumi.aws.organizations.OrganizationalUnit;
import com.pulumi.aws.organizations.OrganizationalUnitArgs;
import com.pulumi.time.Sleep;
import com.pulumi.time.SleepArgs;
import com.pulumi.aws.notifications.OrganizationalUnitAssociation;
import com.pulumi.aws.notifications.OrganizationalUnitAssociationArgs;
import com.pulumi.resources.CustomResourceOptions;
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) {
final var example = OrganizationsFunctions.getOrganization(GetOrganizationArgs.builder()
.build());
var exampleNotificationConfiguration = new NotificationConfiguration("exampleNotificationConfiguration", NotificationConfigurationArgs.builder()
.name("example-notification-config")
.description("Example notification configuration")
.build());
var exampleOrganizationalUnit = new OrganizationalUnit("exampleOrganizationalUnit", OrganizationalUnitArgs.builder()
.name("example-ou")
.parentId(example.roots()[0].id())
.build());
// Allow time for organizational unit creation to propagate
var wait = new Sleep("wait", SleepArgs.builder()
.createDuration("5s")
.build(), CustomResourceOptions.builder()
.dependsOn(List.of(
exampleOrganizationalUnit,
exampleNotificationConfiguration))
.build());
var exampleOrganizationalUnitAssociation = new OrganizationalUnitAssociation("exampleOrganizationalUnitAssociation", OrganizationalUnitAssociationArgs.builder()
.organizationalUnitId(exampleOrganizationalUnit.id())
.notificationConfigurationArn(exampleNotificationConfiguration.arn())
.build(), CustomResourceOptions.builder()
.dependsOn(wait)
.build());
}
}
resources:
exampleNotificationConfiguration:
type: aws:notifications:NotificationConfiguration
name: example
properties:
name: example-notification-config
description: Example notification configuration
exampleOrganizationalUnit:
type: aws:organizations:OrganizationalUnit
name: example
properties:
name: example-ou
parentId: ${example.roots[0].id}
# Allow time for organizational unit creation to propagate
wait:
type: time:Sleep
properties:
createDuration: 5s
options:
dependsOn:
- ${exampleOrganizationalUnit}
- ${exampleNotificationConfiguration}
exampleOrganizationalUnitAssociation:
type: aws:notifications:OrganizationalUnitAssociation
name: example
properties:
organizationalUnitId: ${exampleOrganizationalUnit.id}
notificationConfigurationArn: ${exampleNotificationConfiguration.arn}
options:
dependsOn:
- ${wait}
variables:
example:
fn::invoke:
function: aws:organizations:getOrganization
arguments: {}
Associate with Organization Root
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.organizations.getOrganization({});
const exampleNotificationConfiguration = new aws.notifications.NotificationConfiguration("example", {
name: "example-notification-config",
description: "Example notification configuration",
});
const exampleOrganizationalUnitAssociation = new aws.notifications.OrganizationalUnitAssociation("example", {
organizationalUnitId: example.then(example => example.roots?.[0]?.id),
notificationConfigurationArn: exampleNotificationConfiguration.arn,
});
import pulumi
import pulumi_aws as aws
example = aws.organizations.get_organization()
example_notification_configuration = aws.notifications.NotificationConfiguration("example",
name="example-notification-config",
description="Example notification configuration")
example_organizational_unit_association = aws.notifications.OrganizationalUnitAssociation("example",
organizational_unit_id=example.roots[0].id,
notification_configuration_arn=example_notification_configuration.arn)
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/notifications"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := organizations.LookupOrganization(ctx, &organizations.LookupOrganizationArgs{}, nil)
if err != nil {
return err
}
exampleNotificationConfiguration, err := notifications.NewNotificationConfiguration(ctx, "example", ¬ifications.NotificationConfigurationArgs{
Name: pulumi.String("example-notification-config"),
Description: pulumi.String("Example notification configuration"),
})
if err != nil {
return err
}
_, err = notifications.NewOrganizationalUnitAssociation(ctx, "example", ¬ifications.OrganizationalUnitAssociationArgs{
OrganizationalUnitId: pulumi.String(example.Roots[0].Id),
NotificationConfigurationArn: exampleNotificationConfiguration.Arn,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = Aws.Organizations.GetOrganization.Invoke();
var exampleNotificationConfiguration = new Aws.Notifications.NotificationConfiguration("example", new()
{
Name = "example-notification-config",
Description = "Example notification configuration",
});
var exampleOrganizationalUnitAssociation = new Aws.Notifications.OrganizationalUnitAssociation("example", new()
{
OrganizationalUnitId = example.Apply(getOrganizationResult => getOrganizationResult.Roots[0]?.Id),
NotificationConfigurationArn = exampleNotificationConfiguration.Arn,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.organizations.OrganizationsFunctions;
import com.pulumi.aws.organizations.inputs.GetOrganizationArgs;
import com.pulumi.aws.notifications.NotificationConfiguration;
import com.pulumi.aws.notifications.NotificationConfigurationArgs;
import com.pulumi.aws.notifications.OrganizationalUnitAssociation;
import com.pulumi.aws.notifications.OrganizationalUnitAssociationArgs;
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) {
final var example = OrganizationsFunctions.getOrganization(GetOrganizationArgs.builder()
.build());
var exampleNotificationConfiguration = new NotificationConfiguration("exampleNotificationConfiguration", NotificationConfigurationArgs.builder()
.name("example-notification-config")
.description("Example notification configuration")
.build());
var exampleOrganizationalUnitAssociation = new OrganizationalUnitAssociation("exampleOrganizationalUnitAssociation", OrganizationalUnitAssociationArgs.builder()
.organizationalUnitId(example.roots()[0].id())
.notificationConfigurationArn(exampleNotificationConfiguration.arn())
.build());
}
}
resources:
exampleNotificationConfiguration:
type: aws:notifications:NotificationConfiguration
name: example
properties:
name: example-notification-config
description: Example notification configuration
exampleOrganizationalUnitAssociation:
type: aws:notifications:OrganizationalUnitAssociation
name: example
properties:
organizationalUnitId: ${example.roots[0].id}
notificationConfigurationArn: ${exampleNotificationConfiguration.arn}
variables:
example:
fn::invoke:
function: aws:organizations:getOrganization
arguments: {}
Create OrganizationalUnitAssociation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new OrganizationalUnitAssociation(name: string, args: OrganizationalUnitAssociationArgs, opts?: CustomResourceOptions);@overload
def OrganizationalUnitAssociation(resource_name: str,
args: OrganizationalUnitAssociationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def OrganizationalUnitAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
notification_configuration_arn: Optional[str] = None,
organizational_unit_id: Optional[str] = None)func NewOrganizationalUnitAssociation(ctx *Context, name string, args OrganizationalUnitAssociationArgs, opts ...ResourceOption) (*OrganizationalUnitAssociation, error)public OrganizationalUnitAssociation(string name, OrganizationalUnitAssociationArgs args, CustomResourceOptions? opts = null)
public OrganizationalUnitAssociation(String name, OrganizationalUnitAssociationArgs args)
public OrganizationalUnitAssociation(String name, OrganizationalUnitAssociationArgs args, CustomResourceOptions options)
type: aws:notifications:OrganizationalUnitAssociation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args OrganizationalUnitAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args OrganizationalUnitAssociationArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args OrganizationalUnitAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args OrganizationalUnitAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args OrganizationalUnitAssociationArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var organizationalUnitAssociationResource = new Aws.Notifications.OrganizationalUnitAssociation("organizationalUnitAssociationResource", new()
{
NotificationConfigurationArn = "string",
OrganizationalUnitId = "string",
});
example, err := notifications.NewOrganizationalUnitAssociation(ctx, "organizationalUnitAssociationResource", ¬ifications.OrganizationalUnitAssociationArgs{
NotificationConfigurationArn: pulumi.String("string"),
OrganizationalUnitId: pulumi.String("string"),
})
var organizationalUnitAssociationResource = new OrganizationalUnitAssociation("organizationalUnitAssociationResource", OrganizationalUnitAssociationArgs.builder()
.notificationConfigurationArn("string")
.organizationalUnitId("string")
.build());
organizational_unit_association_resource = aws.notifications.OrganizationalUnitAssociation("organizationalUnitAssociationResource",
notification_configuration_arn="string",
organizational_unit_id="string")
const organizationalUnitAssociationResource = new aws.notifications.OrganizationalUnitAssociation("organizationalUnitAssociationResource", {
notificationConfigurationArn: "string",
organizationalUnitId: "string",
});
type: aws:notifications:OrganizationalUnitAssociation
properties:
notificationConfigurationArn: string
organizationalUnitId: string
OrganizationalUnitAssociation Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The OrganizationalUnitAssociation resource accepts the following input properties:
- Notification
Configuration stringArn - ARN of the notification configuration to associate the organizational unit with.
- Organizational
Unit stringId - ID of the organizational unit or ID of the root to associate with the notification configuration. Can be a root ID (e.g.,
r-1234), or an organization ID (e.g.,o-1234567890).
- Notification
Configuration stringArn - ARN of the notification configuration to associate the organizational unit with.
- Organizational
Unit stringId - ID of the organizational unit or ID of the root to associate with the notification configuration. Can be a root ID (e.g.,
r-1234), or an organization ID (e.g.,o-1234567890).
- notification
Configuration StringArn - ARN of the notification configuration to associate the organizational unit with.
- organizational
Unit StringId - ID of the organizational unit or ID of the root to associate with the notification configuration. Can be a root ID (e.g.,
r-1234), or an organization ID (e.g.,o-1234567890).
- notification
Configuration stringArn - ARN of the notification configuration to associate the organizational unit with.
- organizational
Unit stringId - ID of the organizational unit or ID of the root to associate with the notification configuration. Can be a root ID (e.g.,
r-1234), or an organization ID (e.g.,o-1234567890).
- notification_
configuration_ strarn - ARN of the notification configuration to associate the organizational unit with.
- organizational_
unit_ strid - ID of the organizational unit or ID of the root to associate with the notification configuration. Can be a root ID (e.g.,
r-1234), or an organization ID (e.g.,o-1234567890).
- notification
Configuration StringArn - ARN of the notification configuration to associate the organizational unit with.
- organizational
Unit StringId - ID of the organizational unit or ID of the root to associate with the notification configuration. Can be a root ID (e.g.,
r-1234), or an organization ID (e.g.,o-1234567890).
Outputs
All input properties are implicitly available as output properties. Additionally, the OrganizationalUnitAssociation resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing OrganizationalUnitAssociation Resource
Get an existing OrganizationalUnitAssociation resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: OrganizationalUnitAssociationState, opts?: CustomResourceOptions): OrganizationalUnitAssociation@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
notification_configuration_arn: Optional[str] = None,
organizational_unit_id: Optional[str] = None) -> OrganizationalUnitAssociationfunc GetOrganizationalUnitAssociation(ctx *Context, name string, id IDInput, state *OrganizationalUnitAssociationState, opts ...ResourceOption) (*OrganizationalUnitAssociation, error)public static OrganizationalUnitAssociation Get(string name, Input<string> id, OrganizationalUnitAssociationState? state, CustomResourceOptions? opts = null)public static OrganizationalUnitAssociation get(String name, Output<String> id, OrganizationalUnitAssociationState state, CustomResourceOptions options)resources: _: type: aws:notifications:OrganizationalUnitAssociation get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Notification
Configuration stringArn - ARN of the notification configuration to associate the organizational unit with.
- Organizational
Unit stringId - ID of the organizational unit or ID of the root to associate with the notification configuration. Can be a root ID (e.g.,
r-1234), or an organization ID (e.g.,o-1234567890).
- Notification
Configuration stringArn - ARN of the notification configuration to associate the organizational unit with.
- Organizational
Unit stringId - ID of the organizational unit or ID of the root to associate with the notification configuration. Can be a root ID (e.g.,
r-1234), or an organization ID (e.g.,o-1234567890).
- notification
Configuration StringArn - ARN of the notification configuration to associate the organizational unit with.
- organizational
Unit StringId - ID of the organizational unit or ID of the root to associate with the notification configuration. Can be a root ID (e.g.,
r-1234), or an organization ID (e.g.,o-1234567890).
- notification
Configuration stringArn - ARN of the notification configuration to associate the organizational unit with.
- organizational
Unit stringId - ID of the organizational unit or ID of the root to associate with the notification configuration. Can be a root ID (e.g.,
r-1234), or an organization ID (e.g.,o-1234567890).
- notification_
configuration_ strarn - ARN of the notification configuration to associate the organizational unit with.
- organizational_
unit_ strid - ID of the organizational unit or ID of the root to associate with the notification configuration. Can be a root ID (e.g.,
r-1234), or an organization ID (e.g.,o-1234567890).
- notification
Configuration StringArn - ARN of the notification configuration to associate the organizational unit with.
- organizational
Unit StringId - ID of the organizational unit or ID of the root to associate with the notification configuration. Can be a root ID (e.g.,
r-1234), or an organization ID (e.g.,o-1234567890).
Import
Using pulumi import, import User Notifications Organizational Unit Association using the notification_configuration_arn,organizational_unit_id format. For example:
$ pulumi import aws:notifications/organizationalUnitAssociation:OrganizationalUnitAssociation example arn:aws:notifications:us-west-2:123456789012:configuration:example-notification-config,ou-1234-12345678
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
