1. Packages
  2. AWS Classic
  3. API Docs
  4. efs
  5. FileSystemPolicy

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.41.0 published on Tuesday, Jun 18, 2024 by Pulumi

aws.efs.FileSystemPolicy

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.41.0 published on Tuesday, Jun 18, 2024 by Pulumi

    Provides an Elastic File System (EFS) File System Policy resource.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const fs = new aws.efs.FileSystem("fs", {creationToken: "my-product"});
    const policy = aws.iam.getPolicyDocumentOutput({
        statements: [{
            sid: "ExampleStatement01",
            effect: "Allow",
            principals: [{
                type: "AWS",
                identifiers: ["*"],
            }],
            actions: [
                "elasticfilesystem:ClientMount",
                "elasticfilesystem:ClientWrite",
            ],
            resources: [fs.arn],
            conditions: [{
                test: "Bool",
                variable: "aws:SecureTransport",
                values: ["true"],
            }],
        }],
    });
    const policyFileSystemPolicy = new aws.efs.FileSystemPolicy("policy", {
        fileSystemId: fs.id,
        policy: policy.apply(policy => policy.json),
    });
    
    import pulumi
    import pulumi_aws as aws
    
    fs = aws.efs.FileSystem("fs", creation_token="my-product")
    policy = aws.iam.get_policy_document_output(statements=[aws.iam.GetPolicyDocumentStatementArgs(
        sid="ExampleStatement01",
        effect="Allow",
        principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
            type="AWS",
            identifiers=["*"],
        )],
        actions=[
            "elasticfilesystem:ClientMount",
            "elasticfilesystem:ClientWrite",
        ],
        resources=[fs.arn],
        conditions=[aws.iam.GetPolicyDocumentStatementConditionArgs(
            test="Bool",
            variable="aws:SecureTransport",
            values=["true"],
        )],
    )])
    policy_file_system_policy = aws.efs.FileSystemPolicy("policy",
        file_system_id=fs.id,
        policy=policy.json)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/efs"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		fs, err := efs.NewFileSystem(ctx, "fs", &efs.FileSystemArgs{
    			CreationToken: pulumi.String("my-product"),
    		})
    		if err != nil {
    			return err
    		}
    		policy := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
    			Statements: iam.GetPolicyDocumentStatementArray{
    				&iam.GetPolicyDocumentStatementArgs{
    					Sid:    pulumi.String("ExampleStatement01"),
    					Effect: pulumi.String("Allow"),
    					Principals: iam.GetPolicyDocumentStatementPrincipalArray{
    						&iam.GetPolicyDocumentStatementPrincipalArgs{
    							Type: pulumi.String("AWS"),
    							Identifiers: pulumi.StringArray{
    								pulumi.String("*"),
    							},
    						},
    					},
    					Actions: pulumi.StringArray{
    						pulumi.String("elasticfilesystem:ClientMount"),
    						pulumi.String("elasticfilesystem:ClientWrite"),
    					},
    					Resources: pulumi.StringArray{
    						fs.Arn,
    					},
    					Conditions: iam.GetPolicyDocumentStatementConditionArray{
    						&iam.GetPolicyDocumentStatementConditionArgs{
    							Test:     pulumi.String("Bool"),
    							Variable: pulumi.String("aws:SecureTransport"),
    							Values: pulumi.StringArray{
    								pulumi.String("true"),
    							},
    						},
    					},
    				},
    			},
    		}, nil)
    		_, err = efs.NewFileSystemPolicy(ctx, "policy", &efs.FileSystemPolicyArgs{
    			FileSystemId: fs.ID(),
    			Policy: policy.ApplyT(func(policy iam.GetPolicyDocumentResult) (*string, error) {
    				return &policy.Json, nil
    			}).(pulumi.StringPtrOutput),
    		})
    		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 fs = new Aws.Efs.FileSystem("fs", new()
        {
            CreationToken = "my-product",
        });
    
        var policy = Aws.Iam.GetPolicyDocument.Invoke(new()
        {
            Statements = new[]
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
                {
                    Sid = "ExampleStatement01",
                    Effect = "Allow",
                    Principals = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                        {
                            Type = "AWS",
                            Identifiers = new[]
                            {
                                "*",
                            },
                        },
                    },
                    Actions = new[]
                    {
                        "elasticfilesystem:ClientMount",
                        "elasticfilesystem:ClientWrite",
                    },
                    Resources = new[]
                    {
                        fs.Arn,
                    },
                    Conditions = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementConditionInputArgs
                        {
                            Test = "Bool",
                            Variable = "aws:SecureTransport",
                            Values = new[]
                            {
                                "true",
                            },
                        },
                    },
                },
            },
        });
    
        var policyFileSystemPolicy = new Aws.Efs.FileSystemPolicy("policy", new()
        {
            FileSystemId = fs.Id,
            Policy = policy.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.efs.FileSystem;
    import com.pulumi.aws.efs.FileSystemArgs;
    import com.pulumi.aws.iam.IamFunctions;
    import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
    import com.pulumi.aws.efs.FileSystemPolicy;
    import com.pulumi.aws.efs.FileSystemPolicyArgs;
    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 fs = new FileSystem("fs", FileSystemArgs.builder()
                .creationToken("my-product")
                .build());
    
            final var policy = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                .statements(GetPolicyDocumentStatementArgs.builder()
                    .sid("ExampleStatement01")
                    .effect("Allow")
                    .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                        .type("AWS")
                        .identifiers("*")
                        .build())
                    .actions(                
                        "elasticfilesystem:ClientMount",
                        "elasticfilesystem:ClientWrite")
                    .resources(fs.arn())
                    .conditions(GetPolicyDocumentStatementConditionArgs.builder()
                        .test("Bool")
                        .variable("aws:SecureTransport")
                        .values("true")
                        .build())
                    .build())
                .build());
    
            var policyFileSystemPolicy = new FileSystemPolicy("policyFileSystemPolicy", FileSystemPolicyArgs.builder()
                .fileSystemId(fs.id())
                .policy(policy.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(policy -> policy.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
                .build());
    
        }
    }
    
    resources:
      fs:
        type: aws:efs:FileSystem
        properties:
          creationToken: my-product
      policyFileSystemPolicy:
        type: aws:efs:FileSystemPolicy
        name: policy
        properties:
          fileSystemId: ${fs.id}
          policy: ${policy.json}
    variables:
      policy:
        fn::invoke:
          Function: aws:iam:getPolicyDocument
          Arguments:
            statements:
              - sid: ExampleStatement01
                effect: Allow
                principals:
                  - type: AWS
                    identifiers:
                      - '*'
                actions:
                  - elasticfilesystem:ClientMount
                  - elasticfilesystem:ClientWrite
                resources:
                  - ${fs.arn}
                conditions:
                  - test: Bool
                    variable: aws:SecureTransport
                    values:
                      - 'true'
    

    Create FileSystemPolicy Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new FileSystemPolicy(name: string, args: FileSystemPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def FileSystemPolicy(resource_name: str,
                         args: FileSystemPolicyArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def FileSystemPolicy(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         file_system_id: Optional[str] = None,
                         policy: Optional[str] = None,
                         bypass_policy_lockout_safety_check: Optional[bool] = None)
    func NewFileSystemPolicy(ctx *Context, name string, args FileSystemPolicyArgs, opts ...ResourceOption) (*FileSystemPolicy, error)
    public FileSystemPolicy(string name, FileSystemPolicyArgs args, CustomResourceOptions? opts = null)
    public FileSystemPolicy(String name, FileSystemPolicyArgs args)
    public FileSystemPolicy(String name, FileSystemPolicyArgs args, CustomResourceOptions options)
    
    type: aws:efs:FileSystemPolicy
    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 FileSystemPolicyArgs
    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 FileSystemPolicyArgs
    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 FileSystemPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FileSystemPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FileSystemPolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var fileSystemPolicyResource = new Aws.Efs.FileSystemPolicy("fileSystemPolicyResource", new()
    {
        FileSystemId = "string",
        Policy = "string",
        BypassPolicyLockoutSafetyCheck = false,
    });
    
    example, err := efs.NewFileSystemPolicy(ctx, "fileSystemPolicyResource", &efs.FileSystemPolicyArgs{
    	FileSystemId:                   pulumi.String("string"),
    	Policy:                         pulumi.String("string"),
    	BypassPolicyLockoutSafetyCheck: pulumi.Bool(false),
    })
    
    var fileSystemPolicyResource = new FileSystemPolicy("fileSystemPolicyResource", FileSystemPolicyArgs.builder()
        .fileSystemId("string")
        .policy("string")
        .bypassPolicyLockoutSafetyCheck(false)
        .build());
    
    file_system_policy_resource = aws.efs.FileSystemPolicy("fileSystemPolicyResource",
        file_system_id="string",
        policy="string",
        bypass_policy_lockout_safety_check=False)
    
    const fileSystemPolicyResource = new aws.efs.FileSystemPolicy("fileSystemPolicyResource", {
        fileSystemId: "string",
        policy: "string",
        bypassPolicyLockoutSafetyCheck: false,
    });
    
    type: aws:efs:FileSystemPolicy
    properties:
        bypassPolicyLockoutSafetyCheck: false
        fileSystemId: string
        policy: string
    

    FileSystemPolicy Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The FileSystemPolicy resource accepts the following input properties:

    FileSystemId string
    The ID of the EFS file system.
    Policy string

    The JSON formatted file system policy for the EFS file system. see Docs for more info.

    The following arguments are optional:

    BypassPolicyLockoutSafetyCheck bool
    A flag to indicate whether to bypass the aws.efs.FileSystemPolicy lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future PutFileSystemPolicy requests on the file system. Set bypass_policy_lockout_safety_check to true only when you intend to prevent the principal that is making the request from making a subsequent PutFileSystemPolicy request on the file system. The default value is false.
    FileSystemId string
    The ID of the EFS file system.
    Policy string

    The JSON formatted file system policy for the EFS file system. see Docs for more info.

    The following arguments are optional:

    BypassPolicyLockoutSafetyCheck bool
    A flag to indicate whether to bypass the aws.efs.FileSystemPolicy lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future PutFileSystemPolicy requests on the file system. Set bypass_policy_lockout_safety_check to true only when you intend to prevent the principal that is making the request from making a subsequent PutFileSystemPolicy request on the file system. The default value is false.
    fileSystemId String
    The ID of the EFS file system.
    policy String

    The JSON formatted file system policy for the EFS file system. see Docs for more info.

    The following arguments are optional:

    bypassPolicyLockoutSafetyCheck Boolean
    A flag to indicate whether to bypass the aws.efs.FileSystemPolicy lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future PutFileSystemPolicy requests on the file system. Set bypass_policy_lockout_safety_check to true only when you intend to prevent the principal that is making the request from making a subsequent PutFileSystemPolicy request on the file system. The default value is false.
    fileSystemId string
    The ID of the EFS file system.
    policy string

    The JSON formatted file system policy for the EFS file system. see Docs for more info.

    The following arguments are optional:

    bypassPolicyLockoutSafetyCheck boolean
    A flag to indicate whether to bypass the aws.efs.FileSystemPolicy lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future PutFileSystemPolicy requests on the file system. Set bypass_policy_lockout_safety_check to true only when you intend to prevent the principal that is making the request from making a subsequent PutFileSystemPolicy request on the file system. The default value is false.
    file_system_id str
    The ID of the EFS file system.
    policy str

    The JSON formatted file system policy for the EFS file system. see Docs for more info.

    The following arguments are optional:

    bypass_policy_lockout_safety_check bool
    A flag to indicate whether to bypass the aws.efs.FileSystemPolicy lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future PutFileSystemPolicy requests on the file system. Set bypass_policy_lockout_safety_check to true only when you intend to prevent the principal that is making the request from making a subsequent PutFileSystemPolicy request on the file system. The default value is false.
    fileSystemId String
    The ID of the EFS file system.
    policy String

    The JSON formatted file system policy for the EFS file system. see Docs for more info.

    The following arguments are optional:

    bypassPolicyLockoutSafetyCheck Boolean
    A flag to indicate whether to bypass the aws.efs.FileSystemPolicy lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future PutFileSystemPolicy requests on the file system. Set bypass_policy_lockout_safety_check to true only when you intend to prevent the principal that is making the request from making a subsequent PutFileSystemPolicy request on the file system. The default value is false.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the FileSystemPolicy 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 FileSystemPolicy Resource

    Get an existing FileSystemPolicy 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?: FileSystemPolicyState, opts?: CustomResourceOptions): FileSystemPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bypass_policy_lockout_safety_check: Optional[bool] = None,
            file_system_id: Optional[str] = None,
            policy: Optional[str] = None) -> FileSystemPolicy
    func GetFileSystemPolicy(ctx *Context, name string, id IDInput, state *FileSystemPolicyState, opts ...ResourceOption) (*FileSystemPolicy, error)
    public static FileSystemPolicy Get(string name, Input<string> id, FileSystemPolicyState? state, CustomResourceOptions? opts = null)
    public static FileSystemPolicy get(String name, Output<String> id, FileSystemPolicyState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    BypassPolicyLockoutSafetyCheck bool
    A flag to indicate whether to bypass the aws.efs.FileSystemPolicy lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future PutFileSystemPolicy requests on the file system. Set bypass_policy_lockout_safety_check to true only when you intend to prevent the principal that is making the request from making a subsequent PutFileSystemPolicy request on the file system. The default value is false.
    FileSystemId string
    The ID of the EFS file system.
    Policy string

    The JSON formatted file system policy for the EFS file system. see Docs for more info.

    The following arguments are optional:

    BypassPolicyLockoutSafetyCheck bool
    A flag to indicate whether to bypass the aws.efs.FileSystemPolicy lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future PutFileSystemPolicy requests on the file system. Set bypass_policy_lockout_safety_check to true only when you intend to prevent the principal that is making the request from making a subsequent PutFileSystemPolicy request on the file system. The default value is false.
    FileSystemId string
    The ID of the EFS file system.
    Policy string

    The JSON formatted file system policy for the EFS file system. see Docs for more info.

    The following arguments are optional:

    bypassPolicyLockoutSafetyCheck Boolean
    A flag to indicate whether to bypass the aws.efs.FileSystemPolicy lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future PutFileSystemPolicy requests on the file system. Set bypass_policy_lockout_safety_check to true only when you intend to prevent the principal that is making the request from making a subsequent PutFileSystemPolicy request on the file system. The default value is false.
    fileSystemId String
    The ID of the EFS file system.
    policy String

    The JSON formatted file system policy for the EFS file system. see Docs for more info.

    The following arguments are optional:

    bypassPolicyLockoutSafetyCheck boolean
    A flag to indicate whether to bypass the aws.efs.FileSystemPolicy lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future PutFileSystemPolicy requests on the file system. Set bypass_policy_lockout_safety_check to true only when you intend to prevent the principal that is making the request from making a subsequent PutFileSystemPolicy request on the file system. The default value is false.
    fileSystemId string
    The ID of the EFS file system.
    policy string

    The JSON formatted file system policy for the EFS file system. see Docs for more info.

    The following arguments are optional:

    bypass_policy_lockout_safety_check bool
    A flag to indicate whether to bypass the aws.efs.FileSystemPolicy lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future PutFileSystemPolicy requests on the file system. Set bypass_policy_lockout_safety_check to true only when you intend to prevent the principal that is making the request from making a subsequent PutFileSystemPolicy request on the file system. The default value is false.
    file_system_id str
    The ID of the EFS file system.
    policy str

    The JSON formatted file system policy for the EFS file system. see Docs for more info.

    The following arguments are optional:

    bypassPolicyLockoutSafetyCheck Boolean
    A flag to indicate whether to bypass the aws.efs.FileSystemPolicy lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future PutFileSystemPolicy requests on the file system. Set bypass_policy_lockout_safety_check to true only when you intend to prevent the principal that is making the request from making a subsequent PutFileSystemPolicy request on the file system. The default value is false.
    fileSystemId String
    The ID of the EFS file system.
    policy String

    The JSON formatted file system policy for the EFS file system. see Docs for more info.

    The following arguments are optional:

    Import

    Using pulumi import, import the EFS file system policies using the id. For example:

    $ pulumi import aws:efs/fileSystemPolicy:FileSystemPolicy foo fs-6fa144c6
    

    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 aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.41.0 published on Tuesday, Jun 18, 2024 by Pulumi