Try AWS Native preview for resources not in the classic version.
aws.efs.FileSystemPolicy
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Provides an Elastic File System (EFS) File System Policy resource.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var fs = new Aws.Efs.FileSystem("fs");
var policyPolicyDocument = 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("policyFileSystemPolicy", new()
{
FileSystemId = fs.Id,
Policy = policyPolicyDocument.Apply(getPolicyDocumentResult => getPolicyDocumentResult.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", nil)
if err != nil {
return err
}
policyPolicyDocument := 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, "policyFileSystemPolicy", &efs.FileSystemPolicyArgs{
FileSystemId: fs.ID(),
Policy: policyPolicyDocument.ApplyT(func(policyPolicyDocument iam.GetPolicyDocumentResult) (*string, error) {
return &policyPolicyDocument.Json, nil
}).(pulumi.StringPtrOutput),
})
if err != nil {
return err
}
return nil
})
}
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.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");
final var policyPolicyDocument = 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(policyPolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(policyPolicyDocument -> policyPolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
.build());
}
}
import pulumi
import pulumi_aws as aws
fs = aws.efs.FileSystem("fs")
policy_policy_document = 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("policyFileSystemPolicy",
file_system_id=fs.id,
policy=policy_policy_document.json)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const fs = new aws.efs.FileSystem("fs", {});
const policyPolicyDocument = 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("policyFileSystemPolicy", {
fileSystemId: fs.id,
policy: policyPolicyDocument.apply(policyPolicyDocument => policyPolicyDocument.json),
});
resources:
fs:
type: aws:efs:FileSystem
policyFileSystemPolicy:
type: aws:efs:FileSystemPolicy
properties:
fileSystemId: ${fs.id}
policy: ${policyPolicyDocument.json}
variables:
policyPolicyDocument:
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
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)
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.
- 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.
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:
- 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.
The following arguments are optional:
- Bypass
Policy boolLockout Safety Check 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 futurePutFileSystemPolicy
requests on the file system. Setbypass_policy_lockout_safety_check
totrue
only when you intend to prevent the principal that is making the request from making a subsequentPutFileSystemPolicy
request on the file system. The default value isfalse
.
- 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.
The following arguments are optional:
- Bypass
Policy boolLockout Safety Check 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 futurePutFileSystemPolicy
requests on the file system. Setbypass_policy_lockout_safety_check
totrue
only when you intend to prevent the principal that is making the request from making a subsequentPutFileSystemPolicy
request on the file system. The default value isfalse
.
- 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.
The following arguments are optional:
- bypass
Policy BooleanLockout Safety Check 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 futurePutFileSystemPolicy
requests on the file system. Setbypass_policy_lockout_safety_check
totrue
only when you intend to prevent the principal that is making the request from making a subsequentPutFileSystemPolicy
request on the file system. The default value isfalse
.
- 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.
The following arguments are optional:
- bypass
Policy booleanLockout Safety Check 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 futurePutFileSystemPolicy
requests on the file system. Setbypass_policy_lockout_safety_check
totrue
only when you intend to prevent the principal that is making the request from making a subsequentPutFileSystemPolicy
request on the file system. The default value isfalse
.
- 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.
The following arguments are optional:
- bypass_
policy_ boollockout_ safety_ check 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 futurePutFileSystemPolicy
requests on the file system. Setbypass_policy_lockout_safety_check
totrue
only when you intend to prevent the principal that is making the request from making a subsequentPutFileSystemPolicy
request on the file system. The default value isfalse
.
- 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.
The following arguments are optional:
- bypass
Policy BooleanLockout Safety Check 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 futurePutFileSystemPolicy
requests on the file system. Setbypass_policy_lockout_safety_check
totrue
only when you intend to prevent the principal that is making the request from making a subsequentPutFileSystemPolicy
request on the file system. The default value isfalse
.
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.
- Bypass
Policy boolLockout Safety Check 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 futurePutFileSystemPolicy
requests on the file system. Setbypass_policy_lockout_safety_check
totrue
only when you intend to prevent the principal that is making the request from making a subsequentPutFileSystemPolicy
request on the file system. The default value isfalse
.- 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.
The following arguments are optional:
- Bypass
Policy boolLockout Safety Check 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 futurePutFileSystemPolicy
requests on the file system. Setbypass_policy_lockout_safety_check
totrue
only when you intend to prevent the principal that is making the request from making a subsequentPutFileSystemPolicy
request on the file system. The default value isfalse
.- 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.
The following arguments are optional:
- bypass
Policy BooleanLockout Safety Check 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 futurePutFileSystemPolicy
requests on the file system. Setbypass_policy_lockout_safety_check
totrue
only when you intend to prevent the principal that is making the request from making a subsequentPutFileSystemPolicy
request on the file system. The default value isfalse
.- 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.
The following arguments are optional:
- bypass
Policy booleanLockout Safety Check 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 futurePutFileSystemPolicy
requests on the file system. Setbypass_policy_lockout_safety_check
totrue
only when you intend to prevent the principal that is making the request from making a subsequentPutFileSystemPolicy
request on the file system. The default value isfalse
.- 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.
The following arguments are optional:
- bypass_
policy_ boollockout_ safety_ check 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 futurePutFileSystemPolicy
requests on the file system. Setbypass_policy_lockout_safety_check
totrue
only when you intend to prevent the principal that is making the request from making a subsequentPutFileSystemPolicy
request on the file system. The default value isfalse
.- 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.
The following arguments are optional:
- bypass
Policy BooleanLockout Safety Check 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 futurePutFileSystemPolicy
requests on the file system. Setbypass_policy_lockout_safety_check
totrue
only when you intend to prevent the principal that is making the request from making a subsequentPutFileSystemPolicy
request on the file system. The default value isfalse
.- 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.
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
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.