mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
provider/aws: Add documentation for the EFS File System DataSource
This commit is contained in:
parent
6f4f13e462
commit
be002d9345
@ -19,34 +19,35 @@ func dataSourceAwsEfsFileSystem() *schema.Resource {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
ForceNew: true,
|
||||||
ValidateFunc: validateMaxLength(64),
|
ValidateFunc: validateMaxLength(64),
|
||||||
},
|
},
|
||||||
"id": {
|
"file_system_id": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
ForceNew: true,
|
||||||
},
|
},
|
||||||
"performance_mode": {
|
"performance_mode": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
"tags": tagsSchema(),
|
"tags": tagsSchemaComputed(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataSourceAwsEfsFileSystemRead(d *schema.ResourceData, meta interface{}) error {
|
func dataSourceAwsEfsFileSystemRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
efsconn := meta.(*AWSClient).efsconn
|
efsconn := meta.(*AWSClient).efsconn
|
||||||
efsCreationToken := d.Get("creation_token").(string)
|
|
||||||
efsFileSystemId := d.Get("id").(string)
|
|
||||||
|
|
||||||
describeEfsOpts := &efs.DescribeFileSystemsInput{}
|
describeEfsOpts := &efs.DescribeFileSystemsInput{}
|
||||||
switch {
|
|
||||||
case efsCreationToken != "":
|
if v, ok := d.GetOk("creation_token"); ok {
|
||||||
describeEfsOpts.CreationToken = aws.String(efsCreationToken)
|
describeEfsOpts.CreationToken = aws.String(v.(string))
|
||||||
case efsFileSystemId != "":
|
}
|
||||||
describeEfsOpts.FileSystemId = aws.String(efsFileSystemId)
|
|
||||||
|
if v, ok := d.GetOk("file_system_id"); ok {
|
||||||
|
describeEfsOpts.FileSystemId = aws.String(v.(string))
|
||||||
}
|
}
|
||||||
|
|
||||||
describeResp, err := efsconn.DescribeFileSystems(describeEfsOpts)
|
describeResp, err := efsconn.DescribeFileSystems(describeEfsOpts)
|
||||||
@ -106,6 +107,7 @@ func dataSourceAwsEfsFileSystemRead(d *schema.ResourceData, meta interface{}) er
|
|||||||
|
|
||||||
d.Set("creation_token", fs.CreationToken)
|
d.Set("creation_token", fs.CreationToken)
|
||||||
d.Set("performance_mode", fs.PerformanceMode)
|
d.Set("performance_mode", fs.PerformanceMode)
|
||||||
|
d.Set("file_system_id", fs.FileSystemId)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ func TestAccDataSourceAwsEfsFileSystem(t *testing.T) {
|
|||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
resource.TestStep{
|
{
|
||||||
Config: testAccDataSourceAwsEfsFileSystemConfig,
|
Config: testAccDataSourceAwsEfsFileSystemConfig,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccDataSourceAwsEfsFileSystemCheck("data.aws_efs_file_system.by_creation_token"),
|
testAccDataSourceAwsEfsFileSystemCheck("data.aws_efs_file_system.by_creation_token"),
|
||||||
@ -59,10 +59,6 @@ func testAccDataSourceAwsEfsFileSystemCheck(name string) resource.TestCheckFunc
|
|||||||
}
|
}
|
||||||
|
|
||||||
const testAccDataSourceAwsEfsFileSystemConfig = `
|
const testAccDataSourceAwsEfsFileSystemConfig = `
|
||||||
provider "aws" {
|
|
||||||
region = "us-west-2"
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "aws_efs_file_system" "test" {}
|
resource "aws_efs_file_system" "test" {}
|
||||||
|
|
||||||
data "aws_efs_file_system" "by_creation_token" {
|
data "aws_efs_file_system" "by_creation_token" {
|
||||||
@ -70,6 +66,6 @@ data "aws_efs_file_system" "by_creation_token" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data "aws_efs_file_system" "by_id" {
|
data "aws_efs_file_system" "by_id" {
|
||||||
id = "${aws_efs_file_system.test.id}"
|
file_system_id = "${aws_efs_file_system.test.id}"
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
---
|
||||||
|
layout: "aws"
|
||||||
|
page_title: "AWS: efs_file_system"
|
||||||
|
sidebar_current: "docs-aws-datasource-efs-file-system"
|
||||||
|
description: |-
|
||||||
|
Provides an Elastic File System (EFS) data source.
|
||||||
|
---
|
||||||
|
|
||||||
|
# aws_efs_file_system
|
||||||
|
|
||||||
|
Provides information about an Elastic File System (EFS).
|
||||||
|
|
||||||
|
## Example Usage
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
variable "file_system_id" {
|
||||||
|
type = "string"
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
data "aws_efs_file_system" "by_id" {
|
||||||
|
file_system_id = "${var.file_system_id}"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Argument Reference
|
||||||
|
|
||||||
|
The following arguments are supported:
|
||||||
|
|
||||||
|
* `file_system_id` - (Optional) The ID that identifies the file system (e.g. fs-ccfc0d65).
|
||||||
|
* `creation_token` - (Optional) Restricts the list to the file system with this creation token
|
||||||
|
|
||||||
|
## Attributes Reference
|
||||||
|
|
||||||
|
The following attributes are exported:
|
||||||
|
|
||||||
|
* `performance_mode` - The PerformanceMode of the file system.
|
||||||
|
* `tags` - The list of tags assigned to the file system.
|
||||||
|
|
@ -62,6 +62,9 @@
|
|||||||
<li<%= sidebar_current("docs-aws-datasource-ecs-task-definition") %>>
|
<li<%= sidebar_current("docs-aws-datasource-ecs-task-definition") %>>
|
||||||
<a href="/docs/providers/aws/d/ecs_task_definition.html">aws_ecs_task_definition</a>
|
<a href="/docs/providers/aws/d/ecs_task_definition.html">aws_ecs_task_definition</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li<%= sidebar_current("docs-aws-datasource-efs-file-system") %>>
|
||||||
|
<a href="/docs/providers/aws/d/efs_file_system.html">aws_efs_file_system</a>
|
||||||
|
</li>
|
||||||
<li<%= sidebar_current("docs-aws-datasource-elb-hosted-zone-id") %>>
|
<li<%= sidebar_current("docs-aws-datasource-elb-hosted-zone-id") %>>
|
||||||
<a href="/docs/providers/aws/d/elb_hosted_zone_id.html">aws_elb_hosted_zone_id</a>
|
<a href="/docs/providers/aws/d/elb_hosted_zone_id.html">aws_elb_hosted_zone_id</a>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user