From 79998b175bf3a6208a406c4c3499e1ae3fc56494 Mon Sep 17 00:00:00 2001 From: Ilia Lazebnik Date: Fri, 26 Mar 2021 21:43:06 +0300 Subject: [PATCH] resource/aws_efs_file_system: Add attributes and refactor to use waiter package (#17969) Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption (15.26s) --- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy (29.48s) --- PASS: TestAccAWSEFSFileSystem_disappears (37.95s) --- PASS: TestAccAWSEFSFileSystem_kmsKey (54.93s) --- PASS: TestAccAWSEFSFileSystem_ThroughputMode (65.88s) --- PASS: TestAccAWSEFSFileSystem_basic (83.23s) --- PASS: TestAccAWSEFSFileSystem_pagedTags (85.76s) --- PASS: TestAccAWSEFSFileSystem_ProvisionedThroughputInMibps (94.41s) --- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy_removal (96.71s) --- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy_update (107.04s) --- PASS: TestAccAWSEFSFileSystem_tags (142.76s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption (19.51s) --- PASS: TestAccAWSEFSFileSystem_pagedTags (58.12s) --- PASS: TestAccAWSEFSFileSystem_kmsKey (64.15s) --- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy (67.15s) --- PASS: TestAccAWSEFSFileSystem_disappears (85.41s) --- PASS: TestAccAWSEFSFileSystem_basic (95.51s) --- PASS: TestAccAWSEFSFileSystem_ThroughputMode (101.41s) --- PASS: TestAccAWSEFSFileSystem_ProvisionedThroughputInMibps (103.19s) --- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy_update (105.87s) --- PASS: TestAccAWSEFSFileSystem_tags (149.67s) --- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy_removal (151.51s) ``` --- .changelog/17969.txt | 3 + aws/internal/service/efs/waiter/status.go | 23 ++ aws/internal/service/efs/waiter/waiter.go | 50 ++++- aws/resource_aws_efs_file_system.go | 212 ++++++++----------- aws/resource_aws_efs_file_system_test.go | 48 ++--- website/docs/r/efs_file_system.html.markdown | 9 + 6 files changed, 189 insertions(+), 156 deletions(-) create mode 100644 .changelog/17969.txt diff --git a/.changelog/17969.txt b/.changelog/17969.txt new file mode 100644 index 00000000000..40a3386fda3 --- /dev/null +++ b/.changelog/17969.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_efs_file_system: Add `number_of_mount_targets`, `size_in_bytes` and `owner_id` attributes +``` \ No newline at end of file diff --git a/aws/internal/service/efs/waiter/status.go b/aws/internal/service/efs/waiter/status.go index d48fb58c92b..97d4f7d1612 100644 --- a/aws/internal/service/efs/waiter/status.go +++ b/aws/internal/service/efs/waiter/status.go @@ -28,3 +28,26 @@ func AccessPointLifeCycleState(conn *efs.EFS, accessPointId string) resource.Sta return mt, aws.StringValue(mt.LifeCycleState), nil } } + +// FileSystemLifeCycleState fetches the Access Point and its LifecycleState +func FileSystemLifeCycleState(conn *efs.EFS, fileSystemID string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + input := &efs.DescribeFileSystemsInput{ + FileSystemId: aws.String(fileSystemID), + } + + output, err := conn.DescribeFileSystems(input) + + if err != nil { + return nil, "", err + } + + if output == nil || len(output.FileSystems) == 0 || output.FileSystems[0] == nil { + return nil, "", nil + } + + mt := output.FileSystems[0] + + return mt, aws.StringValue(mt.LifeCycleState), nil + } +} diff --git a/aws/internal/service/efs/waiter/waiter.go b/aws/internal/service/efs/waiter/waiter.go index 71db067975a..fd065e5c89d 100644 --- a/aws/internal/service/efs/waiter/waiter.go +++ b/aws/internal/service/efs/waiter/waiter.go @@ -9,8 +9,14 @@ import ( const ( // Maximum amount of time to wait for an Operation to return Success - AccessPointCreatedTimeout = 10 * time.Minute - AccessPointDeletedTimeout = 10 * time.Minute + AccessPointCreatedTimeout = 10 * time.Minute + AccessPointDeletedTimeout = 10 * time.Minute + FileSystemAvailableTimeout = 10 * time.Minute + FileSystemAvailableDelayTimeout = 2 * time.Second + FileSystemAvailableMinTimeout = 3 * time.Second + FileSystemDeletedTimeout = 10 * time.Minute + FileSystemDeletedDelayTimeout = 2 * time.Second + FileSystemDeletedMinTimeout = 3 * time.Second ) // AccessPointCreated waits for an Operation to return Success @@ -48,3 +54,43 @@ func AccessPointDeleted(conn *efs.EFS, accessPointId string) (*efs.AccessPointDe return nil, err } + +// FileSystemAvailable waits for an Operation to return Available +func FileSystemAvailable(conn *efs.EFS, fileSystemID string) (*efs.FileSystemDescription, error) { + stateConf := &resource.StateChangeConf{ + Pending: []string{efs.LifeCycleStateCreating, efs.LifeCycleStateUpdating}, + Target: []string{efs.LifeCycleStateAvailable}, + Refresh: FileSystemLifeCycleState(conn, fileSystemID), + Timeout: FileSystemAvailableTimeout, + Delay: FileSystemAvailableDelayTimeout, + MinTimeout: FileSystemAvailableMinTimeout, + } + + outputRaw, err := stateConf.WaitForState() + + if output, ok := outputRaw.(*efs.FileSystemDescription); ok { + return output, err + } + + return nil, err +} + +// FileSystemDeleted waits for an Operation to return Deleted +func FileSystemDeleted(conn *efs.EFS, fileSystemID string) (*efs.FileSystemDescription, error) { + stateConf := &resource.StateChangeConf{ + Pending: []string{efs.LifeCycleStateAvailable, efs.LifeCycleStateDeleting}, + Target: []string{}, + Refresh: FileSystemLifeCycleState(conn, fileSystemID), + Timeout: FileSystemDeletedTimeout, + Delay: FileSystemDeletedDelayTimeout, + MinTimeout: FileSystemDeletedMinTimeout, + } + + outputRaw, err := stateConf.WaitForState() + + if output, ok := outputRaw.(*efs.FileSystemDescription); ok { + return output, err + } + + return nil, err +} diff --git a/aws/resource_aws_efs_file_system.go b/aws/resource_aws_efs_file_system.go index 3ee30becd2b..7a90f70fe39 100644 --- a/aws/resource_aws_efs_file_system.go +++ b/aws/resource_aws_efs_file_system.go @@ -4,15 +4,14 @@ import ( "errors" "fmt" "log" - "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/service/efs" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/efs/waiter" ) func resourceAwsEfsFileSystem() *schema.Resource { @@ -41,14 +40,11 @@ func resourceAwsEfsFileSystem() *schema.Resource { }, "performance_mode": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - efs.PerformanceModeGeneralPurpose, - efs.PerformanceModeMaxIo, - }, false), + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(efs.PerformanceMode_Values(), false), }, "encrypted": { @@ -75,17 +71,21 @@ func resourceAwsEfsFileSystem() *schema.Resource { Type: schema.TypeFloat, Optional: true, }, - + "number_of_mount_targets": { + Type: schema.TypeInt, + Computed: true, + }, + "owner_id": { + Type: schema.TypeString, + Computed: true, + }, "tags": tagsSchema(), "throughput_mode": { - Type: schema.TypeString, - Optional: true, - Default: efs.ThroughputModeBursting, - ValidateFunc: validation.StringInSlice([]string{ - efs.ThroughputModeBursting, - efs.ThroughputModeProvisioned, - }, false), + Type: schema.TypeString, + Optional: true, + Default: efs.ThroughputModeBursting, + ValidateFunc: validation.StringInSlice(efs.ThroughputMode_Values(), false), }, "lifecycle_policy": { @@ -95,15 +95,29 @@ func resourceAwsEfsFileSystem() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "transition_to_ia": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - efs.TransitionToIARulesAfter7Days, - efs.TransitionToIARulesAfter14Days, - efs.TransitionToIARulesAfter30Days, - efs.TransitionToIARulesAfter60Days, - efs.TransitionToIARulesAfter90Days, - }, false), + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(efs.TransitionToIARules_Values(), false), + }, + }, + }, + }, + "size_in_bytes": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "value": { + Type: schema.TypeInt, + Computed: true, + }, + "value_in_ia": { + Type: schema.TypeInt, + Computed: true, + }, + "value_in_standard": { + Type: schema.TypeInt, + Computed: true, }, }, }, @@ -155,25 +169,16 @@ func resourceAwsEfsFileSystemCreate(d *schema.ResourceData, meta interface{}) er log.Printf("[DEBUG] EFS file system create options: %#v", *createOpts) fs, err := conn.CreateFileSystem(createOpts) if err != nil { - return fmt.Errorf("Error creating EFS file system: %s", err) + return fmt.Errorf("Error creating EFS file system: %w", err) } d.SetId(aws.StringValue(fs.FileSystemId)) log.Printf("[INFO] EFS file system ID: %s", d.Id()) - stateConf := &resource.StateChangeConf{ - Pending: []string{efs.LifeCycleStateCreating}, - Target: []string{efs.LifeCycleStateAvailable}, - Refresh: resourceEfsFileSystemCreateUpdateRefreshFunc(d.Id(), conn), - Timeout: 10 * time.Minute, - Delay: 2 * time.Second, - MinTimeout: 3 * time.Second, + if _, err := waiter.FileSystemAvailable(conn, d.Id()); err != nil { + return fmt.Errorf("error waiting for EFS file system (%s) to be available: %w", d.Id(), err) } - _, err = stateConf.WaitForState() - if err != nil { - return fmt.Errorf("Error waiting for EFS file system (%q) to create: %s", d.Id(), err) - } log.Printf("[DEBUG] EFS file system %q created.", d.Id()) _, hasLifecyclePolicy := d.GetOk("lifecycle_policy") @@ -208,21 +213,11 @@ func resourceAwsEfsFileSystemUpdate(d *schema.ResourceData, meta interface{}) er _, err := conn.UpdateFileSystem(input) if err != nil { - return fmt.Errorf("error updating EFS File System %q: %s", d.Id(), err) + return fmt.Errorf("error updating EFS file system (%s): %w", d.Id(), err) } - stateConf := &resource.StateChangeConf{ - Pending: []string{efs.LifeCycleStateUpdating}, - Target: []string{efs.LifeCycleStateAvailable}, - Refresh: resourceEfsFileSystemCreateUpdateRefreshFunc(d.Id(), conn), - Timeout: 10 * time.Minute, - Delay: 2 * time.Second, - MinTimeout: 3 * time.Second, - } - - _, err = stateConf.WaitForState() - if err != nil { - return fmt.Errorf("error waiting for EFS file system (%q) to update: %s", d.Id(), err) + if _, err := waiter.FileSystemAvailable(conn, d.Id()); err != nil { + return fmt.Errorf("error waiting for EFS file system (%s) to be available: %w", d.Id(), err) } } @@ -250,7 +245,7 @@ func resourceAwsEfsFileSystemUpdate(d *schema.ResourceData, meta interface{}) er o, n := d.GetChange("tags") if err := keyvaluetags.EfsUpdateTags(conn, d.Id(), o, n); err != nil { - return fmt.Errorf("error updating EFS file system (%s) tags: %s", d.Id(), err) + return fmt.Errorf("error updating EFS file system (%s) tags: %w", d.Id(), err) } } @@ -285,43 +280,40 @@ func resourceAwsEfsFileSystemRead(d *schema.ResourceData, meta interface{}) erro } } if fs == nil { - log.Printf("[WARN] EFS (%s) not found, removing from state", d.Id()) + log.Printf("[WARN] EFS File System (%s) not found, removing from state", d.Id()) d.SetId("") return nil } - fsARN := arn.ARN{ - AccountID: meta.(*AWSClient).accountid, - Partition: meta.(*AWSClient).partition, - Region: meta.(*AWSClient).region, - Resource: fmt.Sprintf("file-system/%s", aws.StringValue(fs.FileSystemId)), - Service: "elasticfilesystem", - }.String() - - d.Set("arn", fsARN) + d.Set("arn", fs.FileSystemArn) d.Set("creation_token", fs.CreationToken) d.Set("encrypted", fs.Encrypted) d.Set("kms_key_id", fs.KmsKeyId) d.Set("performance_mode", fs.PerformanceMode) d.Set("provisioned_throughput_in_mibps", fs.ProvisionedThroughputInMibps) d.Set("throughput_mode", fs.ThroughputMode) + d.Set("owner_id", fs.OwnerId) + d.Set("number_of_mount_targets", fs.NumberOfMountTargets) if err := d.Set("tags", keyvaluetags.EfsKeyValueTags(fs.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + return fmt.Errorf("error setting tags: %w", err) + } + + if err := d.Set("size_in_bytes", flattenEfsFileSystemSizeInBytes(fs.SizeInBytes)); err != nil { + return fmt.Errorf("error setting size_in_bytes: %w", err) } d.Set("dns_name", meta.(*AWSClient).RegionalHostname(fmt.Sprintf("%s.efs", aws.StringValue(fs.FileSystemId)))) res, err := conn.DescribeLifecycleConfiguration(&efs.DescribeLifecycleConfigurationInput{ - FileSystemId: fs.FileSystemId, + FileSystemId: aws.String(d.Id()), }) if err != nil { - return fmt.Errorf("Error describing lifecycle configuration for EFS file system (%s): %s", - aws.StringValue(fs.FileSystemId), err) + return fmt.Errorf("Error describing lifecycle configuration for EFS file system (%s): %w", d.Id(), err) } if err := d.Set("lifecycle_policy", flattenEfsFileSystemLifecyclePolicies(res.LifecyclePolicies)); err != nil { - return fmt.Errorf("error setting lifecycle_policy: %s", err) + return fmt.Errorf("error setting lifecycle_policy: %w", err) } return nil @@ -335,50 +327,22 @@ func resourceAwsEfsFileSystemDelete(d *schema.ResourceData, meta interface{}) er FileSystemId: aws.String(d.Id()), }) if err != nil { + if isAWSErr(err, efs.ErrCodeFileSystemNotFound, "") { + return nil + } return fmt.Errorf("Error delete file system: %s with err %s", d.Id(), err.Error()) } - err = waitForDeleteEfsFileSystem(conn, d.Id(), 10*time.Minute) - if err != nil { - return fmt.Errorf("Error waiting for EFS file system (%q) to delete: %w", d.Id(), err) + if _, err := waiter.FileSystemDeleted(conn, d.Id()); err != nil { + if isAWSErr(err, efs.ErrCodeFileSystemNotFound, "") { + return nil + } + return fmt.Errorf("error waiting for EFS file system (%s) deletion: %w", d.Id(), err) } - log.Printf("[DEBUG] EFS file system %q deleted.", d.Id()) - return nil } -func waitForDeleteEfsFileSystem(conn *efs.EFS, id string, timeout time.Duration) error { - stateConf := &resource.StateChangeConf{ - Pending: []string{"available", "deleting"}, - Target: []string{}, - Refresh: func() (interface{}, string, error) { - resp, err := conn.DescribeFileSystems(&efs.DescribeFileSystemsInput{ - FileSystemId: aws.String(id), - }) - if err != nil { - if isAWSErr(err, efs.ErrCodeFileSystemNotFound, "") { - return nil, "", nil - } - return nil, "error", err - } - - if hasEmptyFileSystems(resp) { - return nil, "", nil - } - - fs := resp.FileSystems[0] - log.Printf("[DEBUG] current status of %q: %q", *fs.FileSystemId, *fs.LifeCycleState) - return fs, *fs.LifeCycleState, nil - }, - Timeout: timeout, - Delay: 2 * time.Second, - MinTimeout: 3 * time.Second, - } - _, err := stateConf.WaitForState() - return err -} - func hasEmptyFileSystems(fs *efs.DescribeFileSystemsOutput) bool { if fs != nil && len(fs.FileSystems) > 0 { return false @@ -386,26 +350,6 @@ func hasEmptyFileSystems(fs *efs.DescribeFileSystemsOutput) bool { return true } -func resourceEfsFileSystemCreateUpdateRefreshFunc(id string, conn *efs.EFS) resource.StateRefreshFunc { - return func() (interface{}, string, error) { - resp, err := conn.DescribeFileSystems(&efs.DescribeFileSystemsInput{ - FileSystemId: aws.String(id), - }) - if err != nil { - return nil, "error", err - } - - if hasEmptyFileSystems(resp) { - return nil, "not-found", fmt.Errorf("EFS file system %q could not be found.", id) - } - - fs := resp.FileSystems[0] - state := aws.StringValue(fs.LifeCycleState) - log.Printf("[DEBUG] current status of %q: %q", id, state) - return fs, state, nil - } -} - func flattenEfsFileSystemLifecyclePolicies(apiObjects []*efs.LifecyclePolicy) []interface{} { var tfList []interface{} @@ -447,3 +391,23 @@ func expandEfsFileSystemLifecyclePolicies(tfList []interface{}) []*efs.Lifecycle return apiObjects } + +func flattenEfsFileSystemSizeInBytes(sizeInBytes *efs.FileSystemSize) []interface{} { + if sizeInBytes == nil { + return []interface{}{} + } + + m := map[string]interface{}{ + "value": aws.Int64Value(sizeInBytes.Value), + } + + if sizeInBytes.ValueInIA != nil { + m["value_in_ia"] = aws.Int64Value(sizeInBytes.ValueInIA) + } + + if sizeInBytes.ValueInStandard != nil { + m["value_in_standard"] = aws.Int64Value(sizeInBytes.ValueInStandard) + } + + return []interface{}{m} +} diff --git a/aws/resource_aws_efs_file_system_test.go b/aws/resource_aws_efs_file_system_test.go index 282287d6414..d91465bd989 100644 --- a/aws/resource_aws_efs_file_system_test.go +++ b/aws/resource_aws_efs_file_system_test.go @@ -5,11 +5,10 @@ import ( "log" "regexp" "testing" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/efs" - multierror "github.com/hashicorp/go-multierror" + "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -32,8 +31,8 @@ func testSweepEfsFileSystems(region string) error { return fmt.Errorf("error getting client: %s", err) } conn := client.(*AWSClient).efsconn + var sweeperErrs *multierror.Error - var errors error input := &efs.DescribeFileSystemsInput{} err = conn.DescribeFileSystemsPages(input, func(page *efs.DescribeFileSystemsOutput, lastPage bool) bool { for _, filesystem := range page.FileSystems { @@ -41,27 +40,24 @@ func testSweepEfsFileSystems(region string) error { log.Printf("[INFO] Deleting EFS File System: %s", id) - _, err := conn.DeleteFileSystem(&efs.DeleteFileSystemInput{ - FileSystemId: filesystem.FileSystemId, - }) - if err != nil { - errors = multierror.Append(errors, fmt.Errorf("error deleting EFS File System %q: %w", id, err)) - continue - } + r := resourceAwsEfsFileSystem() + d := r.Data(nil) + d.SetId(id) + err := r.Delete(d, client) - err = waitForDeleteEfsFileSystem(conn, id, 10*time.Minute) if err != nil { - errors = multierror.Append(fmt.Errorf("error waiting for EFS File System %q to delete: %w", id, err)) + log.Printf("[ERROR] %s", err) + sweeperErrs = multierror.Append(sweeperErrs, err) continue } } return true }) if err != nil { - errors = multierror.Append(errors, fmt.Errorf("error retrieving EFS File Systems: %w", err)) + sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error retrieving EFS File Systems: %w", err)) } - return errors + return sweeperErrs.ErrorOrNil() } func TestResourceAWSEFSFileSystem_hasEmptyFileSystems(t *testing.T) { @@ -104,6 +100,12 @@ func TestAccAWSEFSFileSystem_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "throughput_mode", efs.ThroughputModeBursting), testAccCheckEfsFileSystem(resourceName, &desc), testAccCheckEfsFileSystemPerformanceMode(resourceName, "generalPurpose"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "size_in_bytes.#", "1"), + resource.TestCheckResourceAttrSet(resourceName, "size_in_bytes.0.value"), + resource.TestCheckResourceAttrSet(resourceName, "size_in_bytes.0.value_in_ia"), + resource.TestCheckResourceAttrSet(resourceName, "size_in_bytes.0.value_in_standard"), + testAccMatchResourceAttrAccountID(resourceName, "owner_id"), ), }, { @@ -444,7 +446,7 @@ func TestAccAWSEFSFileSystem_lifecyclePolicy_removal(t *testing.T) { func TestAccAWSEFSFileSystem_disappears(t *testing.T) { var desc efs.FileSystemDescription resourceName := "aws_efs_file_system.test" - rName := acctest.RandomWithPrefix("tf-acc-disappears") + rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -456,7 +458,7 @@ func TestAccAWSEFSFileSystem_disappears(t *testing.T) { Config: testAccAWSEFSFileSystemConfig(rName), Check: resource.ComposeTestCheckFunc( testAccCheckEfsFileSystem(resourceName, &desc), - testAccCheckEfsFileSystemDisappears(&desc), + testAccCheckResourceDisappears(testAccProvider, resourceAwsEfsFileSystem(), resourceName), ), ExpectNonEmptyPlan: true, }, @@ -519,20 +521,6 @@ func testAccCheckEfsFileSystem(resourceID string, fDesc *efs.FileSystemDescripti } } -func testAccCheckEfsFileSystemDisappears(fDesc *efs.FileSystemDescription) resource.TestCheckFunc { - return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).efsconn - - input := &efs.DeleteFileSystemInput{ - FileSystemId: fDesc.FileSystemId, - } - - _, err := conn.DeleteFileSystem(input) - - return err - } -} - func testAccCheckEfsCreationToken(resourceID string, expectedToken string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[resourceID] diff --git a/website/docs/r/efs_file_system.html.markdown b/website/docs/r/efs_file_system.html.markdown index bdda69f1c48..eff84716096 100644 --- a/website/docs/r/efs_file_system.html.markdown +++ b/website/docs/r/efs_file_system.html.markdown @@ -64,6 +64,15 @@ In addition to all arguments above, the following attributes are exported: * `arn` - Amazon Resource Name of the file system. * `id` - The ID that identifies the file system (e.g. fs-ccfc0d65). * `dns_name` - The DNS name for the filesystem per [documented convention](http://docs.aws.amazon.com/efs/latest/ug/mounting-fs-mount-cmd-dns-name.html). +* `owner_id` - The AWS account that created the file system. If the file system was createdby an IAM user, the parent account to which the user belongs is the owner. +* `number_of_mount_targets` - The current number of mount targets that the file system has. +* `size_in_bytes` - The latest known metered size (in bytes) of data stored in the file system, the value is not the exact size that the file system was at any point in time. See [Size In Bytes](#size-in-bytes). + +### Size In Bytes + +* `value` - The latest known metered size (in bytes) of data stored in the file system. +* `value_in_ia` - The latest known metered size (in bytes) of data stored in the Infrequent Access storage class. +* `value_in_standard` - The latest known metered size (in bytes) of data stored in the Standard storage class. ## Import