{"id":51410844,"url":"https://github.com/launchbynttdata/tf-aws-module_primitive-efs_mount_target","last_synced_at":"2026-07-04T14:32:32.846Z","repository":{"id":351114645,"uuid":"1100039464","full_name":"launchbynttdata/tf-aws-module_primitive-efs_mount_target","owner":"launchbynttdata","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-13T16:14:00.000Z","size":50,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-13T18:14:41.328Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/launchbynttdata.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-19T19:00:18.000Z","updated_at":"2026-04-13T16:13:53.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/launchbynttdata/tf-aws-module_primitive-efs_mount_target","commit_stats":null,"previous_names":["launchbynttdata/tf-aws-module_primitive-efs_mount_target"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/launchbynttdata/tf-aws-module_primitive-efs_mount_target","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/launchbynttdata%2Ftf-aws-module_primitive-efs_mount_target","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/launchbynttdata%2Ftf-aws-module_primitive-efs_mount_target/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/launchbynttdata%2Ftf-aws-module_primitive-efs_mount_target/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/launchbynttdata%2Ftf-aws-module_primitive-efs_mount_target/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/launchbynttdata","download_url":"https://codeload.github.com/launchbynttdata/tf-aws-module_primitive-efs_mount_target/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/launchbynttdata%2Ftf-aws-module_primitive-efs_mount_target/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35125718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-04T02:00:05.987Z","response_time":113,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-04T14:32:30.431Z","updated_at":"2026-07-04T14:32:32.833Z","avatar_url":"https://github.com/launchbynttdata.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tf-aws-module_primitive-efs_mount_target\n\n## What is a Primitive Module?\n\nA **primitive module** is a thin, focused Terraform wrapper around a single AWS resource type. Primitive modules:\n\n- Wrap a **single AWS resource** (e.g., `aws_eks_cluster`, `aws_kms_key`, `aws_s3_bucket`)\n- Provide sensible defaults while maintaining full configurability\n- Include comprehensive validation rules\n- Follow consistent patterns for inputs, outputs, and tagging\n- Include automated testing using Terratest\n- Serve as building blocks for higher-level composite modules\n\nFor examples of well-structured primitive modules, see:\n\n- [tf-aws-module_primitive-eks_cluster](https://github.com/launchbynttdata/tf-aws-module_primitive-eks_cluster)\n- [tf-aws-module_primitive-kms_key](https://github.com/launchbynttdata/tf-aws-module_primitive-kms_key)\n\n---\n\n## Getting Started with This Template\n\n### 1. Create Your New Module Repository\n\n1. Click the \"Use this template\" button on GitHub\n2. Name your repository following the naming convention: `tf-aws-module_primitive-\u003cresource_name\u003e`\n   - Examples: `tf-aws-module_primitive-s3_bucket`, `tf-aws-module_primitive-lambda_function`\n3. Clone your new repository locally\n\n### 2. Initialize and Clean Up Template References\n\nAfter cloning, run the cleanup target to update template references with your actual repository information:\n\n```bash\nmake init-module\n```\n\nThis command will:\n\n- Update the `go.mod` file with your repository's GitHub URL\n- Update test imports to reference your new module name\n- Remove template-specific placeholders\n\n### 3. Configure Your Environment\n\nInstall required development dependencies:\n\n```bash\nmake configure-dependencies\nmake configure-git-hooks\n```\n\nThis installs:\n\n- Terraform\n- Go\n- Pre-commit hooks\n- Other development tools specified in `.tool-versions`\n\n---\n\n## HOWTO: Developing a Primitive Module\n\n### Step 1: Define Your Resource\n\n1. **Identify the AWS resource** you're wrapping (e.g., `aws_eks_cluster`)\n2. **Review AWS documentation** for the resource to understand all available parameters\n3. **Study similar primitive modules** for patterns and best practices\n\n### Step 2: Create the Module Structure\n\nYour primitive module should include these core files:\n\n#### `main.tf`\n\n- Contains the primary resource declaration\n- Should be clean and focused on the single resource\n- Example:\n\n```hcl\nresource \"aws_eks_cluster\" \"this\" {\n  name     = var.name\n  role_arn = var.role_arn\n  version  = var.kubernetes_version\n\n  vpc_config {\n    subnet_ids              = var.vpc_config.subnet_ids\n    security_group_ids      = var.vpc_config.security_group_ids\n    endpoint_private_access = var.vpc_config.endpoint_private_access\n    endpoint_public_access  = var.vpc_config.endpoint_public_access\n    public_access_cidrs     = var.vpc_config.public_access_cidrs\n  }\n\n  tags = merge(\n    var.tags,\n    local.default_tags\n  )\n}\n```\n\n#### `variables.tf`\n\n- Define all configurable parameters\n- Include clear descriptions for each variable\n- Set sensible defaults where appropriate\n- Use validation rules to enforce constraints, but only when the validations can be made precise.\n- Alternatively, use [`check`](https://developer.hashicorp.com/terraform/language/block/check) blocks to create more complicated validations. (Requires terraform ~\u003e 1.12)\n- Example:\n\n```hcl\nvariable \"name\" {\n  description = \"Name of the EKS cluster\"\n  type        = string\n\n  validation {\n    condition     = length(var.name) \u003c= 100\n    error_message = \"Cluster name must be 100 characters or less\"\n  }\n}\n\nvariable \"kubernetes_version\" {\n  description = \"Kubernetes version to use for the EKS cluster\"\n  type        = string\n  default     = null\n\n  validation {\n    condition     = var.kubernetes_version == null || can(regex(\"^1\\\\.(2[89]|[3-9][0-9])$\", var.kubernetes_version))\n    error_message = \"Kubernetes version must be 1.28 or higher\"\n  }\n}\n```\n\n#### `outputs.tf`\n\n- Export all useful attributes of the resource\n- Include comprehensive outputs for downstream consumption\n- Document what each output provides\n- Example:\n\n```hcl\noutput \"id\" {\n  description = \"The ID of the EKS cluster\"\n  value       = aws_eks_cluster.this.id\n}\n\noutput \"arn\" {\n  description = \"The ARN of the EKS cluster\"\n  value       = aws_eks_cluster.this.arn\n}\n\noutput \"endpoint\" {\n  description = \"The endpoint for the EKS cluster API server\"\n  value       = aws_eks_cluster.this.endpoint\n}\n```\n\n#### `locals.tf`\n\n- Define local values and transformations\n- Include standard tags (e.g., `provisioner = \"Terraform\"`)\n- Example:\n\n```hcl\nlocals {\n  default_tags = {\n    provisioner = \"Terraform\"\n  }\n}\n\n# tf-aws-module_primitive-efs_mount_target\n\n## Overview\n\nThis primitive module creates a **single** AWS EFS mount target in a specified subnet for a given EFS file system. It wraps the [`aws_efs_mount_target`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/efs_mount_target) resource and is designed to be called once per mount target, typically using `for_each` when multiple mount targets are needed.\n\n## Features\n\n- **Single Mount Target Per Invocation**: Creates one mount target per module call\n- **Security Group Support**: Attach multiple security groups to the mount target\n- **Optional IP Address**: Specify a static IP or let AWS assign one automatically\n- **Input Validation**: Validates required parameters\n- **Comprehensive Outputs**: Exposes mount target ID, DNS names, network interface ID, and more\n- **Follows Launch by NTT DATA Standards**: Consistent patterns and best practices\n\n## Usage\n\n### Single Mount Target\n\n```hcl\nmodule \"efs_mount_target\" {\n  source             = \"launchbynttdata/efs_mount_target/aws\"\n  efs_filesystem_id  = \"fs-12345678\"\n  subnet_id          = \"subnet-abc123\"\n  security_group_ids = [\"sg-12345678\"]\n}\n```\n\n### Multiple Mount Targets (Recommended Pattern)\n\nUse `for_each` to create multiple mount targets across availability zones:\n\n```hcl\nlocals {\n  mount_targets = {\n    \"az-a\" = { subnet_id = \"subnet-abc123\" }\n    \"az-b\" = { subnet_id = \"subnet-def456\" }\n    \"az-c\" = { subnet_id = \"subnet-ghi789\" }\n  }\n}\n\nmodule \"efs_mount_target\" {\n  source   = \"launchbynttdata/efs_mount_target/aws\"\n  for_each = local.mount_targets\n\n  efs_filesystem_id  = \"fs-12345678\"\n  subnet_id          = each.value.subnet_id\n  security_group_ids = [\"sg-12345678\"]\n}\n\n# Access outputs\noutput \"mount_target_ids\" {\n  value = { for k, v in module.efs_mount_target : k =\u003e v.mount_target_id }\n}\n```\n\n## Inputs\n\n| Name                | Description                                                        | Type         | Default | Required |\n|---------------------|--------------------------------------------------------------------|--------------|---------|:--------:|\n| efs_filesystem_id   | The ID of the EFS file system                                      | string       | n/a     | yes      |\n| subnet_id           | The subnet ID where the mount target will be created               | string       | n/a     | yes      |\n| security_group_ids  | List of security group IDs for the mount target                    | list(string) | `null`  | no       |\n| ip_address          | Static IPv4 address for the mount target (optional)                | string       | `null`  | no       |\n| create_timeout      | Timeout for creating the mount target                              | string       | `\"30m\"` | no       |\n| delete_timeout      | Timeout for deleting the mount target                              | string       | `\"10m\"` | no       |\n\n## Outputs\n\n| Name                               | Description                                              |\n|------------------------------------|----------------------------------------------------------|\n| mount_target_id                    | The ID of the EFS mount target                           |\n| mount_target_subnet_id             | The subnet ID where the mount target is located          |\n| mount_target_dns_name              | The DNS name for the EFS file system                     |\n| mount_target_az_dns_name           | The AZ-specific DNS name for the mount target            |\n| mount_target_file_system_arn       | The ARN of the EFS file system                           |\n| mount_target_network_interface_id  | The network interface ID for the mount target            |\n| mount_target_availability_zone_name| The availability zone name                               |\n| mount_target_availability_zone_id  | The availability zone ID                                 |\n| mount_target_owner_id              | The AWS account ID that owns the mount target            |\n\n## Validation Rules\n\n- `subnet_id` must be a non-empty string\n- `security_group_ids` must be null or contain at least one security group ID\n- `efs_filesystem_id` must be a non-empty string\n\n## Why This Pattern?\n\n### Primitive Module Design\n\nThis module creates **one mount target per invocation** following primitive module best practices:\n\n- **Simplicity**: Each module call has a clear, single responsibility\n- **Flexibility**: Callers control how mount targets are organized using `for_each` or `count`\n- **Stability**: Resource addresses are determined by the caller's `for_each` keys\n- **Composability**: Easy to integrate into higher-level modules\n\n### Benefits\n\n1. **Stable Infrastructure**: Using static keys in `for_each` prevents unnecessary rebuilds\n2. **Predictable Behavior**: Adding/removing mount targets only affects those specific resources\n3. **Clear Resource Addressing**: `module.efs_mount_target[\"az-a\"]` is explicit and readable\n4. **Testability**: Simple to test individual mount target creation\n\n## Examples\n\nThis repository includes two examples demonstrating different use cases:\n\n- **[simple](./examples/simple/)**: Basic single mount target deployment\n- **[multi_subnet](./examples/multi_subnet/)**: Multiple mount targets across availability zones using `for_each`\n\n## Testing\n\nRun all validation and tests:\n\n```bash\nmake check\n```\n\nTo deploy an example:\n\n```bash\ncd examples/simple\nterraform init\nterraform plan -var-file=test.tfvars -out=the.tfplan\nterraform apply the.tfplan\nterraform destroy -var-file=test.tfvars\n```\n\n## AWS Documentation\n\n- [aws_efs_mount_target](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/efs_mount_target)\n- [Amazon EFS: How It Works](https://docs.aws.amazon.com/efs/latest/ug/how-it-works.html)\n\n## License\n\nApache 2.0. See LICENSE and NOTICE files for details.\n- Adjust test context as needed\n\n\u003c!-- BEGIN_TF_DOCS --\u003e\n## Requirements\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"requirement_terraform\"\u003e\u003c/a\u003e [terraform](#requirement\\_terraform) | ~\u003e 1.5 |\n| \u003ca name=\"requirement_aws\"\u003e\u003c/a\u003e [aws](#requirement\\_aws) | ~\u003e 5.100 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [aws_efs_mount_target.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/efs_mount_target) | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| \u003ca name=\"input_create_timeout\"\u003e\u003c/a\u003e [create\\_timeout](#input\\_create\\_timeout) | (Optional) Timeout for creating the EFS mount target (e.g., '30m'). | `string` | `\"30m\"` | no |\n| \u003ca name=\"input_delete_timeout\"\u003e\u003c/a\u003e [delete\\_timeout](#input\\_delete\\_timeout) | (Optional) Timeout for deleting the EFS mount target (e.g., '10m'). | `string` | `\"10m\"` | no |\n| \u003ca name=\"input_subnet_id\"\u003e\u003c/a\u003e [subnet\\_id](#input\\_subnet\\_id) | (Required) The ID of the subnet in which to create the mount target. One mount target should be created per availability zone for high availability. | `string` | n/a | yes |\n| \u003ca name=\"input_ip_address\"\u003e\u003c/a\u003e [ip\\_address](#input\\_ip\\_address) | (Optional) Static IPv4 address for the mount target within the subnet's CIDR range. If not specified, AWS automatically assigns an available IP address from the subnet. | `string` | `null` | no |\n| \u003ca name=\"input_security_group_ids\"\u003e\u003c/a\u003e [security\\_group\\_ids](#input\\_security\\_group\\_ids) | (Optional) List of security group IDs for the mount target. If not provided, AWS will use the VPC's default security group. | `list(string)` | `null` | no |\n| \u003ca name=\"input_efs_filesystem_id\"\u003e\u003c/a\u003e [efs\\_filesystem\\_id](#input\\_efs\\_filesystem\\_id) | The ID of the EFS file system. | `string` | n/a | yes |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| \u003ca name=\"output_mount_target_id\"\u003e\u003c/a\u003e [mount\\_target\\_id](#output\\_mount\\_target\\_id) | The ID of the EFS mount target. |\n| \u003ca name=\"output_mount_target_subnet_id\"\u003e\u003c/a\u003e [mount\\_target\\_subnet\\_id](#output\\_mount\\_target\\_subnet\\_id) | The ID of the subnet the mount target is in. |\n| \u003ca name=\"output_mount_target_dns_name\"\u003e\u003c/a\u003e [mount\\_target\\_dns\\_name](#output\\_mount\\_target\\_dns\\_name) | The DNS name of the EFS file system (file-system-id.efs.aws-region.amazonaws.com). |\n| \u003ca name=\"output_mount_target_az_dns_name\"\u003e\u003c/a\u003e [mount\\_target\\_az\\_dns\\_name](#output\\_mount\\_target\\_az\\_dns\\_name) | The mount target's availability zone-specific DNS name (availability-zone.file-system-id.efs.aws-region.amazonaws.com). |\n| \u003ca name=\"output_mount_target_file_system_arn\"\u003e\u003c/a\u003e [mount\\_target\\_file\\_system\\_arn](#output\\_mount\\_target\\_file\\_system\\_arn) | Amazon Resource Name (ARN) of the EFS file system. |\n| \u003ca name=\"output_mount_target_network_interface_id\"\u003e\u003c/a\u003e [mount\\_target\\_network\\_interface\\_id](#output\\_mount\\_target\\_network\\_interface\\_id) | The ID of the network interface created for the EFS mount target. |\n| \u003ca name=\"output_mount_target_availability_zone_name\"\u003e\u003c/a\u003e [mount\\_target\\_availability\\_zone\\_name](#output\\_mount\\_target\\_availability\\_zone\\_name) | The name of the Availability Zone (AZ) that the mount target resides in. |\n| \u003ca name=\"output_mount_target_availability_zone_id\"\u003e\u003c/a\u003e [mount\\_target\\_availability\\_zone\\_id](#output\\_mount\\_target\\_availability\\_zone\\_id) | The unique identifier of the Availability Zone (AZ) that the mount target resides in. |\n| \u003ca name=\"output_mount_target_owner_id\"\u003e\u003c/a\u003e [mount\\_target\\_owner\\_id](#output\\_mount\\_target\\_owner\\_id) | AWS account ID that owns the mount target resource. |\n\u003c!-- END_TF_DOCS --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaunchbynttdata%2Ftf-aws-module_primitive-efs_mount_target","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaunchbynttdata%2Ftf-aws-module_primitive-efs_mount_target","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaunchbynttdata%2Ftf-aws-module_primitive-efs_mount_target/lists"}