Resource: aws_efs_file_system_policy

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

Example Usage

resource "aws_efs_file_system" "fs" {
  creation_token = "my-product"
}

data "aws_iam_policy_document" "policy" {
  statement {
    sid    = "ExampleStatement01"
    effect = "Allow"

    principals {
      type        = "AWS"
      identifiers = ["*"]
    }

    actions = [
      "elasticfilesystem:ClientMount",
      "elasticfilesystem:ClientWrite",
    ]

    resources = [aws_efs_file_system.fs.arn]

    condition {
      test     = "Bool"
      variable = "aws:SecureTransport"
      values   = ["true"]
    }
  }
}

resource "aws_efs_file_system_policy" "policy" {
  file_system_id = aws_efs_file_system.fs.id
  policy         = data.aws_iam_policy_document.policy.json
}

Argument Reference

The following arguments are required:

The following arguments are optional:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import the EFS file system policies using the id. For example:

import {
  to = aws_efs_file_system_policy.foo
  id = "fs-6fa144c6"
}

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

% terraform import aws_efs_file_system_policy.foo fs-6fa144c6