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,
Policy = @$"{{
""Version"": ""2012-10-17"",
""Id"": ""ExamplePolicy01"",
""Statement"": [
{{
""Sid"": ""ExampleSatement01"",
""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/v2/go/aws/efs"
"github.com/pulumi/pulumi/sdk/v2/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(),
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%v", "{\n", " \"Version\": \"2012-10-17\",\n", " \"Id\": \"ExamplePolicy01\",\n", " \"Statement\": [\n", " {\n", " \"Sid\": \"ExampleSatement01\",\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", "\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,
policy=f"""{{
"Version": "2012-10-17",
"Id": "ExamplePolicy01",
"Statement": [
{{
"Sid": "ExampleSatement01",
"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,
policy: pulumi.interpolate`{
"Version": "2012-10-17",
"Id": "ExamplePolicy01",
"Statement": [
{
"Sid": "ExampleSatement01",
"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);def FileSystemPolicy(resource_name, opts=None, file_system_id=None, policy=None, __props__=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.
- 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 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 Programming Model docs.
Inputs
The FileSystemPolicy resource accepts the following input properties:
- File
System stringId 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.
- File
System stringId 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.
- file
System stringId 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.
- file_
system_ strid 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.
Outputs
All input properties are implicitly available as output properties. Additionally, the FileSystemPolicy resource produces the following output properties:
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): FileSystemPolicystatic get(resource_name, id, opts=None, file_system_id=None, policy=None, __props__=None);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:
- File
System stringId 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.
- File
System stringId 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.
- file
System stringId 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.
- file_
system_ strid 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.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.