Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

AWS Classic

v4.25.0 published on Friday, Oct 15, 2021 by Pulumi

FileSystemPolicy

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

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var fs = new Aws.Efs.FileSystem("fs", new Aws.Efs.FileSystemArgs
        {
        });
        var policy = new Aws.Efs.FileSystemPolicy("policy", new Aws.Efs.FileSystemPolicyArgs
        {
            FileSystemId = fs.Id,
            BypassPolicyLockoutSafetyCheck = true,
            Policy = @$"{{
    ""Version"": ""2012-10-17"",
    ""Id"": ""ExamplePolicy01"",
    ""Statement"": [
        {{
            ""Sid"": ""ExampleStatement01"",
            ""Effect"": ""Allow"",
            ""Principal"": {{
                ""AWS"": ""*""
            }},
            ""Resource"": ""{aws_efs_file_system.Test.Arn}"",
            ""Action"": [
                ""elasticfilesystem:ClientMount"",
                ""elasticfilesystem:ClientWrite""
            ],
            ""Condition"": {{
                ""Bool"": {{
                    ""aws:SecureTransport"": ""true""
                }}
            }}
        }}
    ]
}}
",
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/efs"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		fs, err := efs.NewFileSystem(ctx, "fs", nil)
		if err != nil {
			return err
		}
		_, err = efs.NewFileSystemPolicy(ctx, "policy", &efs.FileSystemPolicyArgs{
			FileSystemId:                   fs.ID(),
			BypassPolicyLockoutSafetyCheck: pulumi.Bool(true),
			Policy:                         pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "    \"Version\": \"2012-10-17\",\n", "    \"Id\": \"ExamplePolicy01\",\n", "    \"Statement\": [\n", "        {\n", "            \"Sid\": \"ExampleStatement01\",\n", "            \"Effect\": \"Allow\",\n", "            \"Principal\": {\n", "                \"AWS\": \"*\"\n", "            },\n", "            \"Resource\": \"", aws_efs_file_system.Test.Arn, "\",\n", "            \"Action\": [\n", "                \"elasticfilesystem:ClientMount\",\n", "                \"elasticfilesystem:ClientWrite\"\n", "            ],\n", "            \"Condition\": {\n", "                \"Bool\": {\n", "                    \"aws:SecureTransport\": \"true\"\n", "                }\n", "            }\n", "        }\n", "    ]\n", "}\n")),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

fs = aws.efs.FileSystem("fs")
policy = aws.efs.FileSystemPolicy("policy",
    file_system_id=fs.id,
    bypass_policy_lockout_safety_check=True,
    policy=f"""{{
    "Version": "2012-10-17",
    "Id": "ExamplePolicy01",
    "Statement": [
        {{
            "Sid": "ExampleStatement01",
            "Effect": "Allow",
            "Principal": {{
                "AWS": "*"
            }},
            "Resource": "{aws_efs_file_system["test"]["arn"]}",
            "Action": [
                "elasticfilesystem:ClientMount",
                "elasticfilesystem:ClientWrite"
            ],
            "Condition": {{
                "Bool": {{
                    "aws:SecureTransport": "true"
                }}
            }}
        }}
    ]
}}
""")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const fs = new aws.efs.FileSystem("fs", {});
const policy = new aws.efs.FileSystemPolicy("policy", {
    fileSystemId: fs.id,
    bypassPolicyLockoutSafetyCheck: true,
    policy: `{
    "Version": "2012-10-17",
    "Id": "ExamplePolicy01",
    "Statement": [
        {
            "Sid": "ExampleStatement01",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Resource": "${aws_efs_file_system.test.arn}",
            "Action": [
                "elasticfilesystem:ClientMount",
                "elasticfilesystem:ClientWrite"
            ],
            "Condition": {
                "Bool": {
                    "aws:SecureTransport": "true"
                }
            }
        }
    ]
}
`,
});

Create a FileSystemPolicy Resource

new FileSystemPolicy(name: string, args: FileSystemPolicyArgs, opts?: CustomResourceOptions);
@overload
def FileSystemPolicy(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     bypass_policy_lockout_safety_check: Optional[bool] = None,
                     file_system_id: Optional[str] = None,
                     policy: Optional[str] = None)
@overload
def FileSystemPolicy(resource_name: str,
                     args: FileSystemPolicyArgs,
                     opts: Optional[ResourceOptions] = None)
func NewFileSystemPolicy(ctx *Context, name string, args FileSystemPolicyArgs, opts ...ResourceOption) (*FileSystemPolicy, error)
public FileSystemPolicy(string name, FileSystemPolicyArgs args, CustomResourceOptions? opts = null)
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.

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.
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.
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.
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.
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.

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 str
The provider-assigned unique ID for this managed resource.

Look up an 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)
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:

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.
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.
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.
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.

Import

The EFS file system policies can be imported using the id, e.g.

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

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.