Selection
Manages selection conditions for AWS Backup plan resources.
Example Usage
IAM Role
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleRole = new Aws.Iam.Role("exampleRole", new Aws.Iam.RoleArgs
{
AssumeRolePolicy = @"{
""Version"": ""2012-10-17"",
""Statement"": [
{
""Action"": [""sts:AssumeRole""],
""Effect"": ""allow"",
""Principal"": {
""Service"": [""backup.amazonaws.com""]
}
}
]
}
",
});
var exampleRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("exampleRolePolicyAttachment", new Aws.Iam.RolePolicyAttachmentArgs
{
PolicyArn = "arn:aws:iam::aws:policy/service-role/AWSBackupServiceRolePolicyForBackup",
Role = exampleRole.Name,
});
var exampleSelection = new Aws.Backup.Selection("exampleSelection", new Aws.Backup.SelectionArgs
{
IamRoleArn = exampleRole.Arn,
});
}
}
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/backup"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/iam"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleRole, err := iam.NewRole(ctx, "exampleRole", &iam.RoleArgs{
AssumeRolePolicy: pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", " \"Version\": \"2012-10-17\",\n", " \"Statement\": [\n", " {\n", " \"Action\": [\"sts:AssumeRole\"],\n", " \"Effect\": \"allow\",\n", " \"Principal\": {\n", " \"Service\": [\"backup.amazonaws.com\"]\n", " }\n", " }\n", " ]\n", "}\n", "\n")),
})
if err != nil {
return err
}
_, err = iam.NewRolePolicyAttachment(ctx, "exampleRolePolicyAttachment", &iam.RolePolicyAttachmentArgs{
PolicyArn: pulumi.String("arn:aws:iam::aws:policy/service-role/AWSBackupServiceRolePolicyForBackup"),
Role: exampleRole.Name,
})
if err != nil {
return err
}
_, err = backup.NewSelection(ctx, "exampleSelection", &backup.SelectionArgs{
IamRoleArn: exampleRole.Arn,
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
example_role = aws.iam.Role("exampleRole", assume_role_policy="""{
"Version": "2012-10-17",
"Statement": [
{
"Action": ["sts:AssumeRole"],
"Effect": "allow",
"Principal": {
"Service": ["backup.amazonaws.com"]
}
}
]
}
""")
example_role_policy_attachment = aws.iam.RolePolicyAttachment("exampleRolePolicyAttachment",
policy_arn="arn:aws:iam::aws:policy/service-role/AWSBackupServiceRolePolicyForBackup",
role=example_role.name)
example_selection = aws.backup.Selection("exampleSelection", iam_role_arn=example_role.arn)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleRole = new aws.iam.Role("example", {
assumeRolePolicy: `{
"Version": "2012-10-17",
"Statement": [
{
"Action": ["sts:AssumeRole"],
"Effect": "allow",
"Principal": {
"Service": ["backup.amazonaws.com"]
}
}
]
}
`,
});
const exampleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("example", {
policyArn: "arn:aws:iam::aws:policy/service-role/AWSBackupServiceRolePolicyForBackup",
role: exampleRole.name,
});
const exampleSelection = new aws.backup.Selection("example", {
iamRoleArn: exampleRole.arn,
});Selecting Backups By Tag
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.Backup.Selection("example", new Aws.Backup.SelectionArgs
{
IamRoleArn = aws_iam_role.Example.Arn,
PlanId = aws_backup_plan.Example.Id,
SelectionTags =
{
new Aws.Backup.Inputs.SelectionSelectionTagArgs
{
Key = "foo",
Type = "STRINGEQUALS",
Value = "bar",
},
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/backup"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := backup.NewSelection(ctx, "example", &backup.SelectionArgs{
IamRoleArn: pulumi.String(aws_iam_role.Example.Arn),
PlanId: pulumi.String(aws_backup_plan.Example.Id),
SelectionTags: backup.SelectionSelectionTagArray{
&backup.SelectionSelectionTagArgs{
Key: pulumi.String("foo"),
Type: pulumi.String("STRINGEQUALS"),
Value: pulumi.String("bar"),
},
},
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
example = aws.backup.Selection("example",
iam_role_arn=aws_iam_role["example"]["arn"],
plan_id=aws_backup_plan["example"]["id"],
selection_tags=[{
"key": "foo",
"type": "STRINGEQUALS",
"value": "bar",
}])import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.backup.Selection("example", {
iamRoleArn: aws_iam_role_example.arn,
planId: aws_backup_plan_example.id,
selectionTags: [{
key: "foo",
type: "STRINGEQUALS",
value: "bar",
}],
});Create a Selection Resource
new Selection(name: string, args: SelectionArgs, opts?: CustomResourceOptions);def Selection(resource_name, opts=None, iam_role_arn=None, name=None, plan_id=None, resources=None, selection_tags=None, __props__=None);func NewSelection(ctx *Context, name string, args SelectionArgs, opts ...ResourceOption) (*Selection, error)public Selection(string name, SelectionArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args SelectionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SelectionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SelectionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Selection Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Selection resource accepts the following input properties:
- Iam
Role stringArn The ARN of the IAM role that AWS Backup uses to authenticate when restoring and backing up the target resource. See the AWS Backup Developer Guide for additional information about using AWS managed policies or creating custom policies attached to the IAM role.
- Plan
Id string The backup plan ID to be associated with the selection of resources.
- Name string
The display name of a resource selection document.
- Resources List<string>
An array of strings that either contain Amazon Resource Names (ARNs) or match patterns of resources to assign to a backup plan..
-
List<Selection
Selection Tag Args> Tag-based conditions used to specify a set of resources to assign to a backup plan.
- Iam
Role stringArn The ARN of the IAM role that AWS Backup uses to authenticate when restoring and backing up the target resource. See the AWS Backup Developer Guide for additional information about using AWS managed policies or creating custom policies attached to the IAM role.
- Plan
Id string The backup plan ID to be associated with the selection of resources.
- Name string
The display name of a resource selection document.
- Resources []string
An array of strings that either contain Amazon Resource Names (ARNs) or match patterns of resources to assign to a backup plan..
-
[]Selection
Selection Tag Tag-based conditions used to specify a set of resources to assign to a backup plan.
- iam
Role stringArn The ARN of the IAM role that AWS Backup uses to authenticate when restoring and backing up the target resource. See the AWS Backup Developer Guide for additional information about using AWS managed policies or creating custom policies attached to the IAM role.
- plan
Id string The backup plan ID to be associated with the selection of resources.
- name string
The display name of a resource selection document.
- resources string[]
An array of strings that either contain Amazon Resource Names (ARNs) or match patterns of resources to assign to a backup plan..
-
Selection
Selection Tag[] Tag-based conditions used to specify a set of resources to assign to a backup plan.
- iam_
role_ strarn The ARN of the IAM role that AWS Backup uses to authenticate when restoring and backing up the target resource. See the AWS Backup Developer Guide for additional information about using AWS managed policies or creating custom policies attached to the IAM role.
- plan_
id str The backup plan ID to be associated with the selection of resources.
- name str
The display name of a resource selection document.
- resources List[str]
An array of strings that either contain Amazon Resource Names (ARNs) or match patterns of resources to assign to a backup plan..
-
List[Selection
Selection Tag] Tag-based conditions used to specify a set of resources to assign to a backup plan.
Outputs
All input properties are implicitly available as output properties. Additionally, the Selection resource produces the following output properties:
Look up an Existing Selection Resource
Get an existing Selection 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?: SelectionState, opts?: CustomResourceOptions): Selectionstatic get(resource_name, id, opts=None, iam_role_arn=None, name=None, plan_id=None, resources=None, selection_tags=None, __props__=None);func GetSelection(ctx *Context, name string, id IDInput, state *SelectionState, opts ...ResourceOption) (*Selection, error)public static Selection Get(string name, Input<string> id, SelectionState? state, CustomResourceOptions? opts = null)- 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.
The following state arguments are supported:
- Iam
Role stringArn The ARN of the IAM role that AWS Backup uses to authenticate when restoring and backing up the target resource. See the AWS Backup Developer Guide for additional information about using AWS managed policies or creating custom policies attached to the IAM role.
- Name string
The display name of a resource selection document.
- Plan
Id string The backup plan ID to be associated with the selection of resources.
- Resources List<string>
An array of strings that either contain Amazon Resource Names (ARNs) or match patterns of resources to assign to a backup plan..
-
List<Selection
Selection Tag Args> Tag-based conditions used to specify a set of resources to assign to a backup plan.
- Iam
Role stringArn The ARN of the IAM role that AWS Backup uses to authenticate when restoring and backing up the target resource. See the AWS Backup Developer Guide for additional information about using AWS managed policies or creating custom policies attached to the IAM role.
- Name string
The display name of a resource selection document.
- Plan
Id string The backup plan ID to be associated with the selection of resources.
- Resources []string
An array of strings that either contain Amazon Resource Names (ARNs) or match patterns of resources to assign to a backup plan..
-
[]Selection
Selection Tag Tag-based conditions used to specify a set of resources to assign to a backup plan.
- iam
Role stringArn The ARN of the IAM role that AWS Backup uses to authenticate when restoring and backing up the target resource. See the AWS Backup Developer Guide for additional information about using AWS managed policies or creating custom policies attached to the IAM role.
- name string
The display name of a resource selection document.
- plan
Id string The backup plan ID to be associated with the selection of resources.
- resources string[]
An array of strings that either contain Amazon Resource Names (ARNs) or match patterns of resources to assign to a backup plan..
-
Selection
Selection Tag[] Tag-based conditions used to specify a set of resources to assign to a backup plan.
- iam_
role_ strarn The ARN of the IAM role that AWS Backup uses to authenticate when restoring and backing up the target resource. See the AWS Backup Developer Guide for additional information about using AWS managed policies or creating custom policies attached to the IAM role.
- name str
The display name of a resource selection document.
- plan_
id str The backup plan ID to be associated with the selection of resources.
- resources List[str]
An array of strings that either contain Amazon Resource Names (ARNs) or match patterns of resources to assign to a backup plan..
-
List[Selection
Selection Tag] Tag-based conditions used to specify a set of resources to assign to a backup plan.
Supporting Types
SelectionSelectionTag
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.