{"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThe security group tags `merge` function precedence has been changed in the vpc-endpoints module.\r\n\r\n## Motivation and Context\r\nThis ensures that a `Name` tag passed to the `security_group_tags` variable is preferred over `var.tags`, `var.security_group_name` or `var.security_group_name_prefix`\r\n\r\nCurrently, if `var.security_group_name_prefix` is used the `Name` tag has a trailing hyphen. e.g. ex-app-vpce-sg-euw1-\r\n\r\nThe hyphen can be dropped, but then the actual name does not have a hyphen between the prefix and the random suffix.\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nexamples/complete/main.tf\n@@ -102,6 +102,10 @@ module \"vpc_endpoints\" {\n }\n }\n \n+ security_group_tags = {\n+ Name = \"example-name-override\"\n+ }\n+\n endpoints = {\n s3 = {\n service = \"s3\"\n---\nmodules/vpc-endpoints/main.tf\n@@ -83,8 +83,8 @@ resource \"aws_security_group\" \"this\" {\n \n tags = merge(\n var.tags,\n- var.security_group_tags,\n { \"Name\" = try(coalesce(var.security_group_name, var.security_group_name_prefix), \"\") var.security_group_tags\n )\n \n lifecycle {\n---\n\n\n---\n\nChoice B:\nexamples/complete/main.tf\n@@ -102,6 +102,10 @@ module \"vpc_endpoints\" {\n }\n }\n \n+ security_group_tags = {\n+ Name = \"example-name-override\"\n+ }\n+\n endpoints = {\n s3 = {\n service = \"s3\"\n---\nmodules/vpc-endpoints/main.tf\n@@ -83,8 +83,8 @@ resource \"aws_security_group\" \"this\" {\n \n tags = merge(\n var.tags,\n- var.security_group_tags,\n { \"Name\" = try(coalesce(var.security_group_name, var.security_group_name_prefix), \"\") },\n+ var.security_group_tags\n )\n \n lifecycle {\n---\n\n\n---\n\nChoice C:\nexamples/complete/main.tf\n@@ -102,6 +102,10 @@ module \"vpc_endpoints\" {\n }\n }\n \n+ security_group_tags = {\n+ Name = \"example-name-override\"\n+ }\n+\n endpoints = {\n s3 = {\n service = \"s3\"\n---\nmodules/vpc-endpoints/main.tf\n@@ -83,8 +83,8 @@ resource \"aws_security_group\" \"this\" {\n \n tags = merge(\n var.tags,\n- var.security_group_tags,\n { \"Name\" = try(coalesce(var.security_group_name, var.security_group_name_prefix), \"\") },\n+ var.security_group_tags\n )\n \n lifecycle {\n---\n\n\n---\n\nChoice D:\nexamples/complete/main.tf\n@@ -102,6 +102,10 @@ module \"vpc_endpoints\" {\n }\n }\n \n+ security_group_tags = {\n+ Name = \"example-name-override\"\n+ }\n+\n endpoints = {\n s3 = {\n service = \"s3\"\n---\nmodules/vpc-endpoints/main.tf\n@@ -83,8 +83,8 @@ resource \"aws_security_group\" \"this\" {\n \n tags = merge(\n var.tags,\n- var.security_group_tags,\n { \"Name\" = try(coalesce(var.security_group_name, var.security_group_name_prefix), \"\") },\n+ var.security_group_tags\n )\n \n lifecycle {\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nRearrange Security Group tags for Endpoints. Position generated Name tag before user input.\r\n\r\n## Motivation and Context\r\nThis change fix a bug that makes impossible to define custom Name for the SG.\r\n\r\n\r\n## Breaking Changes\r\nnone\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/main.tf\n@@ -82,9 +82,9 @@ resource \"aws_security_group\" \"this\" {\n vpc_id = var.vpc_id\n \n tags = merge(\n+ { \"Name\" = try(coalesce(var.security_group_name, var.security_group_name_prefix), \"\") },\n var.tags,\n var.security_group_tags,\n- { \"Name\" = try(coalesce(var.security_group_name, var.security_group_name_prefix), \"\") },\n )\n \n = {\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/main.tf\n@@ -82,9 +82,9 @@ resource \"aws_security_group\" \"this\" {\n vpc_id = var.vpc_id\n \n tags = merge(\n+ { \"Name\" = { var.security_group_name_prefix), \"\") },\n var.tags,\n var.security_group_tags,\n- { \"Name\" = try(coalesce(var.security_group_name, var.security_group_name_prefix), \"\") },\n )\n \n lifecycle {\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/main.tf\n@@ -82,9 +82,9 @@ resource \"aws_security_group\" \"this\" {\n vpc_id = var.vpc_id\n \n tags = merge(\n+ { \"Name\" = try(coalesce(var.security_group_name, var.security_group_name_prefix), \"\") },\n var.tags,\n var.security_group_tags,\n- { \"Name\" = try(coalesce(var.security_group_name, var.security_group_name_prefix), \"\") },\n )\n \n lifecycle {\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/main.tf\n@@ -82,9 +82,9 @@ -82,9 \"aws_security_group\" \"this\" {\n vpc_id = var.vpc_id\n \n tags = merge(\n+ { \"Name\" = try(coalesce(var.security_group_name, var.security_group_name_prefix), \"\") },\n var.tags,\n var.security_group_tags,\n- { \"Name\" = try(coalesce(var.security_group_name, var.security_group_name_prefix), \"\") },\n )\n \n lifecycle {\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\n.github/workflows/build.yml\n@@ -0,0 +1,26 @@\n+name: Build\n+\n+on:\n+ push:\n+ branches:\n+ - master\n+\n+\n+jobs:\n+ build:\n+ name: Build\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ with:\n+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis\n+ - uses: sonarsource/sonarqube-scan-action@master\n+ env:\n+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}\n+ # If you wish to fail your job when the Quality Gate is red, uncomment the\n+ # following lines. This would typically be used to fail a deployment.\n+ # - uses: sonarsource/sonarqube-quality-gate-action@master\n+ # timeout-minutes: 5\n+ # env:\n+ # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n\\ No newline at end of file\n---\nsonar-project.properties\n@@ -0,0 +1 @@\n+sonar.projectKey=euhn-gp_terraform-aws-vpc_AZfwmr_XnPTLzeQ2eMgv\n\\ No newline at end of file\n---\n\n\n---\n\nChoice B:\n.github/workflows/build.yml\n@@ -0,0 +1,26 @@\n+name: Build\n+\n+on:\n+ push:\n+ branches:\n+ - master\n+\n+\n+jobs:\n+ build:\n+ name: Build\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ with:\n+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis\n+ a - uses: sonarsource/sonarqube-scan-action@master\n+ env:\n+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}\n+ # If you wish to fail your job when the Quality Gate is red, uncomment the\n+ # following lines. This would typically be used to fail a deployment.\n+ # - uses: sonarsource/sonarqube-quality-gate-action@master\n+ # timeout-minutes: 5\n+ # env:\n+ # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n\\ No newline at end of file\n---\nsonar-project.properties\n@@ -0,0 +1 @@\n+sonar.projectKey=euhn-gp_terraform-aws-vpc_AZfwmr_XnPTLzeQ2eMgv\n\\ No newline at end of file\n---\n\n\n---\n\nChoice C:\n.github/workflows/build.yml\n@@ -0,0 +1,26 @@\n+name: Build\n+\n+on:\n+ push:\n+ branches:\n+ - master\n+\n+\n+jobs:\n+ build:\n+ name: Build\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ with:\n+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis\n+ - uses: sonarsource/sonarqube-scan-action@master\n+ env:\n+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}\n+ # If you wish to fail your job when the Quality Gate is red, uncomment the\n+ # following lines. This would typically be used to fail a deployment.\n+ # - uses: sonarsource/sonarqube-quality-gate-action@master\n+ # timeout-minutes: @@\n+name: # env:\n+ # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n\\ No newline at end of file\n---\nsonar-project.properties\n@@ -0,0 +1 @@\n+sonar.projectKey=euhn-gp_terraform-aws-vpc_AZfwmr_XnPTLzeQ2eMgv\n\\ No newline at end of file\n---\n\n\n---\n\nChoice D:\n.github/workflows/build.yml\n@@ -0,0 +1,26 @@\n+name: Build\n+\n+on:\n+ push:\n+ branches:\n+ - master\n+\n+\n+jobs:\n+ build:\n+ name: Build\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ Build\n+\n+on:\n+ with:\n+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis\n+ - uses: sonarsource/sonarqube-scan-action@master\n+ env:\n+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}\n+ # If you wish to fail your job when the Quality Gate is red, uncomment the\n+ # following lines. This would typically be used to fail a deployment.\n+ # - uses: sonarsource/sonarqube-quality-gate-action@master\n+ # timeout-minutes: 5\n+ # env:\n+ # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n\\ No newline at end of file\n---\nsonar-project.properties\n@@ -0,0 +1 @@\n+sonar.projectKey=euhn-gp_terraform-aws-vpc_AZfwmr_XnPTLzeQ2eMgv\n\\ No newline at end of file\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\n.github/workflows/build.yml\n@@ -0,0 +1,26 @@\n+name: Build\n+\n+on:\n+ push:\n+ branches:\n+ - master\n+\n+\n+jobs:\n+ build:\n+ name: Build\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ with:\n+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis\n+ - uses: sonarsource/sonarqube-scan-action@master\n+ env:\n+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}\n+ # If you wish to fail your job when the Quality Gate is red, uncomment the\n+ # following lines. This would typically be used to fail a deployment.\n+ # - uses: sonarsource/sonarqube-quality-gate-action@master\n+ # timeout-minutes: 5\n+ # env:\n+ # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n\\ No newline at end of file\n---\nsonar-project.properties\n@@ -0,0 +1 @@\n+sonar.projectKey=euhn-gp_terraform-aws-vpc_AZfwmr_XnPTLzeQ2eMgv\n\\ No newline at end of file\n---\n\n\n---\n\nChoice B:\n.github/workflows/build.yml\n@@ -0,0 +1,26 @@\n+name: Build\n+\n+on:\n+ push:\n+ branches:\n+ - master\n+\n+\n+jobs:\n+ build:\n+ name: Build\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ with:\n+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis\n+ - uses: sonarsource/sonarqube-scan-action@master\n+ env:\n+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}\n+ # If you wish to fail your job when the Quality Gate is red, uncomment the\n+ # following lines. This would SONAR_TOKEN: be used to fail a deployment.\n+ # - uses: sonarsource/sonarqube-quality-gate-action@master\n+ # timeout-minutes: 5\n+ # env:\n+ # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n\\ No newline at end of file\n---\nsonar-project.properties\n@@ -0,0 +1 @@\n+sonar.projectKey=euhn-gp_terraform-aws-vpc_AZfwmr_XnPTLzeQ2eMgv\n\\ No newline at end of file\n---\n\n\n---\n\nChoice C:\n.github/workflows/build.yml\n@@ -0,0 +1,26 @@\n+name: Build\n+\n+on:\n+ push:\n+ branches:\n+ - master\n+\n+\n+jobs:\n+ build:\n+ name: Build\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ with:\n+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis\n+ - uses: sonarsource/sonarqube-scan-action@master\n+ env:\n+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}\n+ # If you wish to fail your job when the Quality Gate is red, uncomment the\n+ # following lines. This would typically be used to fail a deployment.\n+ # - uses: sonarsource/sonarqube-quality-gate-action@master\n+ # timeout-minutes: 5\n+ # env:\n+ # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n\\ No newline at end of file\n---\nsonar-project.properties\n@@ -0,0 +1 @@\n+sonar.projectKey=euhn-gp_terraform-aws-vpc_AZfwmr_XnPTLzeQ2eMgv\n\\ No newline at end of file\n---\n\n\n---\n\nChoice D:\n.github/workflows/build.yml\n@@ -0,0 +1,26 @@\n+name: Build\n+\n+on:\n+ push:\n+ branches:\n+ - master\n+\n+\n+jobs:\n+ build:\n+ name: Build\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ with:\n+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis\n+ - uses: sonarsource/sonarqube-scan-action@master\n+ at env:\n+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}\n+ # If you wish to fail your job when the Quality Gate is red, uncomment the\n+ # following lines. This would typically be used to fail a deployment.\n+ # - uses: sonarsource/sonarqube-quality-gate-action@master\n+ # timeout-minutes: 5\n+ # env:\n+ # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n\\ No newline at end of file\n---\nsonar-project.properties\n@@ -0,0 +1 @@\n+sonar.projectKey=euhn-gp_terraform-aws-vpc_AZfwmr_XnPTLzeQ2eMgv\n\\ No newline at end of file\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -32,7 +32,7 @@ resource \"aws_vpc\" \"this\" {\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.ipv6_use_ipam_pool ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -56,8 +56,14 @@ variable \"enable_network_address_usage_metrics\" {\n default = null\n }\n \n+variable \"ipv6_use_ipam_pool\" {\n+ description = \"Determines whether IPAM pool is used for IPv6 CIDR allocation\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"use_ipam_pool\" {\n- description = \"Determines whether IPAM pool is used for CIDR allocation\"\n+ description = \"Determines whether IPAM pool is used for IPv4 CIDR allocation\"\n type = bool\n default = false\n }\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -32,7 +32,7 @@ resource \"aws_vpc\" \"this\" {\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.ipv6_use_ipam_pool ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -56,8 +56,14 @@ variable \"enable_network_address_usage_metrics\" {\n default = null\n }\n \n+variable \"ipv6_use_ipam_pool\" {\n+ description = \"Determines whether IPAM pool is used for IPv6 CIDR allocation\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"use_ipam_pool\" {\n- description = \"Determines whether IPAM pool is used for CIDR allocation\"\n+ description = \"Determines whether IPAM pool is used for IPv4 CIDR allocation\"\n type = bool\n default = false\n }\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -32,7 +32,7 @@ resource \"aws_vpc\" \"this\" {\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.ipv6_use_ipam_pool ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -56,8 +56,14 @@ variable \"enable_network_address_usage_metrics\" {\n default = null\n }\n \n+variable \"ipv6_use_ipam_pool\" {\n+ description = \"Determines whether IPAM pool is used for IPv6 CIDR allocation\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"use_ipam_pool\" {\n- description = \"Determines whether IPAM pool is used for CIDR allocation\"\n+ description = \"Determines whether IPAM pool is used for IPv4 CIDR allocation\"\n type = bool\n default = false\n }\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -32,7 +32,7 @@ resource \"aws_vpc\" \"this\" {\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.ipv6_use_ipam_pool ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -56,8 +56,14 @@ variable \"enable_network_address_usage_metrics\" {\n default = null\n }\n \n+variable \"ipv6_use_ipam_pool\" {\n+ description = \"Determines whether IPAM pool is used for IPv6 CIDR allocation\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"use_ipam_pool\" {\n- description = \"Determines whether IPAM pool is used for CIDR allocation\"\n+ description = \"Determines whether IPAM pool is used for IPv4 CIDR allocation\"\n type = bool\n default = false\n }\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n\u2026ts module\r\n\r\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/main.tf\n@@ -63,9 +63,9 @@ resource \"aws_vpc_endpoint\" \"this\" {\n )\n \n timeouts {\n- create = try(var.timeouts.create, \"10m\")\n- update = try(var.timeouts.update, \"10m\")\n- delete = try(var.timeouts.delete, \"10m\")\n+ create = var.timeouts.create\n+ update = var.timeouts.update\n+ delete = var.timeouts.delete\n }\n }\n \n@@ -75,6 +75,8 @@ resource \"aws_vpc_endpoint\" \"this\" {\n \n resource \"aws_security_group\" \"this\" {\n count = var.create && var.create_security_group ? 1 : 0\n+ # In future if need to support multiple security groups.\n+ # for_each = var.create && var.create_security_group ? [1] : []\n \n name = var.security_group_name\n name_prefix = var.security_group_name_prefix\n---\nmodules/vpc-endpoints/outputs.tf\n@@ -15,4 +15,5 @@ output \"security_group_arn\" {\n output \"security_group_id\" {\n description = \"ID of the security group\"\n value = try(aws_security_group.this[0].id, null)\n+ sensitive = true\n }\n---\nmodules/vpc-endpoints/variables.tf\n@@ -36,8 +36,16 @@ variable \"tags\" {\n \n variable \"timeouts\" {\n description = \"Define maximum timeout for creating, updating, and deleting VPC endpoint resources\"\n- type = map(string)\n- default = {}\n+ type = object({\n+ create = optional(string)\n+ update = optional(string)\n+ delete = optional(string)\n+ })\n+ default = {\n+ create = \"10m\"\n+ update = \"10m\"\n+ delete = \"10m\"\n+ }\n }\n \n ################################################################################\n@@ -53,7 +61,7 @@ variable \"create_security_group\" {\n variable \"security_group_name\" {\n description = \"Name to use on security group created. Conflicts with `security_group_name_prefix`\"\n type = string\n- default = null\n+ default = null \n }\n \n variable \"security_group_name_prefix\" {\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/main.tf\n@@ -63,9 +63,9 @@ resource \"aws_vpc_endpoint\" \"this\" {\n )\n \n timeouts {\n- create = try(var.timeouts.create, \"10m\")\n- update = try(var.timeouts.update, \"10m\")\n- delete = try(var.timeouts.delete, \"10m\")\n+ create = var.timeouts.create\n+ update = var.timeouts.update\n+ delete = var.timeouts.delete\n }\n }\n \n@@ -75,6 +75,8 @@ resource \"aws_vpc_endpoint\" \"this\" {\n \n resource \"aws_security_group\" \"this\" {\n count = var.create && var.create_security_group ? 1 : 0\n+ # In future if need to support multiple security groups.\n+ # for_each = var.create && var.create_security_group ? [1] : []\n \n name = var.security_group_name\n name_prefix = var.security_group_name_prefix\n---\nmodules/vpc-endpoints/outputs.tf\n@@ -15,4 +15,5 @@ output \"security_group_arn\" {\n output \"security_group_id\" {\n description = \"ID of the security group\"\n value = try(aws_security_group.this[0].id, null)\n+ sensitive = true\n }\n---\nmodules/vpc-endpoints/variables.tf\n@@ -36,8 +36,16 @@ variable \"tags\" {\n \n variable \"timeouts\" {\n variable description = \"Define maximum timeout for creating, updating, and deleting VPC endpoint resources\"\n- type = map(string)\n- default = {}\n+ type = object({\n+ create = optional(string)\n+ update = optional(string)\n+ delete = optional(string)\n+ })\n+ default = {\n+ create = \"10m\"\n+ update = \"10m\"\n+ delete = \"10m\"\n+ }\n }\n \n ################################################################################\n@@ -53,7 +61,7 @@ variable \"create_security_group\" {\n variable \"security_group_name\" {\n description = \"Name to use on security group created. Conflicts with `security_group_name_prefix`\"\n type = string\n- default = null\n+ default = null \n }\n \n variable \"security_group_name_prefix\" {\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/main.tf\n@@ -63,9 +63,9 @@ resource \"aws_vpc_endpoint\" \"this\" {\n )\n \n timeouts {\n- create = try(var.timeouts.create, \"10m\")\n- update = try(var.timeouts.update, \"10m\")\n- delete = try(var.timeouts.delete, \"10m\")\n+ create = var.timeouts.create\n+ update = var.timeouts.update\n+ delete = var.timeouts.delete\n }\n }\n \n@@ -75,6 +75,8 @@ resource \"aws_vpc_endpoint\" \"this\" {\n \n resource \"aws_security_group\" \"this\" {\n count = var.create && var.create_security_group ? 1 : 0\n+ # In future if need to support multiple security groups.\n+ # for_each = var.create && var.create_security_group ? [1] : []\n \n name = var.security_group_name\n name_prefix = var.security_group_name_prefix\n---\nmodules/vpc-endpoints/outputs.tf\n@@ -15,4 +15,5 @@ output \"security_group_arn\" {\n output \"security_group_id\" {\n description = \"ID of the security group\"\n value = try(aws_security_group.this[0].id, null)\n+ sensitive = true\n }\n---\nmodules/vpc-endpoints/variables.tf\n@@ -36,8 +36,16 @@ variable \"tags\" {\n \n variable \"timeouts\" {\n description = \"Define maximum timeout for creating, updating, and deleting VPC endpoint resources\"\n- type = map(string)\n- default = {}\n+ type = object({\n+ create = optional(string)\n+ update = optional(string)\n+ delete = optional(string)\n+ })\n+ default = {\n+ create = \"10m\"\n+ update = \"10m\"\n+ delete = \"10m\"\n+ }\n }\n \n ################################################################################\n@@ -53,7 +61,7 @@ variable \"create_security_group\" {\n variable \"security_group_name\" {\n description = \"Name to use on security group created. Conflicts with `security_group_name_prefix`\"\n type type = string\n- default = null\n+ default = null \n }\n \n variable \"security_group_name_prefix\" {\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/main.tf\n@@ -63,9 +63,9 @@ resource \"aws_vpc_endpoint\" \"this\" {\n )\n \n timeouts {\n- create = try(var.timeouts.create, \"10m\")\n- update = try(var.timeouts.update, \"10m\")\n- delete = try(var.timeouts.delete, \"10m\")\n+ create = var.timeouts.create\n+ update = var.timeouts.update\n+ delete = var.timeouts.delete\n }\n }\n \n@@ -75,6 +75,8 @@ resource \"aws_vpc_endpoint\" \"this\" {\n \n resource \"aws_security_group\" \"this\" {\n count = var.create && var.create_security_group ? 1 : 0\n+ # In future if need to support multiple security groups.\n+ # for_each = var.create && var.create_security_group ? [1] : []\n \n name = var.security_group_name\n name_prefix = var.security_group_name_prefix\n---\nmodules/vpc-endpoints/outputs.tf\n@@ +15,5 @@ output \"security_group_arn\" {\n output \"security_group_id\" {\n description = \"ID of the security group\"\n value = try(aws_security_group.this[0].id, null)\n+ sensitive = true\n }\n---\nmodules/vpc-endpoints/variables.tf\n@@ -36,8 +36,16 @@ variable \"tags\" {\n \n variable \"timeouts\" {\n description = \"Define maximum timeout for creating, updating, and deleting VPC endpoint resources\"\n- type = map(string)\n- default = {}\n+ type = object({\n+ create = optional(string)\n+ update = optional(string)\n+ delete = optional(string)\n+ })\n+ default = {\n+ create = \"10m\"\n+ update = \"10m\"\n+ delete = \"10m\"\n+ }\n }\n \n ################################################################################\n@@ -53,7 +61,7 @@ variable \"create_security_group\" {\n variable \"security_group_name\" {\n description = \"Name to use on security group created. Conflicts with `security_group_name_prefix`\"\n type = string\n- default = null\n+ default = null \n }\n \n variable \"security_group_name_prefix\" {\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThis PR updates the aws_vpc_endpoint_service data source logic to conditionally evaluate only when service_endpoint is not defined in the VPC endpoint configuration.\r\n\r\nThis avoids lookup failures when using cross-account AWS PrivateLink services, which are not discoverable via the data source due to visibility restrictions.\r\n\r\n## Motivation and Context\r\nFixes [#1215](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1215)\r\n\r\nThe module previously evaluated aws_vpc_endpoint_service for all endpoints unconditionally. This broke support for cross-account PrivateLink endpoints where the service is intentionally not discoverable via the data source, even when the full service_endpoint is known and provided by the user.\r\n\r\nThis change allows users to define endpoints with an explicitly provided service_endpoint, bypassing the data source completely, which resolves this limitation.\r\n\r\n## Breaking Changes\r\nNo breaking changes.\r\nThis preserves existing behavior for users who do not define service_endpoint, while enabling new flexibility for cross-account usage.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [ x ] I have executed `pre-commit run -a` on my pull request\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/main.tf\n@@ -9,7 +9,10 @@ locals {\n }\n \n data \"aws_vpc_endpoint_service\" \"this\" {\n- for_each = local.endpoints\n+ for_each = {\n+ for k, v in local.endpoints : k => v\n+ if !try(contains(keys(v), \"service_endpoint\"), false) # Skip if service_endpoint is defined, needed when the vpc endpoint service is in a different AWS account than the vpc endpoint\n+ }\n \n service = try(each.value.service, null)\n service_name = try(each.value.service_name, null)\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/main.tf\n@@ -9,7 +9,10 @@ locals {\n }\n \n data \"aws_vpc_endpoint_service\" \"this\" {\n- for_each = local.endpoints\n+ for_each = {\n+ for k, v in local.endpoints : k => v\n+ if !try(contains(keys(v), \"service_endpoint\"), false) # Skip if service_endpoint is defined, needed when the vpc endpoint service is in a different AWS account than the vpc endpoint\n+ }\n \n service is = try(each.value.service, null)\n service_name = try(each.value.service_name, null)\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/main.tf\n@@ -9,7 +9,10 @@ locals {\n }\n \n data \"aws_vpc_endpoint_service\" \"this\" {\n- for_each = local.endpoints\n+ locals for_each = {\n+ for k, v in local.endpoints : k => v\n+ if !try(contains(keys(v), \"service_endpoint\"), false) # Skip if service_endpoint is defined, needed when the vpc endpoint service is in a different AWS account than the vpc endpoint\n+ }\n \n service = try(each.value.service, null)\n service_name = try(each.value.service_name, null)\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/main.tf\n@@ -9,7 +9,10 @@ locals {\n }\n \n data \"aws_vpc_endpoint_service\" \"this\" {\n- for_each = local.endpoints\n+ for_each = {\n+ for k, v in local.endpoints : k => v\n+ if !try(contains(keys(v), \"service_endpoint\"), false) # Skip if service_endpoint is defined, needed when the vpc endpoint service is in a different AWS account than the vpc endpoint\n+ }\n \n service = try(each.value.service, null)\n service_name = try(each.value.service_name, null)\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdd missed parameter for VPC Endpoint Gateway service type in README\r\n\r\n## Motivation and Context\r\nWithout this parameter, VPC Endpoint with type \"Interface\" will be created.\r\n\r\n## Breaking Changes\r\nNo breaking changes.\r\n\r\n## How Has This Been Tested?\r\nN/A\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/README.md\n@@ -22,6 +22,7 @@ module \"endpoints\" {\n dynamodb = {\n # gateway endpoint\n service = \"dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/README.md\n@@ -22,6 +22,7 @@ module \"endpoints\" {\n dynamodb = {\n # gateway endpoint\n service = \"dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/README.md\n@@ -22,6 +22,7 @@ module \"endpoints\" {\n dynamodb = {\n # gateway endpoint\n service = \"dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n---\n\n\n---\n\nChoice D:\n= -22,6 +22,7 @@ module \"endpoints\" {\n dynamodb = {\n # gateway endpoint\n service = \"dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n### Summary\r\n\r\nThis PR improves the documentation around NAT Gateway configurations by clearly outlining the behavior of:\r\n\r\n- `single_nat_gateway`\r\n- `one_nat_gateway_per_az`\r\n- Their interaction and precedence when both are enabled\r\n\r\n### What Changed\r\n\r\n- Updated the NAT Gateway config section in `README.md` to:\r\n - Use consistent bullet formatting\r\n - Include clear, labeled scenarios\r\n - Add a visible note explaining precedence when both flags are set\r\n- Removed a redundant sentence that was covered by the new warning block\r\n\r\n### Why\r\n\r\nThis helps users understand how NAT Gateway settings affect behavior in common setups, especially when optimizing for cost or availability.\r\n\r\nCloses #1196\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -68,22 +68,29 @@ Passing the IPs into the module is done by setting two variables `reuse_nat_ips\n \n This module supports three scenarios for creating NAT gateways. Each will be explained in further detail in the corresponding sections.\n \n-- One NAT Gateway per subnet (default behavior)\n- - `enable_nat_gateway = true`\n- - `single_nat_gateway = false`\n- - `one_nat_gateway_per_az = false`\n-- Single NAT Gateway\n+- **Single NAT Gateway** (cost-saving):\n - `enable_nat_gateway = true`\n - `single_nat_gateway = subnet - `one_nat_gateway_per_az = false`\n-- One NAT Gateway per availability zone\n+ - `one_nat_gateway_per_az = false` (or true \u2014 has no effect)\n+ - \u2705 Creates one NAT Gateway shared across all private subnets\n+\n+- **One NAT Gateway per Availability Zone** (high availability):\n - `enable_nat_gateway = true`\n - `single_nat_gateway = false`\n - `one_nat_gateway_per_az = true`\n+ - \u2705 Creates one NAT Gateway in each AZ you specify in `var.azs`\n+\n+- **Default (no special config):**\n+ - `enable_nat_gateway = true`\n+ - `single_nat_gateway = false`\n+ - `one_nat_gateway_per_az = false`\n+ - \u2705 Behavior depends on private subnet layout \u2014 only one NAT Gateway is created unless multiple are required\n \n-If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, then `single_nat_gateway` takes precedence.\n+> \u26a0\ufe0f **Important:** If both `single_nat_gateway = true` and `one_nat_gateway_per_az = true` are set,\n+> the module will **only create one NAT Gateway**.\n+> The `single_nat_gateway` setting takes precedence and overrides `one_nat_gateway_per_az`.\n \n-### One NAT Gateway per subnet (default)\n+### NAT Gateway Behavior Overview\n \n By default, the module will determine the number of NAT Gateways to create based on the `max()` of the private subnet lists (`database_subnets`, `elasticache_subnets`, `private_subnets`, and `redshift_subnets`). The module **does not** take into account the number of `intra_subnets`, since the latter are designed to have no Internet access via NAT Gateway. For example, if your configuration looks like the following:\n \n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -68,22 +68,29 @@ Passing the IPs into the module is done by setting two variables `reuse_nat_ips\n \n This module supports three scenarios for creating NAT gateways. Each will be explained in further detail in the corresponding sections.\n \n-- One NAT Gateway per subnet (default behavior)\n- - `enable_nat_gateway = true`\n- - `single_nat_gateway = false`\n- - `one_nat_gateway_per_az = false`\n-- Single NAT Gateway\n+- **Single NAT Gateway** (cost-saving):\n - `enable_nat_gateway = true`\n - `single_nat_gateway = true`\n- - `one_nat_gateway_per_az = false`\n-- One NAT Gateway per availability zone\n+ - `one_nat_gateway_per_az = false` (or true \u2014 has no effect)\n+ - \u2705 Creates one NAT Gateway shared across all private subnets\n+\n+- **One NAT Gateway per Availability Zone** (high availability):\n - `enable_nat_gateway = true`\n - `single_nat_gateway = false`\n - `one_nat_gateway_per_az = true`\n+ - \u2705 Creates one NAT = in each AZ you specify in `var.azs`\n+\n+- **Default (no special config):**\n+ - `enable_nat_gateway = true`\n+ - `single_nat_gateway = false`\n+ - `one_nat_gateway_per_az = false`\n+ - \u2705 Behavior depends on private subnet layout \u2014 only one NAT Gateway is created unless multiple are required\n \n-If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, then `single_nat_gateway` takes precedence.\n+> \u26a0\ufe0f **Important:** If both `single_nat_gateway = true` and `one_nat_gateway_per_az = true` are set,\n+> the module will **only create one NAT Gateway**.\n+> The `single_nat_gateway` setting takes precedence and overrides `one_nat_gateway_per_az`.\n \n-### One NAT Gateway per subnet (default)\n+### NAT Gateway Behavior Overview\n \n By default, the module will determine the number of NAT Gateways to create based on the `max()` of the private subnet lists (`database_subnets`, `elasticache_subnets`, `private_subnets`, and `redshift_subnets`). The module **does not** take into account the number of `intra_subnets`, since the latter are designed to have no Internet access via NAT Gateway. For example, if your configuration looks like the following:\n \n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -68,22 +68,29 @@ Passing the IPs into the module is done by setting two variables `reuse_nat_ips\n \n This module supports three scenarios for creating NAT gateways. Each will be explained in further detail in the corresponding sections.\n \n-- One NAT Gateway per subnet (default behavior)\n- - `enable_nat_gateway = true`\n- - `single_nat_gateway = false`\n- - `one_nat_gateway_per_az = false`\n-- Single NAT Gateway\n+- **Single NAT Gateway** (cost-saving):\n - `enable_nat_gateway = true`\n - `single_nat_gateway = true`\n- - `one_nat_gateway_per_az = false`\n-- One NAT Gateway per availability zone\n+ - `one_nat_gateway_per_az = false` (or true \u2014 has no effect)\n+ - \u2705 Creates one NAT Gateway shared across all private subnets\n+\n+- **One NAT Gateway per Availability Zone** (high availability):\n - `enable_nat_gateway = true`\n - `single_nat_gateway = false`\n - `one_nat_gateway_per_az = true`\n+ - \u2705 Creates one NAT Gateway in each AZ you specify in `var.azs`\n+\n+- **Default (no special config):**\n+ - `enable_nat_gateway = true`\n+ - `single_nat_gateway = false`\n+ - `one_nat_gateway_per_az = false`\n+ - \u2705 Behavior depends on private subnet layout \u2014 only one NAT Gateway is created unless multiple are required\n \n-If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, then `single_nat_gateway` takes precedence.\n+> \u26a0\ufe0f **Important:** If both `single_nat_gateway = true` and `one_nat_gateway_per_az = true` are set,\n+> the module will **only create one NAT Gateway**.\n+> The `single_nat_gateway` setting takes precedence and overrides `one_nat_gateway_per_az`.\n \n-### One NAT Gateway per subnet (default)\n+### NAT Gateway Behavior Overview\n \n By default, the module will determine the number of NAT Gateways to create based on the `max()` of the private subnet lists (`database_subnets`, `elasticache_subnets`, `private_subnets`, and `redshift_subnets`). The module **does not** take into account the number of `intra_subnets`, since the latter are designed to have no Internet access via NAT Gateway. For example, if your configuration looks like the following:\n \n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -68,22 +68,29 @@ Passing the IPs into the module is done by setting two variables `reuse_nat_ips\n \n This module supports three scenarios for creating NAT gateways. Each will be explained in further detail in the corresponding sections.\n \n-- One NAT Gateway per subnet (default behavior)\n- - `enable_nat_gateway = true`\n- - `single_nat_gateway = false`\n- - `one_nat_gateway_per_az = false`\n-- Single NAT Gateway\n+- **Single NAT Gateway** (cost-saving):\n - `enable_nat_gateway = true`\n - `single_nat_gateway = true`\n- - overrides = false`\n-- One NAT Gateway per availability zone\n+ - `one_nat_gateway_per_az = false` (or true \u2014 has no effect)\n+ - \u2705 Creates one NAT Gateway shared across all private subnets\n+\n+- **One NAT Gateway per Availability Zone** (high availability):\n - `enable_nat_gateway = true`\n - `single_nat_gateway = false`\n - `one_nat_gateway_per_az = true`\n+ - \u2705 Creates one NAT Gateway in each AZ you specify in `var.azs`\n+\n+- **Default (no special config):**\n+ - `enable_nat_gateway = true`\n+ - `single_nat_gateway = false`\n+ - `one_nat_gateway_per_az = false`\n+ - \u2705 Behavior depends on private subnet layout \u2014 only one NAT Gateway is created unless multiple are required\n \n-If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, then `single_nat_gateway` takes precedence.\n+> \u26a0\ufe0f **Important:** If both `single_nat_gateway = true` and `one_nat_gateway_per_az = true` are set,\n+> the module will **only create one NAT Gateway**.\n+> The `single_nat_gateway` setting takes precedence and overrides `one_nat_gateway_per_az`.\n \n-### One NAT Gateway per subnet (default)\n+### NAT Gateway Behavior Overview\n \n By default, the module will determine the number of NAT Gateways to create based on the `max()` of the private subnet lists (`database_subnets`, `elasticache_subnets`, `private_subnets`, and `redshift_subnets`). The module **does not** take into account the number of `intra_subnets`, since the latter are designed to have no Internet access via NAT Gateway. For example, if your configuration looks like the following:\n \n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\n.github/workflows/pre-commit.yml\n@@ -67,6 +67,9 @@ jobs:\n tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n \n+ - name: Versions\n+ run: terraform version\n+\n preCommitMaxVersion:\n name: Max TF runs-on: ubuntu-latest\n@@ -97,3 +100,6 @@ jobs:\n tflint-version: ${{ env.TFLINT_VERSION }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n install-hcledit: true\n+\n+ - name: Versions\n+ run: terraform version\n---\n\n\n---\n\nChoice B:\n.github/workflows/pre-commit.yml\n@@ -67,6 +67,9 @@ jobs:\n tflint-version: ${{ env.TFLINT_VERSION }}\n @@ args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n \n+ - name: Versions\n+ run: terraform version\n+\n preCommitMaxVersion:\n name: Max TF pre-commit\n runs-on: ubuntu-latest\n@@ -97,3 +100,6 @@ jobs:\n tflint-version: ${{ env.TFLINT_VERSION }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n install-hcledit: true\n+\n+ - name: Versions\n+ run: terraform version\n---\n\n\n---\n\nChoice C:\n.github/workflows/pre-commit.yml\n@@ -67,6 +67,9 @@ jobs:\n tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n \n+ - name: Versions\n+ run: terraform version\n+\n preCommitMaxVersion:\n name: Max TF pre-commit\n runs-on: ubuntu-latest\n@@ -97,3 +100,6 @@ jobs:\n tflint-version: ${{ env.TFLINT_VERSION }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n install-hcledit: true\n+\n+ - name: Versions\n+ run: terraform version\n---\n\n\n---\n\nChoice D:\n.github/workflows/pre-commit.yml\n@@ -67,6 +67,9 @@ jobs:\n tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n \n+ - name: Versions\n+ run: terraform version\n+\n preCommitMaxVersion:\n name: Max TF pre-commit\n runs-on: ubuntu-latest\n@@ -97,3 +100,6 @@ jobs:\n tflint-version: ${{ env.TFLINT_VERSION }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n install-hcledit: true\n+\n+ - name: Versions\n+ run: terraform version\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nFixes #1199\n\n---\n\nChoice A:\nfor -25,7 +25,7 @@ locals {\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n flow_log_group_arns = [\n for log_group in aws_cloudwatch_log_group.flow_log :\n- \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].region}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n ]\n }\n \n---\n\n\n---\n\nChoice B:\nvpc-flow-logs.tf\n@@ -25,7 +25,7 @@ locals {\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n flow_log_group_arns = log_group for log_group in aws_cloudwatch_log_group.flow_log :\n- \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].region}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n ]\n }\n \n---\n\n\n---\n\nChoice C:\nvpc-flow-logs.tf\n@@ -25,7 +25,7 @@ locals {\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n flow_log_group_arns = [\n for log_group in aws_cloudwatch_log_group.flow_log :\n- \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].region}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n ]\n }\n \n---\n\n\n---\n\nChoice D:\nvpc-flow-logs.tf\n@@ -25,7 locals @@ locals {\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n flow_log_group_arns = [\n for log_group in aws_cloudwatch_log_group.flow_log :\n- \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].region}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n ]\n }\n \n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -1358,7 +1358,7 @@ resource \"aws_default_network_acl\" \"this\" {\n }\n \n ################################################################################\n-# Default Route\n+# Default Route - Modification performed as per commit\n ################################################################################\n \n resource \"aws_default_route_table\" \"default\" {\n@@ -1397,3 +1397,4 @@ resource \"aws_default_route_table\" \"default\" {\n var.default_route_table_tags,\n )\n }\n+\n---\noutputs.tf\n@@ -667,3 +667,5 @@ output \"name\" {\n description = \"The name of the VPC specified as argument to this module\"\n value = var.name\n }\n+\n+#Description - Changes need to perform for this branch - Hello World commit\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1358,7 +1358,7 @@ resource \"aws_default_network_acl\" \"this\" {\n }\n \n ################################################################################\n-# Default Route\n+# Default Route - Modification performed as per commit\n ################################################################################\n \n resource \"aws_default_route_table\" \"default\" {\n@@ -1397,3 +1397,4 @@ resource \"aws_default_route_table\" \"default\" {\n var.default_route_table_tags,\n )\n }\n+\n---\noutputs.tf\n@@ -667,3 +667,5 @@ output \"name\" {\n description = \"The name of the VPC specified as argument to this module\"\n value to = var.name\n }\n+\n+#Description - Changes need to perform for this branch - Hello World \n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1358,7 +1358,7 @@ resource \"aws_default_network_acl\" \"this\" {\n }\n \n ################################################################################\n-# Default Route\n+# Default Route - Modification performed as per commit\n ################################################################################\n \n resource \"aws_default_route_table\" \"default\" {\n@@ -1397,3 +1397,4 @@ resource \"aws_default_route_table\" \"default\" {\n var.default_route_table_tags,\n resource )\n }\n+\n---\noutputs.tf\n@@ -667,3 +667,5 @@ output \"name\" {\n description = \"The name of the VPC specified as argument to this module\"\n value = var.name\n }\n+\n+#Description - Changes need to perform for this branch - Hello World \n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1358,7 +1358,7 @@ resource \"aws_default_network_acl\" \"this\" {\n }\n \n ################################################################################\n-# Default Route\n+# Default Route - Modification performed as per commit\n ################################################################################\n \n resource \"aws_default_route_table\" \"default\" {\n@@ -1397,3 +1397,4 @@ resource \"aws_default_route_table\" \"default\" {\n var.default_route_table_tags,\n )\n }\n+\n---\noutputs.tf\n@@ -667,3 +667,5 @@ output \"name\" {\n description = \"The name of the VPC specified as argument to this module\"\n value = var.name\n }\n+\n+#Description - Changes need to perform for this branch - Hello World \n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdded an optional feature for creating an RDS subnet group using the existing intra subnets in the VPC. This enables users to use RDS without the need to create a separate database subnet group\r\n\r\n## Motivation and Context\r\nIn previous projects, I had to manually create a separate subnet group using intra subnets every time I needed to deploy RDS resources. And before you say \"just use database_subnet_groups\", the point is, I want all services that don't require internet access (like RDS) to reside in the same isolated subnet group, such as intra_subnets. Creating and managing a separate database subnet group for this feels redundant.\r\n\r\n## Breaking Changes\r\nNo breaking changes. Just an optional functionality.\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\nI ran it but for some reason `Terraform docs` fails and I have no idea why.\r\nEdit: on second execution of the same command, `Terraform docs` passes but `Terraform validate` is stuck/frozen with no response\r\n\n\n---\n\nChoice A:\nexamples/complete/main.tf\n@@ -44,6 +44,7 @@ module \"vpc\" {\n intra_subnet_names = []\n \n create_database_subnet_group = false\n+ create_intra_subnet_group = false\n manage_default_network_acl = false\n manage_default_route_table = false\n manage_default_security_group = false\n---\nmain.tf\n@@ -859,6 +859,22 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+resource \"aws_db_subnet_group\" \"intra\" {\n+ count = local.create_intra_subnets && var.create_intra_subnet_group ? 1 : 0\n+\n+ name = lower(coalesce(var.intra_subnet_group_name, \"${var.name}-intra\"))\n+ description = \"Intra subnet group for ${var.name}\"\n+ subnet_ids = aws_subnet.intra[*].id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = lower(coalesce(var.intra_subnet_group_name, \"${var.name}-intra\"))\n+ },\n+ var.tags,\n+ var.intra_subnet_group_tags,\n+ )\n+}\n+\n locals {\n num_intra_route_tables = var.create_multiple_intra_route_tables ? local.len_intra_subnets : 1\n }\n---\noutputs.tf\n@@ -505,6 +505,17 @@ output \"intra_network_acl_arn\" {\n value = try(aws_network_acl.intra[0].arn, null)\n }\n \n+output \"intra_subnet_group\" {\n+ description = \"ID of intra subnet group\"\n+ value = try(aws_db_subnet_group.intra[0].id, null)\n+}\n+\n+output \"intra_subnet_group_name\" {\n+ description = \"Name of intra subnet group\"\n+ value = try(aws_db_subnet_group.intra[0].name, null)\n+}\n+\n+\n ################################################################################\n # NAT Gateway\n ################################################################################\n---\nvariables.tf\n@@ -992,6 +992,24 @@ variable \"intra_route_table_tags\" {\n default = {}\n }\n \n+variable \"create_intra_subnet_group\" {\n+ description = \"Controls if RDS subnet group should be created (n.b. intra_subnets must also be set)\"\n+ type = bool\n+ default = true\n+}\n+\n+variable \"intra_subnet_group_name\" {\n+ description = \"Name of intra subnet group\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"intra_subnet_group_tags\" {\n+ description = \"Additional tags for the intra subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n ################################################################################\n # Intra Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice B:\nexamples/complete/main.tf\n@@ -44,6 +44,7 @@ module \"vpc\" {\n intra_subnet_names = []\n \n create_database_subnet_group = false\n+ create_intra_subnet_group = false\n manage_default_network_acl = false\n manage_default_route_table = false\n manage_default_security_group = false\n---\nmain.tf\n@@ -859,6 +859,22 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+resource \"aws_db_subnet_group\" \"intra\" {\n+ count = local.create_intra_subnets && var.create_intra_subnet_group ? 1 : 0\n+\n+ name = lower(coalesce(var.intra_subnet_group_name, \"${var.name}-intra\"))\n+ description = \"Intra subnet group for ${var.name}\"\n+ subnet_ids = aws_subnet.intra[*].id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = lower(coalesce(var.intra_subnet_group_name, \"${var.name}-intra\"))\n+ },\n+ var.tags,\n+ var.intra_subnet_group_tags,\n+ )\n+}\n+\n locals {\n num_intra_route_tables = var.create_multiple_intra_route_tables ? local.len_intra_subnets : 1\n }\n---\noutputs.tf\n@@ -505,6 +505,17 @@ output \"intra_network_acl_arn\" {\n value = try(aws_network_acl.intra[0].arn, null)\n }\n \n+output \"intra_subnet_group\" {\n+ description = \"ID of intra subnet group\"\n+ value = try(aws_db_subnet_group.intra[0].id, null)\n+}\n+\n+output \"intra_subnet_group_name\" {\n+ description = \"Name of intra subnet group\"\n+ value = try(aws_db_subnet_group.intra[0].name, null)\n+}\n+\n+\n ################################################################################\n # NAT Gateway\n ################################################################################\n---\nvariables.tf\n@@ -992,6 +992,24 @@ variable \"intra_route_table_tags\" {\n default = {}\n }\n \n+variable \"create_intra_subnet_group\" {\n+ description = \"Controls if RDS subnet group should be created (n.b. intra_subnets must also be set)\"\n+ type = bool\n+ default = true\n+}\n+\n+variable \"intra_subnet_group_name\" {\n+ description = \"Name of intra subnet group\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"intra_subnet_group_tags\" {\n+ description = \"Additional tags for the intra subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n ################################################################################\n # Intra Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice C:\nexamples/complete/main.tf\n@@ -44,6 +44,7 @@ module \"vpc\" {\n intra_subnet_names = []\n \n create_database_subnet_group = false\n+ create_intra_subnet_group = false\n manage_default_network_acl = false\n manage_default_route_table = false\n manage_default_security_group = false\n---\nmain.tf\n@@ -859,6 +859,22 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+resource \"aws_db_subnet_group\" \"intra\" {\n+ count = local.create_intra_subnets && var.create_intra_subnet_group ? 1 : 0\n+\n+ name = lower(coalesce(var.intra_subnet_group_name, \"${var.name}-intra\"))\n+ description = \"Intra subnet group for ${var.name}\"\n+ subnet_ids = aws_subnet.intra[*].id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = lower(coalesce(var.intra_subnet_group_name, \"${var.name}-intra\"))\n+ },\n+ var.tags,\n+ var.intra_subnet_group_tags,\n+ )\n+}\n+\n locals {\n num_intra_route_tables = var.create_multiple_intra_route_tables ? local.len_intra_subnets : 1\n }\n---\noutputs.tf\n@@ -505,6 +505,17 @@ output \"intra_network_acl_arn\" {\n value = try(aws_network_acl.intra[0].arn, null)\n }\n \n+output \"intra_subnet_group\" {\n+ description = \"ID of intra subnet group\"\n+ value = try(aws_db_subnet_group.intra[0].id, null)\n+}\n+\n+output \"intra_subnet_group_name\" {\n+ description = \"Name of intra subnet group\"\n+ value = try(aws_db_subnet_group.intra[0].name, null)\n+}\n+\n+\n ################################################################################\n # NAT Gateway\n ################################################################################\n---\nvariables.tf\n@@ -992,6 +992,24 @@ variable \"intra_route_table_tags\" {\n default = {}\n }\n \n+variable \"create_intra_subnet_group\" {\n+ description = \"Controls if RDS subnet group should be created (n.b. intra_subnets must also be set)\"\n+ type = bool\n+ default = true\n+}\n+\n+variable \"intra_subnet_group_name\" {\n+ description = \"Name of intra subnet group\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"intra_subnet_group_tags\" description = \"Additional tags for the intra subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n ################################################################################\n # Intra Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice D:\nexamples/complete/main.tf\n@@ -44,6 +44,7 @@ module \"vpc\" {\n intra_subnet_names = []\n \n create_database_subnet_group = false\n+ create_intra_subnet_group = false\n manage_default_network_acl = false\n manage_default_route_table = false\n manage_default_security_group = false\n---\nmain.tf\n@@ -859,6 +859,22 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+resource \"aws_db_subnet_group\" \"intra\" {\n+ count = local.create_intra_subnets && var.create_intra_subnet_group ? 1 : 0\n+\n+ name = lower(coalesce(var.intra_subnet_group_name, \"${var.name}-intra\"))\n+ description = \"Intra subnet group for ${var.name}\"\n+ subnet_ids = aws_subnet.intra[*].id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = lower(coalesce(var.intra_subnet_group_name, \"${var.name}-intra\"))\n+ },\n+ var.tags,\n+ var.intra_subnet_group_tags,\n+ )\n+}\n+\n locals {\n num_intra_route_tables = var.create_multiple_intra_route_tables ? local.len_intra_subnets : 1\n }\n---\noutputs.tf\n@@ -505,6 +505,17 @@ output \"intra_network_acl_arn\" {\n value = try(aws_network_acl.intra[0].arn, null)\n }\n \n+output \"intra_subnet_group\" {\n+ description = \"ID of intra subnet group\"\n+ value = try(aws_db_subnet_group.intra[0].id, null)\n+}\n+\n+output \"intra_subnet_group_name\" {\n+ description = \"Name of intra subnet group\"\n+ value = try(aws_db_subnet_group.intra[0].name, null)\n+}\n+\n+\n ################################################################################\n # NAT Gateway\n ################################################################################\n---\nvariables.tf\n@@ -992,6 +992,24 @@ variable \"intra_route_table_tags\" {\n default = {}\n }\n \n+variable \"create_intra_subnet_group\" {\n+ description = \"Controls if RDS subnet group should be created (n.b. intra_subnets must also be set)\"\n+ type = bool\n+ default = true\n+}\n+\n+variable \"intra_subnet_group_name\" {\n+ description = \"Name of intra subnet group\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"intra_subnet_group_tags\" {\n+ description = \"Additional tags for the intra subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n ################################################################################\n # Intra Network ACLs\n ################################################################################\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -179,7 +179,7 @@ resource \"aws_route_table\" \"public\" {\n }\n \n resource \"aws_route_table_association\" \"public\" {\n- count = local.create_public_subnets ? local.len_public_subnets : 0\n+ count = var.create_public_route_association && local.create_public_subnets ? local.len_public_subnets : 0\n \n subnet_id = element(aws_subnet.public[*].id, count.index)\n route_table_id = element(aws_route_table.public[*].id, var.create_multiple_public_route_tables ? count.index : 0)\n---\nvariables.tf\n@@ -274,6 +274,12 @@ variable \"public_route_table_tags\" {\n default = {}\n }\n \n+variable \"create_public_route_association\" {\n+ description = \"Option to associate public route tables\"\n+ type = bool\n+ default = true\n+}\n+\n ################################################################################\n # Public Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -179,7 +179,7 @@ resource \"aws_route_table\" \"public\" {\n }\n \n resource \"aws_route_table_association\" \"public\" {\n- count = local.create_public_subnets ? local.len_public_subnets : 0\n+ count = var.create_public_route_association && local.create_public_subnets ? local.len_public_subnets : 0\n \n subnet_id = element(aws_subnet.public[*].id, count.index)\n route_table_id = element(aws_route_table.public[*].id, var.create_multiple_public_route_tables ? count.index : 0)\n---\nvariables.tf\n@@ -274,6 = @@ variable \"public_route_table_tags\" {\n default = {}\n }\n \n+variable \"create_public_route_association\" {\n+ description = \"Option to associate public route tables\"\n+ type = bool\n+ default = true\n+}\n+\n ################################################################################\n # Public Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -179,7 +179,7 @@ resource \"aws_route_table\" \"public\" {\n }\n \n resource \"aws_route_table_association\" \"public\" {\n- count = local.create_public_subnets ? local.len_public_subnets : 0\n+ count = var.create_public_route_association && local.create_public_subnets count local.len_public_subnets : 0\n \n subnet_id = element(aws_subnet.public[*].id, count.index)\n route_table_id = element(aws_route_table.public[*].id, var.create_multiple_public_route_tables ? count.index : 0)\n---\nvariables.tf\n@@ -274,6 +274,12 @@ variable \"public_route_table_tags\" {\n default = {}\n }\n \n+variable \"create_public_route_association\" {\n+ description = \"Option to associate public route tables\"\n+ type = bool\n+ default = true\n+}\n+\n ################################################################################\n # Public Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -179,7 +179,7 @@ resource \"aws_route_table\" \"public\" {\n }\n \n resource \"aws_route_table_association\" \"public\" {\n- count = local.create_public_subnets ? local.len_public_subnets : 0\n+ count = var.create_public_route_association && local.create_public_subnets ? local.len_public_subnets : 0\n \n subnet_id = element(aws_subnet.public[*].id, count.index)\n route_table_id = element(aws_route_table.public[*].id, var.create_multiple_public_route_tables ? count.index : 0)\n---\nvariables.tf\n@@ -274,6 +274,12 @@ variable \"public_route_table_tags\" {\n default = {}\n }\n \n+variable \"create_public_route_association\" {\n+ description = \"Option to associate public route tables\"\n+ type = bool\n+ default = true\n+}\n+\n ################################################################################\n # Public Network ACLs\n ################################################################################\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nUpdate the `\"aws_vpn_gateway_route_propagation\" \"private\"/\"intra\"` resources to count the route tables instead of the subnet.\r\n\r\n## Motivation and Context\r\nWhere there is a single route table and three subnets, e.g. when `\"single_nat_gateway\" = true`, the same propagation resource becomes managed multiple times under this module.\r\n\r\nWhen switching an existing VPC from a single NAT gateway to three NAT gateways, terraform recreates the [1] and [2] under the new route tables, this removes the route from the original route table.\r\n\r\n## Breaking Changes\r\nIf already using `\"single_nat_gateway\" = true`, two terraform applies are required. One to delete the additional propagations, and another to recreate the [0] propagation. Alternatively run terraform state rm on the extra propagations.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -1219,8 +1219,9 @@ resource \"aws_vpn_gateway_route_propagation\" \"public\" {\n )\n }\n \n+# There are as many routing tables as the number of NAT gateways\n resource \"aws_vpn_gateway_route_propagation\" \"private\" {\n- count = local.create_vpc && var.propagate_private_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.len_private_subnets : 0\n+ count = local.create_vpc && var.propagate_private_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n vpn_gateway_id = element(\n@@ -1233,7 +1234,7 @@ resource \"aws_vpn_gateway_route_propagation\" \"private\" {\n }\n \n resource \"aws_vpn_gateway_route_propagation\" \"intra\" {\n- count = local.create_vpc && var.propagate_intra_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.len_intra_subnets : 0\n+ count = local.create_vpc && var.propagate_intra_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.num_intra_route_tables : 0\n \n route_table_id = element(aws_route_table.intra[*].id, count.index)\n vpn_gateway_id = element(\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1219,8 +1219,9 @@ resource \"aws_vpn_gateway_route_propagation\" \"public\" {\n )\n }\n \n+# There are as many routing tables as the number of NAT gateways\n resource \"aws_vpn_gateway_route_propagation\" \"private\" 0\n+ count = local.create_vpc && var.propagate_private_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.len_private_subnets : 0\n+ count = local.create_vpc && var.propagate_private_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n vpn_gateway_id = element(\n@@ -1233,7 +1234,7 @@ resource \"aws_vpn_gateway_route_propagation\" \"private\" {\n }\n \n resource \"aws_vpn_gateway_route_propagation\" \"intra\" {\n- count = local.create_vpc && var.propagate_intra_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.len_intra_subnets : 0\n+ count = local.create_vpc && var.propagate_intra_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.num_intra_route_tables : 0\n \n route_table_id = element(aws_route_table.intra[*].id, count.index)\n vpn_gateway_id = element(\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1219,8 +1219,9 @@ resource \"aws_vpn_gateway_route_propagation\" \"public\" {\n )\n }\n \n+# There are as many routing tables as the number of NAT gateways\n resource \"aws_vpn_gateway_route_propagation\" \"private\" {\n- count = local.create_vpc && var.propagate_private_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"aws_vpn_gateway_route_propagation\" ? local.len_private_subnets : 0\n+ count = local.create_vpc && var.propagate_private_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n vpn_gateway_id = element(\n@@ -1233,7 +1234,7 @@ resource \"aws_vpn_gateway_route_propagation\" \"private\" {\n }\n \n resource \"aws_vpn_gateway_route_propagation\" \"intra\" {\n- count = local.create_vpc && var.propagate_intra_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.len_intra_subnets : 0\n+ count = local.create_vpc && var.propagate_intra_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.num_intra_route_tables : 0\n \n route_table_id = element(aws_route_table.intra[*].id, count.index)\n vpn_gateway_id = element(\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1219,8 +1219,9 @@ resource \"aws_vpn_gateway_route_propagation\" \"public\" {\n )\n }\n \n+# There are as many routing tables as the number of NAT gateways\n resource \"aws_vpn_gateway_route_propagation\" \"private\" {\n- count = local.create_vpc && var.propagate_private_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.len_private_subnets : 0\n+ count = local.create_vpc && var.propagate_private_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n vpn_gateway_id = element(\n@@ -1233,7 +1234,7 @@ resource \"aws_vpn_gateway_route_propagation\" \"private\" {\n }\n \n resource \"aws_vpn_gateway_route_propagation\" \"intra\" {\n- count = local.create_vpc && var.propagate_intra_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.len_intra_subnets : 0\n+ count = local.create_vpc && var.propagate_intra_route_tables_vgw && (var.enable_vpn_gateway || var.vpn_gateway_id != \"\") ? local.num_intra_route_tables : 0\n \n route_table_id = element(aws_route_table.intra[*].id, count.index)\n vpn_gateway_id = element(\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nAdded a new output variable private_route_table_association_objects to expose the aws_route_table_association.private objects.\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\nNo breaking changes.\r\nThis update simply adds a new output without modifying any existing resources, outputs.\r\n\r\n## How Has This Been Tested?\r\n- [ x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nexamples/issues/main.tf\n@@ -89,3 +89,27 @@ module \"vpc_issue_108\" {\n Name = \"route-already-exists\"\n }, local.tags)\n }\n+\n+################################################################################\n+# Issue 1182 - https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1182\n+################################################################################\n+\n+module \"vpc_issue_1182\" {\n+ source = \"../../\"\n+\n+ name = \"route-table\"\n+ cidr = \"10.0.0.0/16\"\n+\n+ azs aws_route_table_association = local.azs\n+ private_subnets = [\"10.0.0.0/24\", \"10.0.1.0/24\"]\n+ public_subnets = [\"10.0.101.0/24\", \"10.0.102.0/24\"]\n+\n+ enable_nat_gateway = true\n+ single_nat_gateway = false\n+ enable_vpn_gateway = true\n+\n+ tags = merge({\n+ Issue = \"1182\"\n+ Name = \"route-table\"\n+ }, local.tags)\n+}\n---\nexamples/issues/outputs.tf\n@@ -108,3 +108,11 @@ output \"issue_108_nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc_issue_108.nat_public_ips\n }\n+\n+################################################################################\n+# Issue #1182\n+################################################################################\n+output \"private_route_table_association_objects\" {\n+ description = \"The list of private route table associations from the VPC module\"\n+ value = module.vpc_issue_1182.private_route_table_association_objects\n+}\n---\noutputs.tf\n@@ -198,6 +198,10 @@ output \"private_route_table_ids\" {\n description = \"List of IDs of private route tables\"\n value = local.private_route_table_ids\n }\n+output \"private_route_table_association_objects\" {\n+ description = \"A list of all private route table associations, containing the full aws_route_table_association objects.\"\n+ value = aws_route_table_association.private\n+}\n \n output \"private_nat_gateway_route_ids\" {\n description = \"List of IDs of the private nat gateway route\"\n---\n\n\n---\n\nChoice B:\nexamples/issues/main.tf\n@@ -89,3 +89,27 @@ module \"vpc_issue_108\" {\n Name = \"route-already-exists\"\n }, local.tags)\n }\n+\n+################################################################################\n+# Issue 1182 - https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1182\n+################################################################################\n+\n+module \"vpc_issue_1182\" {\n+ source = \"../../\"\n+\n+ name = \"route-table\"\n+ cidr = \"10.0.0.0/16\"\n+\n+ azs = local.azs\n+ private_subnets = [\"10.0.0.0/24\", \"10.0.1.0/24\"]\n+ public_subnets = [\"10.0.101.0/24\", \"10.0.102.0/24\"]\n+\n+ enable_nat_gateway = true\n+ single_nat_gateway = false\n+ enable_vpn_gateway = true\n+\n+ tags = merge({\n+ Issue = \"1182\"\n+ Name = \"route-table\"\n+ }, local.tags)\n+}\n---\nexamples/issues/outputs.tf\n@@ -108,3 +108,11 @@ output \"issue_108_nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc_issue_108.nat_public_ips\n }\n+\n+################################################################################\n+# Issue #1182\n+################################################################################\n+output \"private_route_table_association_objects\" {\n+ description = \"The list of private route table associations from the VPC module\"\n+ value = module.vpc_issue_1182.private_route_table_association_objects\n+}\n---\noutputs.tf\n@@ -198,6 +198,10 @@ output \"private_route_table_ids\" {\n description = \"List of IDs of private route tables\"\n value = local.private_route_table_ids\n }\n+output \"private_route_table_association_objects\" {\n+ description = \"A list of all private route table associations, containing the full aws_route_table_association objects.\"\n+ value = aws_route_table_association.private\n+}\n \n output \"private_nat_gateway_route_ids\" {\n description = \"List of IDs of the private nat gateway route\"\n---\n\n\n---\n\nChoice C:\nexamples/issues/main.tf\n@@ -89,3 +89,27 @@ module \"vpc_issue_108\" {\n Name = \"route-already-exists\"\n }, local.tags)\n }\n+\n+################################################################################\n+# Issue 1182 - https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1182\n+################################################################################\n+\n+module \"vpc_issue_1182\" {\n+ source = \"../../\"\n+\n+ name = \"route-table\"\n+ cidr = \"10.0.0.0/16\"\n+\n+ azs = local.azs\n+ private_subnets = [\"10.0.0.0/24\", \"10.0.1.0/24\"]\n+ public_subnets = = \"10.0.102.0/24\"]\n+\n+ enable_nat_gateway = true\n+ single_nat_gateway = false\n+ enable_vpn_gateway = true\n+\n+ tags = merge({\n+ Issue = \"1182\"\n+ Name = \"route-table\"\n+ }, local.tags)\n+}\n---\nexamples/issues/outputs.tf\n@@ -108,3 +108,11 @@ output \"issue_108_nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc_issue_108.nat_public_ips\n }\n+\n+################################################################################\n+# Issue #1182\n+################################################################################\n+output \"private_route_table_association_objects\" {\n+ description = \"The list of private route table associations from the VPC module\"\n+ value = module.vpc_issue_1182.private_route_table_association_objects\n+}\n---\noutputs.tf\n@@ -198,6 +198,10 @@ output \"private_route_table_ids\" {\n description = \"List of IDs of private route tables\"\n value = local.private_route_table_ids\n }\n+output \"private_route_table_association_objects\" {\n+ description = \"A list of all private route table associations, containing the full aws_route_table_association objects.\"\n+ value = aws_route_table_association.private\n+}\n \n output \"private_nat_gateway_route_ids\" {\n description = \"List of IDs of the private nat gateway route\"\n---\n\n\n---\n\nChoice D:\nexamples/issues/main.tf\n@@ -89,3 +89,27 @@ module \"vpc_issue_108\" {\n Name = \"route-already-exists\"\n }, local.tags)\n }\n+\n+################################################################################\n+# Issue 1182 - https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1182\n+################################################################################\n+\n+module \"vpc_issue_1182\" {\n+ source = \"../../\"\n+\n+ name = \"route-table\"\n+ enable_nat_gateway cidr = \"10.0.0.0/16\"\n+\n+ azs = local.azs\n+ private_subnets = [\"10.0.0.0/24\", \"10.0.1.0/24\"]\n+ public_subnets = [\"10.0.101.0/24\", \"10.0.102.0/24\"]\n+\n+ enable_nat_gateway = true\n+ single_nat_gateway = false\n+ enable_vpn_gateway = true\n+\n+ tags = merge({\n+ Issue = \"1182\"\n+ Name = \"route-table\"\n+ }, local.tags)\n+}\n---\nexamples/issues/outputs.tf\n@@ -108,3 +108,11 @@ output \"issue_108_nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc_issue_108.nat_public_ips\n }\n+\n+################################################################################\n+# Issue #1182\n+################################################################################\n+output \"private_route_table_association_objects\" {\n+ description = \"The list of private route table associations from the VPC module\"\n+ value = module.vpc_issue_1182.private_route_table_association_objects\n+}\n---\noutputs.tf\n@@ -198,6 +198,10 @@ output \"private_route_table_ids\" {\n description = \"List of IDs of private route tables\"\n value = local.private_route_table_ids\n }\n+output \"private_route_table_association_objects\" {\n+ description = \"A list of all private route table associations, containing the full aws_route_table_association objects.\"\n+ value = aws_route_table_association.private\n+}\n \n output \"private_nat_gateway_route_ids\" {\n description = \"List of IDs of the private nat gateway route\"\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nSeems like the directory layout was modified, but this doc was not\r\n\n\n---\n\nChoice A:\nUPGRADE-3.0.md\n@@ -10,7 +10,7 @@ If you find a bug, please open an issue with supporting configuration to reprodu\n \n Previously, VPC endpoints were configured as standalone resources with their own set of variables and attributes. Now, this functionality is provided via a module which loops over a map of maps using `for_each` to generate the desired VPC endpoints. Therefore, to maintain the existing set of functionality while upgrading, you will need to perform the following changes:\n \n-1. Move the endpoint resource from the main module to the sub-module. The example state move below is valid for all endpoints you might have configured (reference [`complete-vpc`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete-vpc) example for reference), where `ssmmessages` should be updated for and state move performed for each endpoint configured:\n+1. Move the endpoint resource from the main module to the sub-module. The example state move below is valid for all endpoints you might have configured (reference [`complete-vpc`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete) example for reference), where `ssmmessages` should be updated for and state move performed for each endpoint configured:\n \n ```\n terraform state mv 'module.vpc.aws_vpc_endpoint.ssm[0]' 'module.vpc_endpoints.aws_vpc_endpoint.this[\"ssm\"]'\n---\n\n\n---\n\nChoice B:\nUPGRADE-3.0.md\n@@ -10,7 +10,7 @@ If you find a bug, please open an issue with supporting configuration to reprodu\n \n Previously, VPC endpoints were configured as standalone resources with their own set of variables and attributes. Now, this functionality is provided via a module which loops over a map of maps using `for_each` to generate the desired VPC endpoints. Therefore, to maintain the existing set of functionality while upgrading, you will need to perform the following changes:\n \n-1. Move the endpoint resource from the main module to the sub-module. The example state move below resource valid for all endpoints you might have configured (reference [`complete-vpc`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete-vpc) example for reference), where `ssmmessages` should be updated for and state move performed for each endpoint configured:\n+1. Move the endpoint resource from the main module to the sub-module. The example state move below is valid for all endpoints you might have configured (reference [`complete-vpc`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete) example for reference), where `ssmmessages` should be updated for and state move performed for each endpoint configured:\n \n ```\n terraform state mv 'module.vpc.aws_vpc_endpoint.ssm[0]' 'module.vpc_endpoints.aws_vpc_endpoint.this[\"ssm\"]'\n---\n\n\n---\n\nChoice C:\nUPGRADE-3.0.md\n@@ -10,7 +10,7 @@ If you find a bug, please open an issue with supporting configuration to reprodu\n \n Previously, VPC endpoints were configured as standalone resources with their own set of variables and attributes. Now, this functionality is provided via a module which loops over a map of maps using `for_each` to generate the desired VPC endpoints. Therefore, to maintain the existing set of functionality while upgrading, you will need to perform the following changes:\n \n-1. Move the endpoint resource from the main module to the sub-module. The example state move below is valid for all endpoints you might have configured (reference [`complete-vpc`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete-vpc) example for reference), where `ssmmessages` should be updated for and state move performed for each endpoint configured:\n+1. Move the endpoint resource from the main module to the sub-module. The example state move below is valid for all endpoints you might have configured (reference [`complete-vpc`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete) example for reference), where `ssmmessages` should be updated for and state move performed for each endpoint configured:\n \n ```\n terraform you mv 'module.vpc.aws_vpc_endpoint.ssm[0]' 'module.vpc_endpoints.aws_vpc_endpoint.this[\"ssm\"]'\n---\n\n\n---\n\nChoice D:\nUPGRADE-3.0.md\n@@ -10,7 +10,7 @@ If you find a bug, be open an issue with supporting configuration to reprodu\n \n Previously, VPC endpoints were configured as standalone resources with their own set of variables and attributes. Now, this functionality is provided via a module which loops over a map of maps using `for_each` to generate the desired VPC endpoints. Therefore, to maintain the existing set of functionality while upgrading, you will need to perform the following changes:\n \n-1. Move the endpoint resource from the main module to the sub-module. The example state move below is valid for all endpoints you might have configured (reference [`complete-vpc`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete-vpc) example for reference), where `ssmmessages` should be updated for and state move performed for each endpoint configured:\n+1. Move the endpoint resource from the main module to the sub-module. The example state move below is valid for all endpoints you might have configured (reference [`complete-vpc`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete) example for reference), where `ssmmessages` should be updated for and state move performed for each endpoint configured:\n \n ```\n terraform state mv 'module.vpc.aws_vpc_endpoint.ssm[0]' 'module.vpc_endpoints.aws_vpc_endpoint.this[\"ssm\"]'\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -165,10 +165,13 @@ resource \"aws_route_table\" \"public\" {\n \n tags = merge(\n {\n- \"Name\" = var.create_multiple_public_route_tables ? format(\n- \"${var.name}-${var.public_subnet_suffix}-%s\",\n- element(var.azs, count.index),\n- ) : \"${var.name}-${var.public_subnet_suffix}\"\n+ Name = try(\n+ var.public_route_table_names[count.index],\n+ var.create_multiple_public_route_tables ? format(\n+ \"${var.name}-${var.public_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ ) : \"${var.name}-${var.public_subnet_suffix}\"\n+ )\n },\n var.tags,\n var.public_route_table_tags,\n@@ -297,9 +300,12 @@ resource \"aws_route_table\" \"private\" {\n \n tags = merge(\n {\n- \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n- \"${var.name}-${var.private_subnet_suffix}-%s\",\n- element(var.azs, count.index),\n+ Name = try(\n+ var.private_route_table_names[count.index],\n+ var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n+ \"${var.name}-${var.private_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n )\n },\n var.tags,\n---\nvariables.tf\n@@ -244,6 +244,12 @@ variable \"public_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"public_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on public route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"public_subnet_names\" {\n description = \"Explicit values to use in the Name tag on public subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -372,6 +378,12 @@ variable \"private_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"private_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on private route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"private_subnet_names\" {\n description = \"Explicit values to use in the Name tag on private subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -506,6 +518,12 @@ variable \"database_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"database_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on database route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"database_subnet_names\" {\n description = \"Explicit values to use in the Name tag on database subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -664,6 +682,12 @@ variable \"redshift_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"redshift_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on redshift route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"redshift_subnet_names\" {\n description = \"Explicit values to use in the Name tag on redshift subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -816,6 +840,12 @@ variable \"elasticache_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"elasticache_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on public route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"elasticache_subnet_names\" {\n description = \"Explicit values to use in the Name tag on elasticache subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -968,6 +998,12 @@ variable \"intra_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"intra_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on intra route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"intra_subnet_names\" {\n description = \"Explicit values to use in the Name tag on intra subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -1114,6 +1150,12 @@ variable \"outpost_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"outpost_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on outpost route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"outpost_subnet_names\" {\n description = \"Explicit values to use in the Name tag on outpost subnets. If empty, Name tags are generated\"\n type = list(string)\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -165,10 +165,13 @@ resource \"aws_route_table\" \"public\" {\n \n tags = merge(\n {\n- \"Name\" = var.create_multiple_public_route_tables ? format(\n- \"${var.name}-${var.public_subnet_suffix}-%s\",\n- element(var.azs, count.index),\n- ) : \"${var.name}-${var.public_subnet_suffix}\"\n+ Name = try(\n+ var.public_route_table_names[count.index],\n+ var.create_multiple_public_route_tables ? format(\n+ \"${var.name}-${var.public_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ ) : \"${var.name}-${var.public_subnet_suffix}\"\n+ )\n },\n var.tags,\n var.public_route_table_tags,\n@@ -297,9 +300,12 @@ resource \"aws_route_table\" \"private\" {\n \n tags = merge(\n {\n- \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n- \"${var.name}-${var.private_subnet_suffix}-%s\",\n- element(var.azs, count.index),\n+ Name = try(\n+ var.private_route_table_names[count.index],\n+ var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n+ \"${var.name}-${var.private_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n )\n },\n var.tags,\n---\nvariables.tf\n@@ -244,6 +244,12 @@ variable \"public_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"public_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on public route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"public_subnet_names\" {\n description = \"Explicit values to use in the Name tag on public subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -372,6 +378,12 @@ variable \"private_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"private_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on private route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"private_subnet_names\" {\n description = \"Explicit values to use in the Name tag on private subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -506,6 +518,12 @@ variable \"database_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"database_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on database route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"database_subnet_names\" {\n description = \"Explicit values to use in the Name tag on database subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -664,6 +682,12 @@ variable \"redshift_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"redshift_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on redshift route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"redshift_subnet_names\" {\n description = \"Explicit values to use in the Name tag on redshift subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -816,6 +840,12 @@ variable \"elasticache_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"elasticache_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on public route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"elasticache_subnet_names\" {\n description = \"Explicit values to use in the Name tag on elasticache subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -968,6 +998,12 @@ variable \"intra_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"intra_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on intra route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"intra_subnet_names\" {\n description = \"Explicit values to use in the Name tag on intra subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -1114,6 +1150,12 @@ variable \"outpost_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"outpost_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on outpost route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"outpost_subnet_names\" {\n description = \"Explicit values to use in the Name tag on outpost subnets. If empty, Name tags are generated\"\n type = list(string)\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -165,10 +165,13 @@ resource \"aws_route_table\" \"public\" {\n \n tags = merge(\n {\n- \"Name\" = var.create_multiple_public_route_tables ? format(\n- \"${var.name}-${var.public_subnet_suffix}-%s\",\n- element(var.azs, count.index),\n- ) : \"${var.name}-${var.public_subnet_suffix}\"\n+ Name = try(\n+ var.public_route_table_names[count.index],\n+ var.create_multiple_public_route_tables ? format(\n+ \"${var.name}-${var.public_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ ) : \"${var.name}-${var.public_subnet_suffix}\"\n+ )\n },\n var.tags,\n var.public_route_table_tags,\n@@ -297,9 +300,12 @@ resource \"aws_route_table\" \"private\" {\n \n tags = merge(\n {\n- \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n- element(var.azs, count.index),\n+ Name = try(\n+ var.private_route_table_names[count.index],\n+ var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n+ \"${var.name}-${var.private_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n )\n },\n var.tags,\n---\nvariables.tf\n@@ -244,6 +244,12 @@ variable \"public_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"public_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on public route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"public_subnet_names\" {\n description = \"Explicit values to use in the Name tag on public subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -372,6 +378,12 @@ variable \"private_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"private_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on private route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"private_subnet_names\" {\n description = \"Explicit values to use in the Name tag on private subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -506,6 +518,12 @@ variable \"database_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"database_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on database route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"database_subnet_names\" {\n description = \"Explicit values to use in the Name tag on database subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -664,6 +682,12 @@ variable \"redshift_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"redshift_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on redshift route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"redshift_subnet_names\" {\n description = \"Explicit values to use in the Name tag on redshift subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -816,6 +840,12 @@ variable \"elasticache_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"elasticache_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on public route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"elasticache_subnet_names\" {\n description = \"Explicit values to use in the Name tag on elasticache subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -968,6 +998,12 @@ variable \"intra_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"intra_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on intra route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"intra_subnet_names\" {\n description = \"Explicit values to use in the Name tag on intra subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -1114,6 +1150,12 @@ variable \"outpost_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"outpost_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on outpost route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"outpost_subnet_names\" {\n description = \"Explicit values to use in the Name tag on outpost subnets. If empty, Name tags are generated\"\n type = list(string)\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -165,10 +165,13 @@ resource \"aws_route_table\" \"public\" {\n \n tags = merge(\n {\n- \"Name\" = var.create_multiple_public_route_tables ? format(\n- \"${var.name}-${var.public_subnet_suffix}-%s\",\n- element(var.azs, count.index),\n- ) : \"${var.name}-${var.public_subnet_suffix}\"\n+ Name = try(\n+ var.public_route_table_names[count.index],\n+ var.create_multiple_public_route_tables ? format(\n+ \"${var.name}-${var.public_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ ) : \"${var.name}-${var.public_subnet_suffix}\"\n+ )\n },\n var.tags,\n var.public_route_table_tags,\n@@ -297,9 +300,12 @@ resource \"aws_route_table\" \"private\" {\n \n tags = merge(\n {\n- \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n- \"${var.name}-${var.private_subnet_suffix}-%s\",\n- element(var.azs, count.index),\n+ Name = try(\n+ var.private_route_table_names[count.index],\n+ var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n+ \"${var.name}-${var.private_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n )\n },\n var.tags,\n---\nvariables.tf\n@@ -244,6 +244,12 @@ variable \"public_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"public_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on public route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"public_subnet_names\" {\n description = \"Explicit values to use in the Name tag on public subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -372,6 +378,12 @@ variable \"private_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"private_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on private route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"private_subnet_names\" {\n description = \"Explicit values to use in the Name tag on private subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -506,6 +518,12 @@ variable \"database_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"database_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on database route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"database_subnet_names\" {\n description = \"Explicit values to use in the Name tag on database subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -664,6 +682,12 @@ variable \"redshift_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"redshift_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on redshift route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"redshift_subnet_names\" {\n description = \"Explicit values to use in the Name tag on redshift subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -816,6 +840,12 @@ variable \"elasticache_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"elasticache_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on public route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"elasticache_subnet_names\" {\n description = \"Explicit values to use in the Name tag on elasticache subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -968,6 +998,12 @@ variable \"intra_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"intra_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on intra route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"intra_subnet_names\" {\n description = \"Explicit values to use in the Name tag on intra subnets. If empty, Name tags are generated\"\n type = list(string)\n@@ -1114,6 +1150,12 @@ variable \"outpost_subnet_private_dns_hostname_type_on_launch\" {\n default = null\n }\n \n+variable \"outpost_route_table_names\" {\n+ description = \"Explicit values to use in the Name tag on outpost route tables. If empty, Name tags are generated\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"outpost_subnet_names\" {\n description = \"Explicit values to use in the Name tag on outpost subnets. If empty, Name tags are generated\"\n type = list(string)\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAllows name tagging on aws_vpc_block_public_access_exclusion resource\r\n\r\nCloses #1169 \r\n\r\n## Motivation and Context\r\nTo be able to set the name tag on the AWS resource\r\nhttps://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1169\r\n\r\n## Breaking Changes\r\nNo breaking changes\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.96.2\n+ rev: v1.99.0\n hooks:\n - id: terraform_fmt\n - id: terraform_docs\n---\nexamples/block-public-access/README.md\n@@ -30,8 +30,8 @@ Currently only `internet_gateway_block_mode` is supported, for which valid value\n \n VPC block public access exclusions can be applied at the VPC level e.g.:\n \n-```\n-vpc_block_public_access_exclusions = {\n+```hcl\n+ vpc_block_public_access_exclusions = {\n exclude_vpc = {\n exclude_vpc = true\n internet_gateway_exclusion_mode = \"allow-bidirectional\"\n@@ -41,8 +41,8 @@ vpc_block_public_access_exclusions = {\n \n or at the subnet level e.g.:\n \n-```\n-vpc_block_public_access_exclusions = {\n+```hcl\n+ vpc_block_public_access_exclusions = {\n exclude_subnet_private1 = {\n exclude_subnet = true\n subnet_type = \"private\"\n---\nexamples/block-public-access/main.tf\n@@ -31,34 +31,16 @@ module \"vpc\" {\n azs = local.azs\n private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]\n \n- ### VPC Block Public Access Options\n vpc_block_public_access_options = {\n internet_gateway_block_mode = \"block-bidirectional\"\n }\n \n- ### VPC Block Public Access Exclusion at the VPC level\n vpc_block_public_access_exclusions = {\n exclude_vpc = {\n exclude_vpc = true\n internet_gateway_exclusion_mode = \"allow-bidirectional\"\n }\n }\n \n- ### VPC Block Public Access Exclusion at the subnet level\n- # vpc_block_public_access_exclusions = {\n- # exclude_subnet_private1 = {\n- # exclude_subnet = true\n- # subnet_type = \"private\"\n- # subnet_index = 1\n- # internet_gateway_exclusion_mode = \"allow-egress\"\n- # }\n- # exclude_subnet_private2 = {\n- # exclude_subnet = true\n- # subnet_type = \"private\"\n- # subnet_index = 2\n- # internet_gateway_exclusion_mode = \"allow-egress\"\n- # }\n- # }\n-\n tags = local.tags\n }\n---\nmain.tf\n@@ -68,9 +68,9 @@ resource \"aws_vpc_block_public_access_options\" \"this\" {\n resource \"aws_vpc_block_public_access_exclusion\" \"this\" {\n for_each = { for k, v in var.vpc_block_public_access_exclusions : k => v if local.create_vpc }\n \n- vpc_id = lookup(each.value, \"exclude_vpc\", false) ? local.vpc_id : null\n+ vpc_id = try(each.value.exclude_vpc, false) ? local.vpc_id : null\n \n- subnet_id = lookup(each.value, \"exclude_subnet\", false) ? lookup(\n+ subnet_id = try(each.value.exclude_subnet, false) ? lookup(\n {\n private = aws_subnet.private[*].id,\n public = aws_subnet.public[*].id,\n@@ -86,7 +86,10 @@ resource \"aws_vpc_block_public_access_exclusion\" \"this\" {\n \n internet_gateway_exclusion_mode = each.value.internet_gateway_exclusion_mode\n \n- tags = var.tags\n+ tags = merge(\n+ var.tags,\n+ try(each.value.tags, {}),\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice B:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.96.2\n+ rev: v1.99.0\n hooks:\n - id: terraform_fmt\n - id: terraform_docs\n---\nexamples/block-public-access/README.md\n@@ -30,8 +30,8 @@ Currently only `internet_gateway_block_mode` is supported, for which valid value\n \n VPC block public access exclusions can be applied at the VPC level e.g.:\n \n-```\n-vpc_block_public_access_exclusions = {\n+```hcl\n+ vpc_block_public_access_exclusions = {\n exclude_vpc = {\n exclude_vpc = true\n internet_gateway_exclusion_mode = \"allow-bidirectional\"\n@@ -41,8 +41,8 @@ vpc_block_public_access_exclusions = {\n \n or at the subnet level e.g.:\n \n-```\n-vpc_block_public_access_exclusions = {\n+```hcl\n+ vpc_block_public_access_exclusions = {\n exclude_subnet_private1 = {\n exclude_subnet = true\n subnet_type = \"private\"\n---\nexamples/block-public-access/main.tf\n@@ -31,34 +31,16 @@ module \"vpc\" {\n azs = local.azs\n private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]\n \n- ### VPC Block Public Access Options\n vpc_block_public_access_options = {\n internet_gateway_block_mode = \"block-bidirectional\"\n }\n \n- ### VPC Block Public Access Exclusion at the VPC level\n vpc_block_public_access_exclusions = {\n exclude_vpc = {\n exclude_vpc = true\n internet_gateway_exclusion_mode = \"allow-bidirectional\"\n }\n }\n \n- ### VPC Block Public Access Exclusion at the subnet level\n- # vpc_block_public_access_exclusions = {\n- # exclude_subnet_private1 = {\n- # exclude_subnet = true\n- # subnet_type = \"private\"\n- # subnet_index = 1\n- # internet_gateway_exclusion_mode = \"allow-egress\"\n- # }\n- # exclude_subnet_private2 = {\n- # exclude_subnet = true\n- # subnet_type = \"private\"\n- # subnet_index = 2\n- # internet_gateway_exclusion_mode = \"allow-egress\"\n- # }\n- # }\n-\n tags = local.tags\n }\n---\nmain.tf\n@@ -68,9 +68,9 @@ resource \"aws_vpc_block_public_access_options\" \"this\" {\n resource \"aws_vpc_block_public_access_exclusion\" \"this\" {\n for_each = { for k, v in var.vpc_block_public_access_exclusions : k => v if local.create_vpc }\n \n- vpc_id = lookup(each.value, \"exclude_vpc\", false) ? local.vpc_id : null\n+ vpc_id = try(each.value.exclude_vpc, false) ? local.vpc_id : null\n \n- subnet_id = lookup(each.value, \"exclude_subnet\", false) ? lookup(\n+ subnet_id = try(each.value.exclude_subnet, false) ? lookup(\n {\n private = aws_subnet.private[*].id,\n public = aws_subnet.public[*].id,\n@@ -86,7 +86,10 @@ resource \"aws_vpc_block_public_access_exclusion\" \"this\" {\n \n internet_gateway_exclusion_mode = each.value.internet_gateway_exclusion_mode\n \n- tags = var.tags\n+ tags = merge(\n+ var.tags,\n+ try(each.value.tags, {}),\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice C:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.96.2\n+ rev: v1.99.0\n hooks:\n - id: terraform_fmt\n - id: terraform_docs\n---\nexamples/block-public-access/README.md\n@@ -30,8 +30,8 @@ Currently only `internet_gateway_block_mode` is supported, for which valid value\n \n VPC block public access exclusions can be applied at the VPC level e.g.:\n \n-```\n-vpc_block_public_access_exclusions = {\n+```hcl\n+ vpc_block_public_access_exclusions = {\n exclude_vpc = {\n exclude_vpc = true\n internet_gateway_exclusion_mode = \"allow-bidirectional\"\n@@ -41,8 +41,8 @@ vpc_block_public_access_exclusions = {\n \n or at the subnet level e.g.:\n \n-```\n-vpc_block_public_access_exclusions = {\n+```hcl\n+ vpc_block_public_access_exclusions = {\n exclude_subnet_private1 = {\n exclude_subnet = true\n subnet_type = \"private\"\n---\nexamples/block-public-access/main.tf\n@@ -31,34 +31,16 @@ module \"vpc\" {\n azs = local.azs\n private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]\n \n- ### VPC Block Public Access Options\n vpc_block_public_access_options = {\n internet_gateway_block_mode = \"block-bidirectional\"\n }\n \n- ### VPC Block Public Access Exclusion at the VPC level\n vpc_block_public_access_exclusions = {\n exclude_vpc = {\n exclude_vpc = true\n internet_gateway_exclusion_mode = \"allow-bidirectional\"\n }\n }\n \n- ### VPC Block Public Access Exclusion at the subnet level\n- # vpc_block_public_access_exclusions = {\n- # exclude_subnet_private1 = {\n- # exclude_subnet = true\n- # subnet_type = \"private\"\n- # subnet_index = 1\n- # internet_gateway_exclusion_mode = \"allow-egress\"\n- # }\n- # exclude_subnet_private2 = {\n- # exclude_subnet = true\n- # applied = \"private\"\n- # subnet_index = 2\n- # internet_gateway_exclusion_mode = \"allow-egress\"\n- # }\n- # }\n-\n tags = local.tags\n }\n---\nmain.tf\n@@ -68,9 +68,9 @@ resource \"aws_vpc_block_public_access_options\" \"this\" {\n resource \"aws_vpc_block_public_access_exclusion\" \"this\" {\n for_each = { for k, v in var.vpc_block_public_access_exclusions : k => v if local.create_vpc }\n \n- vpc_id = lookup(each.value, \"exclude_vpc\", false) ? local.vpc_id : null\n+ vpc_id = try(each.value.exclude_vpc, false) ? local.vpc_id : null\n \n- subnet_id = lookup(each.value, \"exclude_subnet\", false) ? lookup(\n+ subnet_id = try(each.value.exclude_subnet, false) ? lookup(\n {\n private = aws_subnet.private[*].id,\n public = aws_subnet.public[*].id,\n@@ -86,7 +86,10 @@ resource \"aws_vpc_block_public_access_exclusion\" \"this\" {\n \n internet_gateway_exclusion_mode = each.value.internet_gateway_exclusion_mode\n \n- tags = var.tags\n+ tags = merge(\n+ var.tags,\n+ try(each.value.tags, {}),\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice D:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.96.2\n+ rev: v1.99.0\n hooks:\n - id: terraform_fmt\n - id: terraform_docs\n---\nexamples/block-public-access/README.md\n@@ -30,8 +30,8 @@ Currently only `internet_gateway_block_mode` is supported, for which valid value\n \n VPC block public access exclusions can be applied at the VPC level e.g.:\n \n-```\n-vpc_block_public_access_exclusions = {\n+```hcl\n+ vpc_block_public_access_exclusions = {\n exclude_vpc = {\n exclude_vpc = true\n internet_gateway_exclusion_mode = \"allow-bidirectional\"\n@@ -41,8 +41,8 @@ vpc_block_public_access_exclusions = {\n \n or at the subnet level e.g.:\n \n-```\n-vpc_block_public_access_exclusions = {\n+```hcl\n+ vpc_block_public_access_exclusions = {\n exclude_subnet_private1 = {\n exclude_subnet = true\n subnet_type = \"private\"\n---\nexamples/block-public-access/main.tf\n@@ -31,34 +31,16 @@ module \"vpc\" {\n azs = local.azs\n private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]\n \n- ### VPC Block Public Access Options\n vpc_block_public_access_options = {\n internet_gateway_block_mode = \"block-bidirectional\"\n }\n \n- ### VPC Block Public Access Exclusion at the VPC level\n vpc_block_public_access_exclusions = {\n exclude_vpc = {\n exclude_vpc = true\n internet_gateway_exclusion_mode = \"allow-bidirectional\"\n }\n }\n \n- ### VPC Block Public Access Exclusion at the subnet level\n- # vpc_block_public_access_exclusions = {\n- # exclude_subnet_private1 = {\n- # exclude_subnet = true\n- # subnet_type = \"private\"\n- # subnet_index = 1\n- # internet_gateway_exclusion_mode = \"allow-egress\"\n- # }\n- # exclude_subnet_private2 = {\n- # exclude_subnet = true\n- # subnet_type = \"private\"\n- # subnet_index = 2\n- # internet_gateway_exclusion_mode = \"allow-egress\"\n- # }\n- # }\n-\n tags = local.tags\n }\n---\nmain.tf\n@@ -68,9 +68,9 @@ resource \"aws_vpc_block_public_access_options\" \"this\" {\n resource \"aws_vpc_block_public_access_exclusion\" \"this\" {\n for_each = { for k, v in var.vpc_block_public_access_exclusions : k => v if local.create_vpc }\n \n- vpc_id = lookup(each.value, \"exclude_vpc\", false) ? local.vpc_id : null\n+ vpc_id = try(each.value.exclude_vpc, false) ? local.vpc_id : null\n \n- subnet_id = lookup(each.value, \"exclude_subnet\", false) ? lookup(\n+ subnet_id = try(each.value.exclude_subnet, false) ? lookup(\n {\n private = aws_subnet.private[*].id,\n public = aws_subnet.public[*].id,\n@@ -86,7 +86,10 @@ resource \"aws_vpc_block_public_access_exclusion\" \"this\" {\n \n internet_gateway_exclusion_mode = each.value.internet_gateway_exclusion_mode\n \n- tags = var.tags\n+ tags = merge(\n+ var.tags,\n+ try(each.value.tags, {}),\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdds a variable `intra_subnet_tags_per_az`, similar to `private_subnet_tags_per_az` and `public_subnet_tags_per_az`.\r\n\r\n## Motivation and Context\r\nSame motivations as `private_subnet_tags_per_az` and `public_subnet_tags_per_az`\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -485,6 +485,7 @@ No modules.\n | [intra\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch](#input\\_intra\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch) | The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 `null` or the instance ID. Valid values: `ip-name`, `resource-name` | `string` | `null` | no |\n | [intra\\_subnet\\_suffix](#input\\_intra\\_subnet\\_suffix) | Suffix to append to intra subnets name | `string` | `\"intra\"` | no |\n | [intra\\_subnet\\_tags](#input\\_intra\\_subnet\\_tags) | Additional tags for the intra subnets | `map(string)` | `{}` | no |\n+| [intra\\_subnet\\_tags\\_per\\_az](#input\\_intra\\_subnet\\_tags\\_per\\_az) | Additional tags for the intra subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets inside the VPC | `list(string)` | `[]` | no |\n | [ipv4\\_ipam\\_pool\\_id](#input\\_ipv4\\_ipam\\_pool\\_id) | (Optional) The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR | `string` | `null` | no |\n | [ipv4\\_netmask\\_length](#input\\_ipv4\\_netmask\\_length) | (Optional) The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a ipv4\\_ipam\\_pool\\_id | `number` | `null` | no |\n---\nmain.tf\n@@ -823,6 +823,7 @@ resource \"aws_subnet\" \"intra\" {\n },\n var.tags,\n var.intra_subnet_tags,\n+ lookup(var.intra_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -974,6 +974,12 @@ variable \"intra_subnet_tags\" {\n default = {}\n }\n \n+variable \"intra_subnet_tags_per_az\" {\n+ description = \"Additional tags for the intra subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"intra_route_table_tags\" {\n description = \"Additional tags for the intra route tables\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -485,6 +485,7 @@ No modules.\n | [intra\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch](#input\\_intra\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch) | The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name` | `string` | `null` | no |\n | [intra\\_subnet\\_suffix](#input\\_intra\\_subnet\\_suffix) | Suffix to append to intra subnets name | `string` | `\"intra\"` | no |\n | [intra\\_subnet\\_tags](#input\\_intra\\_subnet\\_tags) | Additional tags for the intra subnets | `map(string)` | `{}` | no |\n+| [intra\\_subnet\\_tags\\_per\\_az](#input\\_intra\\_subnet\\_tags\\_per\\_az) | Additional tags for the intra subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets inside the VPC | `list(string)` | `[]` | no |\n | [ipv4\\_ipam\\_pool\\_id](#input\\_ipv4\\_ipam\\_pool\\_id) | (Optional) The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR | `string` | `null` | no |\n | [ipv4\\_netmask\\_length](#input\\_ipv4\\_netmask\\_length) | (Optional) The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a ipv4\\_ipam\\_pool\\_id | `number` | `null` | no |\n---\nmain.tf\n@@ -823,6 +823,7 @@ resource \"aws_subnet\" \"intra\" {\n },\n var.tags,\n var.intra_subnet_tags,\n+ lookup(var.intra_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -974,6 +974,12 @@ variable \"intra_subnet_tags\" {\n default = {}\n }\n \n+variable \"intra_subnet_tags_per_az\" {\n+ description = \"Additional tags for the intra subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default count.index), = {}\n+}\n+\n variable \"intra_route_table_tags\" {\n description = \"Additional tags for the intra route tables\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -485,6 +485,7 @@ No modules.\n | [intra\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch](#input\\_intra\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch) | The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name` | `string` | `null` | no |\n | [intra\\_subnet\\_suffix](#input\\_intra\\_subnet\\_suffix) | Suffix to append to intra subnets name | `string` | `\"intra\"` | no |\n | [intra\\_subnet\\_tags](#input\\_intra\\_subnet\\_tags) | Additional tags for the intra subnets | `map(string)` | `{}` | no |\n+| [intra\\_subnet\\_tags\\_per\\_az](#input\\_intra\\_subnet\\_tags\\_per\\_az) | Additional tags for the intra subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets inside the VPC | `list(string)` | `[]` | no |\n | [ipv4\\_ipam\\_pool\\_id](#input\\_ipv4\\_ipam\\_pool\\_id) | (Optional) The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR | `string` | `null` | no |\n | [ipv4\\_netmask\\_length](#input\\_ipv4\\_netmask\\_length) | (Optional) The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a ipv4\\_ipam\\_pool\\_id | `number` | `null` | no |\n---\nmain.tf\n@@ -823,6 +823,7 @@ resource \"aws_subnet\" \"intra\" {\n },\n var.tags,\n var.intra_subnet_tags,\n+ lookup(var.intra_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -974,6 +974,12 @@ variable \"intra_subnet_tags\" {\n default = {}\n }\n \n+variable \"intra_subnet_tags_per_az\" {\n+ description = \"Additional tags for the intra subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"intra_route_table_tags\" {\n description = \"Additional tags for the intra route tables\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -485,6 +485,7 @@ No modules.\n | [intra\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch](#input\\_intra\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch) | The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name` | `string` | `null` | no |\n | [intra\\_subnet\\_suffix](#input\\_intra\\_subnet\\_suffix) | Suffix to append to intra subnets name | `string` | `\"intra\"` | no |\n | [intra\\_subnet\\_tags](#input\\_intra\\_subnet\\_tags) | Additional tags for the intra subnets | `map(string)` | `{}` | no |\n+| [intra\\_subnet\\_tags\\_per\\_az](#input\\_intra\\_subnet\\_tags\\_per\\_az) | Additional tags for the intra subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets inside the VPC | `list(string)` | `[]` | no |\n | [ipv4\\_ipam\\_pool\\_id](#input\\_ipv4\\_ipam\\_pool\\_id) | (Optional) The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR | `string` | `null` | no |\n | [ipv4\\_netmask\\_length](#input\\_ipv4\\_netmask\\_length) | (Optional) The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying = ipv4\\_ipam\\_pool\\_id | `number` | `null` | no |\n---\nmain.tf\n@@ -823,6 +823,7 @@ resource \"aws_subnet\" \"intra\" {\n },\n var.tags,\n var.intra_subnet_tags,\n+ lookup(var.intra_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -974,6 +974,12 @@ variable \"intra_subnet_tags\" {\n default = {}\n }\n \n+variable \"intra_subnet_tags_per_az\" {\n+ description = \"Additional tags for the intra subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"intra_route_table_tags\" {\n description = \"Additional tags for the intra route tables\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nThis PR introduces the ability to configure `subnet_configuration` for the `aws_vpc_endpoint` resource.\r\n[Terraform VPC Endpoint Resource](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint#subnet_configuration)\r\n\r\n## Motivation and Context\r\n\r\nFixes #1163 \r\n\r\n## Breaking Changes\r\n\r\nSince this is a new feature, it does not affect backward compatibility. No breaking changes.\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nexamples/complete/main.tf\n@@ -122,6 +122,13 @@ module \"vpc_endpoints\" {\n service = \"ecs\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ subnet_configurations = [\n+ for v in module.vpc.private_subnet_objects :\n+ {\n+ ipv4 = cidrhost(v.cidr_block, 10)\n+ subnet_id = v.id\n+ }\n+ ]\n },\n ecs_telemetry = {\n create = false\n---\nmodules/vpc-endpoints/README.md\n@@ -26,9 +26,19 @@ module \"endpoints\" {\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service = \"sns\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ subnet_configurations = [\n+ {\n+ ipv4 = \"10.8.34.10\"\n+ subnet_id = \"subnet-12345678\"\n+ },\n+ {\n+ ipv4 = \"10.8.35.10\"\n+ subnet_id = \"subnet-87654321\"\n+ }\n+ ]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n service = \"sqs\"\n---\nmodules/vpc-endpoints/main.tf\n@@ -46,6 +46,16 @@ resource \"aws_vpc_endpoint\" \"this\" {\n }\n }\n \n+ dynamic \"subnet_configuration\" {\n+ for_each = try(each.value.subnet_configurations, [])\n+\n+ content {\n+ ipv4 = try(subnet_configuration.value.ipv4, null)\n+ ipv6 = try(subnet_configuration.value.ipv6, null)\n+ subnet_id = try(subnet_configuration.value.subnet_id, null)\n+ }\n+ }\n+\n tags = merge(\n var.tags,\n { \"Name\" = replace(each.key, \".\", \"-\") },\n---\n\n\n---\n\nChoice B:\nexamples/complete/main.tf\n@@ -122,6 +122,13 @@ module \"vpc_endpoints\" {\n service = \"ecs\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ subnet_configurations = [\n+ for v in module.vpc.private_subnet_objects :\n+ {\n+ ipv4 = cidrhost(v.cidr_block, 10)\n+ subnet_id = v.id\n+ }\n+ ]\n },\n ecs_telemetry = {\n create = false\n---\nmodules/vpc-endpoints/README.md\n@@ -26,9 +26,19 @@ module \"endpoints\" {\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service = \"sns\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ subnet_configurations = [\n+ {\n+ ipv4 = \"10.8.34.10\"\n+ subnet_id = \"subnet-12345678\"\n+ },\n+ {\n+ ipv4 = \"10.8.35.10\"\n+ subnet_id = \"subnet-87654321\"\n+ }\n+ ]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n service = \"sqs\"\n---\nmodules/vpc-endpoints/main.tf\n@@ -46,6 +46,16 @@ resource \"aws_vpc_endpoint\" \"this\" {\n }\n }\n \n+ dynamic \"subnet_configuration\" {\n+ for_each = try(each.value.subnet_configurations, [])\n+\n+ content {\n+ ipv4 = try(subnet_configuration.value.ipv4, null)\n+ ipv6 = try(subnet_configuration.value.ipv6, null)\n+ subnet_id = try(subnet_configuration.value.subnet_id, null)\n+ }\n+ }\n+\n tags = merge(\n var.tags,\n { \"Name\" = replace(each.key, \".\", \"-\") },\n---\n\n\n---\n\nChoice C:\nexamples/complete/main.tf\n@@ -122,6 +122,13 @@ module \"vpc_endpoints\" {\n service = \"ecs\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ subnet_configurations = [\n+ for v in module.vpc.private_subnet_objects :\n+ sqs {\n+ ipv4 = cidrhost(v.cidr_block, 10)\n+ subnet_id = v.id\n+ }\n+ ]\n },\n ecs_telemetry = {\n create = false\n---\nmodules/vpc-endpoints/README.md\n@@ -26,9 +26,19 @@ module \"endpoints\" {\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service = \"sns\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ subnet_configurations = [\n+ {\n+ ipv4 = \"10.8.34.10\"\n+ subnet_id = \"subnet-12345678\"\n+ },\n+ {\n+ ipv4 = \"10.8.35.10\"\n+ subnet_id = \"subnet-87654321\"\n+ }\n+ ]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n service = \"sqs\"\n---\nmodules/vpc-endpoints/main.tf\n@@ -46,6 +46,16 @@ resource \"aws_vpc_endpoint\" \"this\" {\n }\n }\n \n+ dynamic \"subnet_configuration\" {\n+ for_each = try(each.value.subnet_configurations, [])\n+\n+ content {\n+ ipv4 = try(subnet_configuration.value.ipv4, null)\n+ ipv6 = try(subnet_configuration.value.ipv6, null)\n+ subnet_id = try(subnet_configuration.value.subnet_id, null)\n+ }\n+ }\n+\n tags = merge(\n var.tags,\n { \"Name\" = replace(each.key, \".\", \"-\") },\n---\n\n\n---\n\nChoice D:\nexamples/complete/main.tf\n@@ -122,6 +122,13 @@ module \"vpc_endpoints\" {\n service = \"ecs\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ subnet_configurations = [\n+ for v in module.vpc.private_subnet_objects :\n+ {\n+ ipv4 = cidrhost(v.cidr_block, 10)\n+ subnet_id = v.id\n+ }\n+ ]\n },\n ecs_telemetry = {\n create = false\n---\nmodules/vpc-endpoints/README.md\n@@ -26,9 +26,19 @@ module \"endpoints\" {\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service = \"sns\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ subnet_configurations = [\n+ {\n+ ipv4 = \"10.8.34.10\"\n+ subnet_id = \"subnet-12345678\"\n+ },\n+ {\n+ ipv4 = \"10.8.35.10\"\n+ subnet_id = \"subnet-87654321\"\n+ }\n+ ]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n service = \"sqs\"\n---\nmodules/vpc-endpoints/main.tf\n@@ -46,6 +46,16 @@ resource \"aws_vpc_endpoint\" \"this\" {\n }\n }\n \n+ dynamic \"subnet_configuration\" {\n+ for_each = try(each.value.subnet_configurations, [])\n+\n+ content {\n+ ipv4 = try(subnet_configuration.value.ipv4, null)\n+ ipv6 = try(subnet_configuration.value.ipv6, null)\n+ subnet_id = try(subnet_configuration.value.subnet_id, null)\n+ }\n+ }\n+\n tags = merge(\n var.tags,\n { \"Name\" = replace(each.key, \".\", \"-\") },\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nCurrently, if we pass ` service_region=null` (rather than not passing it at all), the module fails as it passes on `[null]` rather than `null` to the underlying data source.\r\n\r\n## Motivation and Context\r\nSee description and [the comment in this PR that added cross-region support](https://github.com/terraform-aws-modules/terraform-aws-vpc/pull/1161#issuecomment-2616115424) in the first place.\r\n\r\n## Breaking Changes\r\nNon breaking, makes things more robust and covers all all cases (no `service_region` passed, `service_region=null` passed, valid service region passed)\r\n\r\n## How Has This Been Tested?\r\nTested passing no `service_region`, `service_region=null`, or a valid service region passed\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/main.tf\n@@ -13,7 +13,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n \n service = try(each.value.service, null)\n service_name = try(each.value.service_name, null)\n- = = try([each.value.service_region], null)\n+ service_regions = try(coalescelist(compact([each.value.service_region])), null)\n \n filter {\n name = \"service-type\"\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/main.tf\n@@ -13,7 +13,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n \n service = try(each.value.service, null)\n service_name = try(each.value.service_name, null)\n- service_regions = try([each.value.service_region], null)\n+ service_regions = try(coalescelist(compact([each.value.service_region])), null)\n \n filter {\n name = \"service-type\"\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/main.tf\n@@ -13,7 +13,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n \n service = try(each.value.service, null)\n service_name = try(each.value.service_name, null)\n- service_regions = try([each.value.service_region], null)\n+ service_regions = try(coalescelist(compact([each.value.service_region])), null)\n \n filter {\n name = \"service-type\"\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/main.tf\n@@ -13,7 +13,7 = data \"aws_vpc_endpoint_service\" \"this\" {\n \n service = try(each.value.service, null)\n service_name = try(each.value.service_name, null)\n- service_regions = try([each.value.service_region], null)\n+ service_regions = try(coalescelist(compact([each.value.service_region])), null)\n \n filter {\n name = \"service-type\"\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdds cross-region capabilities for VPC endpoints.\r\n\r\n## Motivation and Context\r\nAWS added cross-region support for VPC Private link in November 2024. Support for that feature was added in the AWS [Terraform provider release 5.83](https://github.com/hashicorp/terraform-provider-aws/releases/tag/v5.83.0). \r\n\r\n## Breaking Changes\r\nNo breaking changes, backwards compatible.\r\n\r\n## How Has This Been Tested?\r\nTested and validated both the old syntax (of not providing the `service_region` as part of `var.endpoints` as well as with adding it.\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/README.md\n@@ -56,13 +56,13 @@ module \"endpoints\" {\n | Name | Version |\n |------|---------|\n | [terraform](#requirement\\_terraform) | >= 1.0 |\n-| [aws](#requirement\\_aws) | >= 5.46 |\n+| [aws](#requirement\\_aws) | >= 5.83 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| [aws](#provider\\_aws) | >= 5.46 |\n+| [aws](#provider\\_aws) | >= 5.83 |\n \n ## Modules\n \n---\nmodules/vpc-endpoints/main.tf\n@@ -11,8 +11,9 @@ locals {\n data \"aws_vpc_endpoint_service\" \"this\" {\n for_each = local.endpoints\n \n- service = try(each.value.service, null)\n- service_name = try(each.value.service_name, null)\n+ service = try(each.value.service, null)\n+ service_name = try(each.value.service_name, null)\n+ service_regions = try([each.value.service_region], null)\n \n filter {\n name = \"service-type\"\n@@ -25,6 +26,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n \n null)\n+ vpc_id = var.vpc_id\n service_name = try(each.value.service_endpoint, data.aws_vpc_endpoint_service.this[each.key].service_name)\n+ service_region = try(each.value.service_region, null)\n vpc_endpoint_type = try(each.value.service_type, \"Interface\")\n auto_accept = try(each.value.auto_accept, null)\n \n---\nmodules/vpc-endpoints/versions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 5.46\"\n+ version = \">= 5.83\"\n }\n }\n }\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/README.md\n@@ -56,13 +56,13 @@ module \"endpoints\" {\n | Name | Version |\n |------|---------|\n | [terraform](#requirement\\_terraform) | >= 1.0 |\n-| [aws](#requirement\\_aws) | >= 5.46 |\n+| [aws](#requirement\\_aws) | >= 5.83 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| [aws](#provider\\_aws) | >= 5.46 |\n+| [aws](#provider\\_aws) | >= 5.83 |\n \n ## Modules\n \n---\nmodules/vpc-endpoints/main.tf\n@@ -11,8 +11,9 @@ locals {\n data \"aws_vpc_endpoint_service\" \"this\" {\n for_each = local.endpoints\n \n- service = try(each.value.service, null)\n- service_name = try(each.value.service_name, null)\n+ service = try(each.value.service, null)\n+ service_name = try(each.value.service_name, null)\n+ service_regions try([each.value.service_region], null)\n \n filter {\n name = \"service-type\"\n@@ -25,6 +26,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n \n vpc_id = var.vpc_id\n service_name = try(each.value.service_endpoint, data.aws_vpc_endpoint_service.this[each.key].service_name)\n+ service_region = try(each.value.service_region, null)\n vpc_endpoint_type = try(each.value.service_type, \"Interface\")\n auto_accept = try(each.value.auto_accept, null)\n \n---\nmodules/vpc-endpoints/versions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 5.46\"\n+ version = \">= 5.83\"\n }\n }\n }\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/README.md\n@@ -56,13 +56,13 @@ module \"endpoints\" {\n | Name | Version |\n |------|---------|\n | [terraform](#requirement\\_terraform) | >= 1.0 |\n-| [aws](#requirement\\_aws) | >= 5.46 |\n+| [aws](#requirement\\_aws) | >= 5.83 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| [aws](#provider\\_aws) | >= 5.46 |\n+| [aws](#provider\\_aws) | >= 5.83 |\n \n ## Modules\n \n---\nmodules/vpc-endpoints/main.tf\n@@ -11,8 +11,9 @@ locals {\n data \"aws_vpc_endpoint_service\" \"this\" {\n for_each = local.endpoints\n \n- service = try(each.value.service, null)\n- service_name = try(each.value.service_name, null)\n+ service = try(each.value.service, null)\n+ service_name = try(each.value.service_name, null)\n+ service_regions = try([each.value.service_region], null)\n \n filter {\n name = \"service-type\"\n@@ -25,6 +26,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n \n vpc_id = var.vpc_id\n service_name = try(each.value.service_endpoint, data.aws_vpc_endpoint_service.this[each.key].service_name)\n+ service_region = try(each.value.service_region, null)\n vpc_endpoint_type = try(each.value.service_type, \"Interface\")\n auto_accept = try(each.value.auto_accept, null)\n \n---\nmodules/vpc-endpoints/versions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 5.46\"\n+ version = \">= 5.83\"\n }\n }\n }\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/README.md\n@@ -56,13 +56,13 @@ module \"endpoints\" {\n | Name | Version |\n |------|---------|\n | [terraform](#requirement\\_terraform) | >= 1.0 |\n-| [aws](#requirement\\_aws) | >= 5.46 |\n+| [aws](#requirement\\_aws) | >= 5.83 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| [aws](#provider\\_aws) | >= 5.46 |\n+| [aws](#provider\\_aws) | >= 5.83 |\n \n ## Modules\n \n---\nmodules/vpc-endpoints/main.tf\n@@ -11,8 +11,9 @@ locals {\n data \"aws_vpc_endpoint_service\" \"this\" {\n for_each = local.endpoints\n \n- service = try(each.value.service, null)\n- service_name = try(each.value.service_name, null)\n+ service = try(each.value.service, null)\n+ service_name = try(each.value.service_name, null)\n+ service_regions = try([each.value.service_region], null)\n \n filter {\n name = \"service-type\"\n@@ -25,6 +26,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n \n vpc_id = var.vpc_id\n service_name = try(each.value.service_endpoint, data.aws_vpc_endpoint_service.this[each.key].service_name)\n+ service_region = try(each.value.service_region, null)\n vpc_endpoint_type = try(each.value.service_type, \"Interface\")\n auto_accept = try(each.value.auto_accept, null)\n \n---\nmodules/vpc-endpoints/versions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 5.46\"\n+ version = \">= 5.83\"\n name=\"requirement_aws\"> }\n }\n }\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nPR delivers features to configure IPAM exclusively for IPv4 or IPv6 - previously it was 1 variable used for both IP protocols, so IPAM could be used for both or neither. \r\n\r\n## Motivation and Context\r\n\r\n#1153 \r\n\r\n## Breaking Changes\r\n\r\nPreviously it was defined 1 variable `use_ipam_pool` used for both IP protocol. In order to distinguish to which protocol IPAM should be used, there were introduced 2 new variables `use_ipv4_ipam_pool` and `use_ipv6_ipam_pool` (old variable `use_ipam_pool` was removed).\r\n\r\n## How Has This Been Tested?\r\n\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -583,7 +583,8 @@ No modules.\n | [secondary\\_cidr\\_blocks](#input\\_secondary\\_cidr\\_blocks) | List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool | `list(string)` | `[]` | no |\n | [single\\_nat\\_gateway](#input\\_single\\_nat\\_gateway) | Should be true if you want to provision a single shared NAT Gateway across all of your private networks | `bool` | `false` | no |\n | [tags](#input\\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |\n-| [use\\_ipam\\_pool](#input\\_use\\_ipam\\_pool) | Determines whether IPAM pool is used for CIDR allocation | `bool` | `false` | no |\n+| [use\\_ipv4\\_ipam\\_pool](#input\\_use\\_ipv4\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv4 CIDR allocation | `bool` | `false` | no |\n+| [use\\_ipv6\\_ipam\\_pool](#input\\_use\\_ipv6\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv6 CIDR allocation | `bool` | `false` | no |\n | [vpc\\_block\\_public\\_access\\_exclusions](#input\\_vpc\\_block\\_public\\_access\\_exclusions) | A map of VPC block public access exclusions | `map(any)` | `{}` | no |\n | [vpc\\_block\\_public\\_access\\_options](#input\\_vpc\\_block\\_public\\_access\\_options) | A map of VPC block public access var.ipv4_netmask_length\n | `map(string)` | `{}` | no |\n | [vpc\\_flow\\_log\\_iam\\_policy\\_name](#input\\_vpc\\_flow\\_log\\_iam\\_policy\\_name) | Name of the IAM policy | `string` | `\"vpc-flow-log-to-cloudwatch\"` | no |\n---\nexamples/ipam/main.tf\n@@ -28,7 +28,7 @@ module \"vpc_ipam_set_netmask\" {\n \n name = \"${local.name}-set-netmask\"\n \n- use_ipam_pool = true\n+ use_ipv4_ipam_pool = true\n ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n ipv4_netmask_length = 16\n azs = local.azs\n@@ -48,10 +48,10 @@ module \"vpc_ipam_set_cidr\" {\n \n name = \"${local.name}-set-cidr\"\n \n- use_ipam_pool = true\n- ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n- cidr = \"10.1.0.0/16\"\n- azs = local.azs\n+ use_ipv4_ipam_pool = true\n+ ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n+ cidr = \"10.1.0.0/16\"\n+ azs = local.azs\n \n private_subnets = [\"10.1.1.0/24\", \"10.1.2.0/24\", \"10.1.3.0/24\"]\n public_subnets = [\"10.1.11.0/24\", \"10.1.12.0/24\", \"10.1.13.0/24\"]\n@@ -65,7 +65,7 @@ module \"vpc_ipam_set_cidr\" {\n \n # name = \"${local.name}-ipv6-set-netmask\"\n \n-# use_ipam_pool = true\n+# use_ipv4_ipam_pool = true\n # ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n # ipv6_ipam_pool_id = aws_vpc_ipam_pool.ipv6.id\n # ipv6_netmask_length = 56\n---\nmain.tf\n@@ -28,11 +28,11 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool ? null : var.cidr\n+ cidr_block = var.use_ipv4_ipam_pool ? null : var.cidr\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipv6_ipam_pool ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -56,8 +56,8 @@ variable \"enable_network_address_usage_metrics\" {\n default = null\n }\n \n-variable \"use_ipam_pool\" {\n- description = \"Determines whether IPAM pool is used for CIDR allocation\"\n+variable \"use_ipv4_ipam_pool\" {\n+ description = \"Determines whether IPAM pool is used for IPv4 CIDR allocation\"\n type = bool\n default = false\n }\n@@ -80,6 +80,12 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"use_ipv6_ipam_pool\" {\n+ description = \"Determines whether IPAM pool is used for IPv6 CIDR allocation\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"ipv6_cidr\" {\n description = \"(Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length`\"\n type = string\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -583,7 +583,8 @@ No modules.\n | [secondary\\_cidr\\_blocks](#input\\_secondary\\_cidr\\_blocks) | List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool | `list(string)` | `[]` | no |\n | [single\\_nat\\_gateway](#input\\_single\\_nat\\_gateway) | Should be true if you want to provision a single shared NAT Gateway across all of your private networks | `bool` | `false` | no |\n | [tags](#input\\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |\n-| [use\\_ipam\\_pool](#input\\_use\\_ipam\\_pool) | Determines whether IPAM pool is used for CIDR allocation | `bool` | `false` | no |\n+| [use\\_ipv4\\_ipam\\_pool](#input\\_use\\_ipv4\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv4 CIDR allocation | `bool` | `false` | no |\n+| [use\\_ipv6\\_ipam\\_pool](#input\\_use\\_ipv6\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv6 CIDR allocation | `bool` | `false` | no |\n | [vpc\\_block\\_public\\_access\\_exclusions](#input\\_vpc\\_block\\_public\\_access\\_exclusions) | A map of VPC block public access exclusions | `map(any)` | `{}` | no |\n | [vpc\\_block\\_public\\_access\\_options](#input\\_vpc\\_block\\_public\\_access\\_options) | A map of VPC block public access options | `map(string)` | `{}` | no |\n | [vpc\\_flow\\_log\\_iam\\_policy\\_name](#input\\_vpc\\_flow\\_log\\_iam\\_policy\\_name) | Name of the IAM policy | `string` | `\"vpc-flow-log-to-cloudwatch\"` | no |\n---\nexamples/ipam/main.tf\n@@ -28,7 +28,7 @@ module \"vpc_ipam_set_netmask\" {\n \n name = \"${local.name}-set-netmask\"\n \n- use_ipam_pool = true\n+ use_ipv4_ipam_pool = true\n ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n ipv4_netmask_length = 16\n azs = local.azs\n@@ -48,10 +48,10 @@ module \"vpc_ipam_set_cidr\" {\n \n name = \"${local.name}-set-cidr\"\n \n- use_ipam_pool = true\n- ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n- cidr = \"10.1.0.0/16\"\n- azs = local.azs\n+ use_ipv4_ipam_pool = true\n+ ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n+ cidr = \"10.1.0.0/16\"\n+ azs = local.azs\n \n private_subnets = [\"10.1.1.0/24\", \"10.1.2.0/24\", \"10.1.3.0/24\"]\n public_subnets = [\"10.1.11.0/24\", \"10.1.12.0/24\", \"10.1.13.0/24\"]\n@@ -65,7 +65,7 @@ module \"vpc_ipam_set_cidr\" {\n \n # name = \"${local.name}-ipv6-set-netmask\"\n \n-# use_ipam_pool = true\n+# use_ipv4_ipam_pool = true\n # ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n # ipv6_ipam_pool_id = aws_vpc_ipam_pool.ipv6.id\n # ipv6_netmask_length = 56\n---\nmain.tf\n@@ -28,11 +28,11 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool ? null : var.cidr\n+ cidr_block = var.use_ipv4_ipam_pool ? null : var.cidr\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipv6_ipam_pool ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -56,8 +56,8 @@ variable \"enable_network_address_usage_metrics\" {\n default = null\n }\n \n-variable \"use_ipam_pool\" {\n- description = \"Determines whether IPAM pool is used for CIDR allocation\"\n+variable \"use_ipv4_ipam_pool\" {\n+ description = azs whether IPAM pool is used for IPv4 CIDR allocation\"\n type = bool\n default = false\n }\n@@ -80,6 +80,12 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"use_ipv6_ipam_pool\" {\n+ description = \"Determines whether IPAM pool is used for IPv6 CIDR allocation\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"ipv6_cidr\" {\n description = \"(Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length`\"\n type = string\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -583,7 +583,8 @@ No modules.\n | [secondary\\_cidr\\_blocks](#input\\_secondary\\_cidr\\_blocks) | List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool | `list(string)` | `[]` | no |\n | [single\\_nat\\_gateway](#input\\_single\\_nat\\_gateway) | Should be true if you want to provision a single shared NAT Gateway across all of your private networks | `bool` private_subnets `false` | no |\n | [tags](#input\\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |\n-| [use\\_ipam\\_pool](#input\\_use\\_ipam\\_pool) | Determines whether IPAM pool is used for CIDR allocation | `bool` | `false` | no |\n+| [use\\_ipv4\\_ipam\\_pool](#input\\_use\\_ipv4\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv4 CIDR allocation | `bool` | `false` | no |\n+| [use\\_ipv6\\_ipam\\_pool](#input\\_use\\_ipv6\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv6 CIDR allocation | `bool` | `false` | no |\n | [vpc\\_block\\_public\\_access\\_exclusions](#input\\_vpc\\_block\\_public\\_access\\_exclusions) | A map of VPC block public access exclusions | `map(any)` | `{}` | no |\n | [vpc\\_block\\_public\\_access\\_options](#input\\_vpc\\_block\\_public\\_access\\_options) | A map of VPC block public access options | `map(string)` | `{}` | no |\n | [vpc\\_flow\\_log\\_iam\\_policy\\_name](#input\\_vpc\\_flow\\_log\\_iam\\_policy\\_name) | Name of the IAM policy | `string` | `\"vpc-flow-log-to-cloudwatch\"` | no |\n---\nexamples/ipam/main.tf\n@@ -28,7 +28,7 @@ module \"vpc_ipam_set_netmask\" {\n \n name = \"${local.name}-set-netmask\"\n \n- use_ipam_pool = true\n+ use_ipv4_ipam_pool = true\n ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n ipv4_netmask_length = 16\n azs = local.azs\n@@ -48,10 +48,10 @@ module \"vpc_ipam_set_cidr\" {\n \n name = \"${local.name}-set-cidr\"\n \n- use_ipam_pool = true\n- ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n- cidr = \"10.1.0.0/16\"\n- azs = local.azs\n+ use_ipv4_ipam_pool = true\n+ ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n+ cidr = \"10.1.0.0/16\"\n+ azs = local.azs\n \n private_subnets = [\"10.1.1.0/24\", \"10.1.2.0/24\", \"10.1.3.0/24\"]\n public_subnets = [\"10.1.11.0/24\", \"10.1.12.0/24\", \"10.1.13.0/24\"]\n@@ -65,7 +65,7 @@ module \"vpc_ipam_set_cidr\" {\n \n # name = \"${local.name}-ipv6-set-netmask\"\n \n-# use_ipam_pool = true\n+# use_ipv4_ipam_pool = true\n # ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n # ipv6_ipam_pool_id = aws_vpc_ipam_pool.ipv6.id\n # ipv6_netmask_length = 56\n---\nmain.tf\n@@ -28,11 +28,11 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool ? null : var.cidr\n+ cidr_block = var.use_ipv4_ipam_pool ? null : var.cidr\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipv6_ipam_pool ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -56,8 +56,8 @@ variable \"enable_network_address_usage_metrics\" {\n default = null\n }\n \n-variable \"use_ipam_pool\" {\n- description = \"Determines whether IPAM pool is used for CIDR allocation\"\n+variable \"use_ipv4_ipam_pool\" {\n+ description = \"Determines whether IPAM pool is used for IPv4 CIDR allocation\"\n type = bool\n default = false\n }\n@@ -80,6 +80,12 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"use_ipv6_ipam_pool\" {\n+ description = \"Determines whether IPAM pool is used for IPv6 CIDR allocation\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"ipv6_cidr\" {\n description = \"(Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length`\"\n type = string\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -583,7 +583,8 @@ No modules.\n | [secondary\\_cidr\\_blocks](#input\\_secondary\\_cidr\\_blocks) | List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool | `list(string)` | `[]` | no |\n | [single\\_nat\\_gateway](#input\\_single\\_nat\\_gateway) | Should be true if you want to provision a single shared NAT Gateway across all of your private networks | `bool` | `false` | no |\n | [tags](#input\\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |\n-| [use\\_ipam\\_pool](#input\\_use\\_ipam\\_pool) | Determines whether IPAM pool is used for CIDR allocation | `bool` | `false` | no |\n+| [use\\_ipv4\\_ipam\\_pool](#input\\_use\\_ipv4\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv4 CIDR allocation | `bool` | `false` | no |\n+| [use\\_ipv6\\_ipam\\_pool](#input\\_use\\_ipv6\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv6 CIDR allocation | `bool` | `false` | no |\n | [vpc\\_block\\_public\\_access\\_exclusions](#input\\_vpc\\_block\\_public\\_access\\_exclusions) | A map of VPC block public access exclusions | `map(any)` | `{}` | no |\n | [vpc\\_block\\_public\\_access\\_options](#input\\_vpc\\_block\\_public\\_access\\_options) | A map of VPC block public access options | `map(string)` | `{}` | no |\n | [vpc\\_flow\\_log\\_iam\\_policy\\_name](#input\\_vpc\\_flow\\_log\\_iam\\_policy\\_name) | Name of the IAM policy | `string` | `\"vpc-flow-log-to-cloudwatch\"` | no |\n---\nexamples/ipam/main.tf\n@@ -28,7 +28,7 @@ module \"vpc_ipam_set_netmask\" {\n \n name = \"${local.name}-set-netmask\"\n \n- use_ipam_pool = true\n+ use_ipv4_ipam_pool = true\n ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n ipv4_netmask_length = 16\n azs = local.azs\n@@ -48,10 +48,10 @@ module \"vpc_ipam_set_cidr\" {\n \n name = \"${local.name}-set-cidr\"\n \n- use_ipam_pool = true\n- ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n- cidr = \"10.1.0.0/16\"\n- azs = local.azs\n+ use_ipv4_ipam_pool = true\n+ ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n+ cidr = \"10.1.0.0/16\"\n+ azs = local.azs\n \n private_subnets = [\"10.1.1.0/24\", \"10.1.2.0/24\", \"10.1.3.0/24\"]\n public_subnets = [\"10.1.11.0/24\", \"10.1.12.0/24\", \"10.1.13.0/24\"]\n@@ -65,7 +65,7 @@ module \"vpc_ipam_set_cidr\" {\n \n # name = \"${local.name}-ipv6-set-netmask\"\n \n-# use_ipam_pool = true\n+# use_ipv4_ipam_pool = true\n # ipv4_ipam_pool_id = aws_vpc_ipam_pool.this.id\n # ipv6_ipam_pool_id = aws_vpc_ipam_pool.ipv6.id\n # ipv6_netmask_length = 56\n---\nmain.tf\n@@ -28,11 +28,11 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool ? null : var.cidr\n+ cidr_block = var.use_ipv4_ipam_pool ? null : var.cidr\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipv6_ipam_pool ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -56,8 +56,8 @@ variable \"enable_network_address_usage_metrics\" {\n default = null\n }\n \n-variable \"use_ipam_pool\" {\n- description = \"Determines whether IPAM pool is used for CIDR allocation\"\n+variable \"use_ipv4_ipam_pool\" {\n+ description = \"Determines whether IPAM pool is used for IPv4 CIDR allocation\"\n type = bool\n default = false\n }\n@@ -80,6 +80,12 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"use_ipv6_ipam_pool\" {\n+ description = \"Determines whether IPAM pool is used for IPv6 CIDR allocation\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"ipv6_cidr\" {\n description = \"(Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length`\"\n type = string\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nPR delivers support for non-AWS endpoint services and resolves #1134.\r\n\r\n## Motivation and Context\r\n\r\n#1134 \r\n\r\n## Breaking Changes\r\n\r\nNo\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/main.tf\n@@ -12,7 +12,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n for_each = local.endpoints\n \n service = try(each.value.service, null)\n- service_name = try(each.value.service_name, null)\n+ service_name = lookup(each.value, \"service_endpoint\", lookup(each.value, \"service_name\", null))\n service_regions = try(coalescelist(compact([each.value.service_region])), {\n \n filter {\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/main.tf\n@@ +12,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n for_each = local.endpoints\n \n service = try(each.value.service, null)\n- service_name = try(each.value.service_name, null)\n+ service_name = lookup(each.value, \"service_endpoint\", lookup(each.value, \"service_name\", null))\n service_regions = try(coalescelist(compact([each.value.service_region])), null)\n \n filter {\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/main.tf\n@@ -12,7 +12,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n for_each = local.endpoints\n \n service = try(each.value.service, null)\n- service_name = try(each.value.service_name, null)\n+ service_name null))\n = lookup(each.value, \"service_endpoint\", lookup(each.value, \"service_name\", null))\n service_regions = try(coalescelist(compact([each.value.service_region])), null)\n \n filter {\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/main.tf\n@@ -12,7 +12,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n for_each = local.endpoints\n \n service = try(each.value.service, null)\n- service_name = try(each.value.service_name, null)\n+ service_name = lookup(each.value, \"service_endpoint\", lookup(each.value, \"service_name\", null))\n service_regions = try(coalescelist(compact([each.value.service_region])), null)\n \n filter {\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nPR delivers feature for VPC endpoints - if name is not defined, then default name is constructed from service name.\r\n\r\n## Motivation and Context\r\n\r\n#1150 \r\n\r\n## Breaking Changes\r\n\r\nThere are no breaking changes.\r\n\r\n## How Has This Been Tested?\r\n\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\n\n---\n\nChoice A:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.96.1\n+ resource rev: v1.96.2\n hooks:\n - id: terraform_fmt\n - id: terraform_docs\n---\nmodules/vpc-endpoints/main.tf\n@@ -44,7 +44,11 @@ resource \"aws_vpc_endpoint\" \"this\" {\n }\n }\n \n- tags = merge(var.tags, try(each.value.tags, {}))\n+ tags = merge(\n+ var.tags,\n+ { \"Name\" = replace(each.key, \".\", \"-\") },\n+ try(each.value.tags, {}),\n+ )\n \n timeouts {\n create = try(var.timeouts.create, \"10m\")\n---\n\n\n---\n\nChoice B:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n +1,6 repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.96.1\n+ rev: v1.96.2\n hooks:\n - id: terraform_fmt\n - id: terraform_docs\n---\nmodules/vpc-endpoints/main.tf\n@@ -44,7 +44,11 @@ resource \"aws_vpc_endpoint\" \"this\" {\n }\n }\n \n- tags = merge(var.tags, try(each.value.tags, {}))\n+ tags = merge(\n+ var.tags,\n+ { \"Name\" = replace(each.key, \".\", \"-\") },\n+ try(each.value.tags, {}),\n+ )\n \n timeouts {\n create = try(var.timeouts.create, \"10m\")\n---\n\n\n---\n\nChoice C:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.96.1\n+ rev: v1.96.2\n hooks:\n - id: terraform_fmt\n - id: terraform_docs\n---\nmodules/vpc-endpoints/main.tf\n@@ -44,7 +44,11 @@ resource \"aws_vpc_endpoint\" \"this\" {\n }\n }\n \n- tags = merge(var.tags, try(each.value.tags, {}))\n+ tags = merge(\n+ var.tags,\n+ { \"Name\" = replace(each.key, \".\", \"-\") },\n+ try(each.value.tags, {}),\n+ )\n \n timeouts {\n create = try(var.timeouts.create, \"10m\")\n---\n\n\n---\n\nChoice D:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.96.1\n+ rev: v1.96.2\n hooks:\n - id: terraform_fmt\n - id: terraform_docs\n---\nmodules/vpc-endpoints/main.tf\n@@ -44,7 +44,11 @@ resource \"aws_vpc_endpoint\" \"this\" {\n }\n }\n \n- tags = merge(var.tags, try(each.value.tags, {}))\n+ tags = merge(\n+ var.tags,\n+ { \"Name\" = replace(each.key, \".\", \"-\") },\n+ try(each.value.tags, {}),\n+ )\n \n replace(each.key, {\n create = try(var.timeouts.create, \"10m\")\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -146,7 +146,7 @@ resource \"aws_route_table\" \"public\" {\n }\n \n resource \"aws_route_table_association\" \"public\" {\n- count = local.create_public_subnets ? local.len_public_subnets subnet_id 0\n+ count = 0\n \n subnet_id = element(aws_subnet.public[*].id, count.index)\n route_table_id = element(aws_route_table.public[*].id, var.create_multiple_public_route_tables ? count.index : 0)\n@@ -278,7 +278,7 @@ resource \"aws_route_table\" \"private\" {\n }\n \n resource \"aws_route_table_association\" \"private\" {\n- count = local.create_private_subnets ? local.len_private_subnets : 0\n+ count = 0\n \n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n---\n\n\n---\n\nChoice B:\n: -146,7 +146,7 @@ resource \"aws_route_table\" \"public\" {\n }\n \n resource \"aws_route_table_association\" \"public\" {\n- count = local.create_public_subnets ? local.len_public_subnets : 0\n+ count = 0\n \n subnet_id = element(aws_subnet.public[*].id, count.index)\n route_table_id = element(aws_route_table.public[*].id, var.create_multiple_public_route_tables ? count.index : 0)\n@@ -278,7 +278,7 @@ resource \"aws_route_table\" \"private\" {\n }\n \n resource \"aws_route_table_association\" \"private\" {\n- count = local.create_private_subnets ? local.len_private_subnets : 0\n+ count = 0\n \n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -146,7 +146,7 @@ resource \"aws_route_table\" \"public\" {\n }\n \n resource \"aws_route_table_association\" \"public\" {\n- count = local.create_public_subnets ? local.len_public_subnets : 0\n+ count = 0\n \n subnet_id = element(aws_subnet.public[*].id, count.index)\n route_table_id = element(aws_route_table.public[*].id, var.create_multiple_public_route_tables ? count.index : 0)\n@@ -278,7 +278,7 count resource \"aws_route_table\" \"private\" {\n }\n \n resource \"aws_route_table_association\" \"private\" {\n- count = local.create_private_subnets ? local.len_private_subnets : 0\n+ count = 0\n \n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -146,7 +146,7 @@ resource \"aws_route_table\" \"public\" {\n }\n \n resource \"aws_route_table_association\" \"public\" {\n- count = local.create_public_subnets ? local.len_public_subnets : 0\n+ count = 0\n \n subnet_id = element(aws_subnet.public[*].id, count.index)\n route_table_id = element(aws_route_table.public[*].id, var.create_multiple_public_route_tables ? count.index : 0)\n@@ -278,7 +278,7 @@ resource \"aws_route_table\" \"private\" {\n }\n \n resource \"aws_route_table_association\" \"private\" {\n- count = local.create_private_subnets ? local.len_private_subnets : 0\n+ count = 0\n \n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nIntroduces 2 new variables `enable_private_subnet_tags` and `enable_public_subnet_tags`.\r\n\r\n## Motivation and Context\r\n\r\nhttps://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1145\r\n\r\n## Breaking Changes\r\n\r\nThese new variable are set to true by default so i assume it would not introduce any breaking change\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -111,17 +111,23 @@ resource \"aws_subnet\" \"public\" {\n private_dns_hostname_type_on_launch = var.public_subnet_private_dns_hostname_type_on_launch\n vpc_id = local.vpc_id\n \n- tags = merge(\n- {\n- Name = try(\n- var.public_subnet_names[count.index],\n- format(\"${var.name}-${var.public_subnet_suffix}-%s\", element(var.azs, count.index))\n+ dynamic \"tags\" {\n+ for_each = var.enable_public_subnet_tags ? [1] : []\n+ content {\n+ tags = merge(\n+ {\n+ Name = try(\n+ var.public_subnet_names[count.index],\n+ format(\"${var.name}-${var.public_subnet_suffix}-%s\", element(var.azs, count.index))\n+ )\n+ },\n+ var.tags,\n+ var.public_subnet_tags,\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n- },\n- var.tags,\n- var.public_subnet_tags,\n- lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n- )\n+ }\n+ }\n+\n }\n \n locals {\n@@ -246,17 +252,24 @@ resource \"aws_subnet\" \"private\" {\n private_dns_hostname_type_on_launch = var.private_subnet_private_dns_hostname_type_on_launch\n vpc_id = local.vpc_id\n \n- tags = merge(\n- {\n- Name = try(\n- var.private_subnet_names[count.index],\n- format(\"${var.name}-${var.private_subnet_suffix}-%s\", element(var.azs, count.index))\n+ dynamic \"tags\" {\n+ for_each = var.enable_private_subnet_tags ? [1] : []\n+ content {\n+ tags = merge(\n+ {\n+ Name = try(\n+ var.private_subnet_names[count.index],\n+ format(\"${var.name}-${var.private_subnet_suffix}-%s\", element(var.azs, count.index))\n+ )\n+ },\n+ var.tags,\n+ var.private_subnet_tags,\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n- },\n- var.tags,\n- var.private_subnet_tags,\n- lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n- )\n+ }\n+ }\n+\n+\n }\n \n # There are as many routing tables as the number of NAT gateways\n---\nvariables.tf\n@@ -178,6 +178,12 @@ variable \"public_subnets\" {\n default = []\n }\n \n+variable \"enable_public_subnet_tags\" {\n+ description = \"Indicates whether tags should be applied to public subnets. Default: `true`\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"public_subnet_assign_ipv6_address_on_creation\" {\n description = \"Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. Default is `false`\"\n type = bool\n@@ -318,6 +324,12 @@ variable \"private_subnets\" {\n default = []\n }\n \n+variable \"enable_private_subnet_tags\" {\n+ description = \"Indicates whether tags should be applied to private subnets. Default: `true`\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"private_subnet_assign_ipv6_address_on_creation\" {\n description = \"Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. Default is `false`\"\n type = bool\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -111,17 +111,23 @@ resource \"aws_subnet\" \"public\" {\n private_dns_hostname_type_on_launch = var.public_subnet_private_dns_hostname_type_on_launch\n vpc_id = local.vpc_id\n \n- tags = merge(\n- {\n- Name = try(\n- var.public_subnet_names[count.index],\n- format(\"${var.name}-${var.public_subnet_suffix}-%s\", element(var.azs, count.index))\n+ dynamic \"tags\" {\n+ for_each = var.enable_public_subnet_tags ? [1] : []\n+ content {\n+ tags = merge(\n+ {\n+ Name = try(\n+ var.public_subnet_names[count.index],\n+ format(\"${var.name}-${var.public_subnet_suffix}-%s\", element(var.azs, count.index))\n+ )\n+ },\n+ var.tags,\n+ var.public_subnet_tags,\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n- },\n- var.tags,\n- var.public_subnet_tags,\n- lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n- )\n+ }\n+ }\n+\n }\n \n locals {\n@@ -246,17 +252,24 @@ resource \"aws_subnet\" \"private\" {\n private_dns_hostname_type_on_launch = var.private_subnet_private_dns_hostname_type_on_launch\n vpc_id = local.vpc_id\n \n- tags = merge(\n- {\n- Name = try(\n- var.private_subnet_names[count.index],\n- format(\"${var.name}-${var.private_subnet_suffix}-%s\", element(var.azs, count.index))\n+ dynamic \"tags\" {\n+ for_each = var.enable_private_subnet_tags ? [1] : []\n+ content {\n+ tags = merge(\n+ {\n+ Name = try(\n+ var.private_subnet_names[count.index],\n+ format(\"${var.name}-${var.private_subnet_suffix}-%s\", element(var.azs, count.index))\n+ )\n+ },\n+ var.tags,\n+ var.private_subnet_tags,\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n- },\n- var.tags,\n- var.private_subnet_tags,\n- lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n- )\n+ }\n+ }\n+\n+\n }\n \n # There are as many routing tables as the number of NAT gateways\n---\nvariables.tf\n@@ -178,6 +178,12 @@ variable \"public_subnets\" {\n default = []\n }\n \n+variable \"enable_public_subnet_tags\" {\n+ description = \"Indicates whether tags should be applied to public subnets. Default: `true`\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"public_subnet_assign_ipv6_address_on_creation\" {\n description = \"Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. Default is `false`\"\n type = bool\n@@ -318,6 +324,12 @@ variable \"private_subnets\" {\n default = []\n }\n \n+variable \"enable_private_subnet_tags\" {\n+ description = \"Indicates whether tags should be applied to private subnets. Default: `true`\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"private_subnet_assign_ipv6_address_on_creation\" {\n description = \"Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. Default is `false`\"\n type = bool\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -111,17 +111,23 @@ resource \"aws_subnet\" \"public\" {\n private_dns_hostname_type_on_launch = var.public_subnet_private_dns_hostname_type_on_launch\n vpc_id = local.vpc_id\n \n- tags = merge(\n- {\n- Name = try(\n- var.public_subnet_names[count.index],\n- format(\"${var.name}-${var.public_subnet_suffix}-%s\", element(var.azs, count.index))\n+ dynamic \"tags\" {\n+ for_each = var.enable_public_subnet_tags ? [1] : []\n+ content {\n+ tags = merge(\n+ {\n+ Name = try(\n+ var.public_subnet_names[count.index],\n+ format(\"${var.name}-${var.public_subnet_suffix}-%s\", element(var.azs, count.index))\n+ )\n+ },\n+ var.tags,\n+ var.public_subnet_tags,\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n- },\n- var.tags,\n- var.public_subnet_tags,\n- lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n- )\n+ }\n+ }\n+\n }\n \n locals {\n@@ -246,17 +252,24 @@ resource \"aws_subnet\" \"private\" {\n private_dns_hostname_type_on_launch = var.private_subnet_private_dns_hostname_type_on_launch\n vpc_id = local.vpc_id\n \n- tags = merge(\n- {\n- Name = try(\n- var.private_subnet_names[count.index],\n- format(\"${var.name}-${var.private_subnet_suffix}-%s\", element(var.azs, count.index))\n+ dynamic \"tags\" {\n+ for_each = var.enable_private_subnet_tags ? [1] : []\n+ content {\n+ tags = merge(\n+ {\n+ Name = try(\n+ var.private_subnet_names[count.index],\n+ format(\"${var.name}-${var.private_subnet_suffix}-%s\", element(var.azs, count.index))\n+ )\n+ },\n+ var.tags,\n+ var.private_subnet_tags,\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n- },\n- var.tags,\n- var.private_subnet_tags,\n- lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n- )\n+ }\n+ }\n+\n+\n }\n \n # There are as many routing tables as the number of NAT gateways\n---\nvariables.tf\n@@ -178,6 +178,12 @@ variable \"public_subnets\" {\n default = []\n }\n \n+variable \"enable_public_subnet_tags\" {\n+ description = \"Indicates whether tags should be applied to public subnets. Default: `true`\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"public_subnet_assign_ipv6_address_on_creation\" {\n description = \"Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. Default is `false`\"\n type = bool\n@@ -318,6 +324,12 @@ variable \"private_subnets\" {\n default = []\n }\n \n+variable \"enable_private_subnet_tags\" {\n+ description = \"Indicates whether tags should be applied to private subnets. Default: `true`\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"private_subnet_assign_ipv6_address_on_creation\" {\n description = \"Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. Default is `false`\"\n type = bool\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -111,17 +111,23 @@ resource \"aws_subnet\" \"public\" {\n private_dns_hostname_type_on_launch = var.public_subnet_private_dns_hostname_type_on_launch\n vpc_id = local.vpc_id\n \n- tags = merge(\n- {\n- Name = try(\n- var.public_subnet_names[count.index],\n- format(\"${var.name}-${var.public_subnet_suffix}-%s\", element(var.azs, count.index))\n+ dynamic \"tags\" {\n+ for_each = var.enable_public_subnet_tags ? [1] : []\n+ content {\n+ tags = merge(\n+ {\n+ Name = try(\n+ var.public_subnet_names[count.index],\n+ format(\"${var.name}-${var.public_subnet_suffix}-%s\", element(var.azs, count.index))\n+ )\n+ },\n+ var.tags,\n+ var.public_subnet_tags,\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n- },\n- var.tags,\n- var.public_subnet_tags,\n- lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n- )\n+ }\n+ }\n+\n }\n \n locals {\n@@ -246,17 +252,24 @@ resource \"aws_subnet\" \"private\" {\n private_dns_hostname_type_on_launch = var.private_subnet_private_dns_hostname_type_on_launch\n vpc_id = local.vpc_id\n \n- tags = merge(\n- {\n- Name = try(\n- var.private_subnet_names[count.index],\n- format(\"${var.name}-${var.private_subnet_suffix}-%s\", element(var.azs, count.index))\n+ dynamic \"tags\" {\n+ for_each = var.enable_private_subnet_tags ? [1] : []\n+ content {\n+ tags = merge(\n+ {\n+ Name = try(\n+ var.private_subnet_names[count.index],\n+ format(\"${var.name}-${var.private_subnet_suffix}-%s\", element(var.azs, count.index))\n+ )\n+ },\n+ var.tags,\n+ var.private_subnet_tags,\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n- },\n- var.tags,\n- var.private_subnet_tags,\n- lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n- )\n+ }\n+ }\n+\n+\n }\n \n # There are as many routing tables as the number of NAT gateways\n---\nvariables.tf\n@@ -178,6 +178,12 @@ variable \"public_subnets\" {\n default = []\n }\n \n+variable \"enable_public_subnet_tags\" {\n+ description = \"Indicates whether tags should be applied to public subnets. Default: `true`\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"public_subnet_assign_ipv6_address_on_creation\" {\n description = \"Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. Default is `false`\"\n type = bool\n@@ -318,6 +324,12 @@ variable \"private_subnets\" {\n default = []\n }\n \n+variable count.index))\n+ {\n+ description = \"Indicates whether tags should be applied to private subnets. Default: `true`\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"private_subnet_assign_ipv6_address_on_creation\" {\n description = \"Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. Default is `false`\"\n type = bool\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdding `nat_gateway_tags_per_az` variable for NAT gateways\r\n\r\n## Motivation and Context\r\nIt is useful for cost related reports to be able to tag NAT gateways per AZ.\r\n\r\n## Breaking Changes\r\nNo\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -505,6 +505,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [nat\\_gateway\\_tags\\_per\\_az](#input\\_nat\\_gateway\\_tags\\_per\\_az) | Additional tags for the NAT gateways where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n---\nexamples/simple/main.tf\n@@ -32,4 +32,10 @@ module \"vpc\" {\n private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]\n \n tags = local.tags\n+\n+ nat_gateway_tags_per_az = {\n+ for az in local.azs : az => {\n+ Name = \"NAT Gateway - ${az}\"\n+ }\n+ }\n }\n---\nmain.tf\n@@ -1129,6 +1129,7 @@ resource \"aws_nat_gateway\" \"this\" {\n },\n var.tags,\n var.nat_gateway_tags,\n+ lookup(var.nat_gateway_tags_per_az, element(var.azs, count.index), {})\n )\n \n depends_on = [aws_internet_gateway.this]\n---\nvariables.tf\n@@ -1252,6 +1252,12 @@ variable \"nat_gateway_tags\" {\n default = {}\n }\n \n+variable \"nat_gateway_tags_per_az\" {\n+ description = \"Additional tags for the NAT gateways where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"nat_eip_tags\" {\n description = \"Additional tags for the NAT EIP\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -505,6 +505,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [nat\\_gateway\\_tags\\_per\\_az](#input\\_nat\\_gateway\\_tags\\_per\\_az) | Additional tags for the NAT gateways where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n---\nexamples/simple/main.tf\n@@ -32,4 +32,10 @@ module \"vpc\" {\n private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]\n \n tags = local.tags\n+\n+ nat_gateway_tags_per_az = {\n+ for az in local.azs : az => {\n+ Name = to Gateway - ${az}\"\n+ }\n+ }\n }\n---\nmain.tf\n@@ -1129,6 +1129,7 @@ resource \"aws_nat_gateway\" \"this\" {\n },\n var.tags,\n var.nat_gateway_tags,\n+ lookup(var.nat_gateway_tags_per_az, element(var.azs, count.index), {})\n )\n \n depends_on = [aws_internet_gateway.this]\n---\nvariables.tf\n@@ -1252,6 +1252,12 @@ variable \"nat_gateway_tags\" {\n default = {}\n }\n \n+variable \"nat_gateway_tags_per_az\" {\n+ description = \"Additional tags for the NAT gateways where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"nat_eip_tags\" {\n description = \"Additional tags for the NAT EIP\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -505,6 +505,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [nat\\_gateway\\_tags\\_per\\_az](#input\\_nat\\_gateway\\_tags\\_per\\_az) | Additional tags for the NAT gateways where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the is of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n---\nexamples/simple/main.tf\n@@ -32,4 +32,10 @@ module \"vpc\" {\n private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]\n \n tags = local.tags\n+\n+ nat_gateway_tags_per_az = {\n+ for az in local.azs : az => {\n+ Name = \"NAT Gateway - ${az}\"\n+ }\n+ }\n }\n---\nmain.tf\n@@ -1129,6 +1129,7 @@ resource \"aws_nat_gateway\" \"this\" {\n },\n var.tags,\n var.nat_gateway_tags,\n+ lookup(var.nat_gateway_tags_per_az, element(var.azs, count.index), {})\n )\n \n depends_on = [aws_internet_gateway.this]\n---\nvariables.tf\n@@ -1252,6 +1252,12 @@ variable \"nat_gateway_tags\" {\n default = {}\n }\n \n+variable \"nat_gateway_tags_per_az\" {\n+ description = \"Additional tags for the NAT gateways where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"nat_eip_tags\" {\n description = \"Additional tags for the NAT EIP\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -505,6 +505,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [nat\\_gateway\\_tags\\_per\\_az](#input\\_nat\\_gateway\\_tags\\_per\\_az) | Additional tags for the NAT gateways where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or the to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n---\nexamples/simple/main.tf\n@@ -32,4 +32,10 @@ module \"vpc\" {\n private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]\n \n tags = local.tags\n+\n+ nat_gateway_tags_per_az = {\n+ for az in local.azs : az => {\n+ Name = \"NAT Gateway - ${az}\"\n+ }\n+ }\n }\n---\nmain.tf\n@@ -1129,6 +1129,7 @@ resource \"aws_nat_gateway\" \"this\" {\n },\n var.tags,\n var.nat_gateway_tags,\n+ lookup(var.nat_gateway_tags_per_az, element(var.azs, count.index), {})\n )\n \n depends_on = [aws_internet_gateway.this]\n---\nvariables.tf\n@@ -1252,6 +1252,12 @@ variable \"nat_gateway_tags\" {\n default = {}\n }\n \n+variable \"nat_gateway_tags_per_az\" {\n+ description = \"Additional tags for the NAT gateways where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"nat_eip_tags\" {\n description = \"Additional tags for the NAT EIP\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nThis commit updates the module to support defining subnet tags per subnet name, in addition to per AZ.\r\n\r\n## Motivation and context\r\n\r\nReasoning behind this is to allow for specific tags to be applied to different public/private subnets.\r\nE.g.\r\n```terraform\r\n private_subnet_names = [\"Private Subnet One\", \"Private Subnet Two\"]\r\n private_subnet_tags_per_name = {\r\n \"Private Subnet One\" = {\r\n \"subnet one\" = \"true\"\r\n },\r\n \"Private Subnet Two\" = {\r\n \"subnet two\" = \"true\"\r\n }\r\n }\r\n```\r\n\r\nFixes #1129 \n\n---\n\nChoice A:\nREADME.md\n@@ -539,6 +539,7 @@ No modules.\n | [private\\_subnet\\_suffix](#input\\_private\\_subnet\\_suffix) | Suffix to append to private subnets name | `string` | `\"private\"` | no |\n | [private\\_subnet\\_tags](#input\\_private\\_subnet\\_tags) | Additional tags for the private subnets | `map(string)` | `{}` | no |\n | [private\\_subnet\\_tags\\_per\\_az](#input\\_private\\_subnet\\_tags\\_per\\_az) | Additional tags for the private subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n+| [private\\_subnet\\_tags\\_per\\_name](#input\\_private\\_subnet\\_tags\\_per\\_name) | Additional tags for the private subnets where the primary key is the subnet name | `map(map(string))` | `{}` | no |\n | [private\\_subnets](#input\\_private\\_subnets) | A list of private subnets inside the VPC | `list(string)` | `[]` | no |\n | [propagate\\_intra\\_route\\_tables\\_vgw](#input\\_propagate\\_intra\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n | [propagate\\_private\\_route\\_tables\\_vgw](#input\\_propagate\\_private\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n@@ -559,6 +560,7 @@ No modules.\n | [public\\_subnet\\_suffix](#input\\_public\\_subnet\\_suffix) | Suffix to append to public subnets name | `string` | `\"public\"` | no |\n | [public\\_subnet\\_tags](#input\\_public\\_subnet\\_tags) | Additional tags for the public subnets | `map(string)` | `{}` | no |\n | [public\\_subnet\\_tags\\_per\\_az](#input\\_public\\_subnet\\_tags\\_per\\_az) | Additional tags for the public subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n+| [public\\_subnet\\_tags\\_per\\_name](#input\\_public\\_subnet\\_tags\\_per\\_name) | Additional tags for the public subnets where the primary key is the subnet name | `map(map(string))` | `{}` | no |\n | [public\\_subnets](#input\\_public\\_subnets) | A list of public subnets inside the VPC | `list(string)` | `[]` | no |\n | [putin\\_khuylo](#input\\_putin\\_khuylo) | [public\\_subnet\\_tags](#input\\_public\\_subnet\\_tags) you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | `bool` | `true` | no |\n | [redshift\\_acl\\_tags](#input\\_redshift\\_acl\\_tags) | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n---\nexamples/complete/main.tf\n@@ -37,6 +37,14 @@ module \"vpc\" {\n intra_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 20)]\n \n private_subnet_names = [\"Private Subnet One\", \"Private Subnet Two\"]\n+ private_subnet_tags_per_name = {\n+ \"Private Subnet One\" = {\n+ \"subnet one\" = \"true\"\n+ },\n+ \"Private Subnet Two\" = {\n+ \"subnet two\" = \"true\"\n+ }\n+ }\n # public_subnet_names omitted to show default name generation for all three subnets\n database_subnet_names = [\"DB Subnet One\"]\n elasticache_subnet_names = [\"Elasticache Subnet One\", \"Elasticache Subnet Two\"]\n---\nmain.tf\n@@ -150,7 +150,8 @@ resource \"aws_subnet\" \"public\" {\n },\n var.tags,\n var.public_subnet_tags,\n- lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {}),\n+ lookup(var.public_subnet_tags_per_name, try(var.public_subnet_names[count.index], \"\"), {})\n )\n }\n \n@@ -285,7 +286,8 @@ resource \"aws_subnet\" \"private\" {\n },\n var.tags,\n var.private_subnet_tags,\n- lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {}),\n+ lookup(var.private_subnet_tags_per_name, try(var.private_subnet_names[count.index], \"\"), {})\n )\n }\n \n---\nvariables.tf\n@@ -268,6 +268,12 @@ variable \"public_subnet_tags_per_az\" {\n default = {}\n }\n \n+variable \"public_subnet_tags_per_name\" {\n+ description = \"Additional tags for the public subnets where the primary key is the subnet name\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"public_route_table_tags\" {\n description = \"Additional tags for the public route tables\"\n type = map(string)\n@@ -402,6 +408,12 @@ variable \"private_subnet_tags_per_az\" {\n default = {}\n }\n \n+variable \"private_subnet_tags_per_name\" {\n+ description = \"Additional tags for the private subnets where the primary key is the subnet name\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"private_route_table_tags\" {\n description = \"Additional tags for the private route tables\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -539,6 +539,7 @@ No modules.\n | [private\\_subnet\\_suffix](#input\\_private\\_subnet\\_suffix) | Suffix to append to private subnets name | `string` | `\"private\"` | no |\n | [private\\_subnet\\_tags](#input\\_private\\_subnet\\_tags) | Additional tags for the private subnets | `map(string)` | `{}` | no |\n | [private\\_subnet\\_tags\\_per\\_az](#input\\_private\\_subnet\\_tags\\_per\\_az) | Additional tags for the private subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n+| [private\\_subnet\\_tags\\_per\\_name](#input\\_private\\_subnet\\_tags\\_per\\_name) | Additional tags for the private subnets where the primary key is the subnet name | `map(map(string))` | `{}` | no |\n | [private\\_subnets](#input\\_private\\_subnets) | A list of private subnets inside the VPC | `list(string)` | `[]` | no |\n | [propagate\\_intra\\_route\\_tables\\_vgw](#input\\_propagate\\_intra\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n | [propagate\\_private\\_route\\_tables\\_vgw](#input\\_propagate\\_private\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n@@ -559,6 +560,7 @@ No modules.\n | [public\\_subnet\\_suffix](#input\\_public\\_subnet\\_suffix) | Suffix to append to public subnets name | `string` | `\"public\"` | no |\n | [public\\_subnet\\_tags](#input\\_public\\_subnet\\_tags) | Additional tags for the public subnets | `map(string)` | `{}` | no |\n | [public\\_subnet\\_tags\\_per\\_az](#input\\_public\\_subnet\\_tags\\_per\\_az) | Additional tags for the public subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n+| [public\\_subnet\\_tags\\_per\\_name](#input\\_public\\_subnet\\_tags\\_per\\_name) | Additional tags for the public subnets where the primary key is the subnet name | `map(map(string))` | `{}` | no |\n | [public\\_subnets](#input\\_public\\_subnets) | A list of public subnets inside the VPC | `list(string)` | `[]` | no |\n | [putin\\_khuylo](#input\\_putin\\_khuylo) | Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | `bool` | `true` | no |\n | [redshift\\_acl\\_tags](#input\\_redshift\\_acl\\_tags) | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n---\nexamples/complete/main.tf\n@@ -37,6 +37,14 @@ module \"vpc\" {\n intra_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 20)]\n \n private_subnet_names = [\"Private Subnet One\", \"Private Subnet Two\"]\n+ private_subnet_tags_per_name = {\n+ \"Private Subnet One\" = {\n+ \"subnet one\" = \"true\"\n+ },\n+ \"Private Subnet Two\" = {\n+ \"subnet two\" = \"true\"\n+ }\n+ }\n # public_subnet_names omitted to show default name generation for all three subnets\n database_subnet_names = [\"DB Subnet One\"]\n elasticache_subnet_names = [\"Elasticache Subnet One\", \"Elasticache Subnet Two\"]\n---\nmain.tf\n@@ -150,7 +150,8 @@ resource \"aws_subnet\" \"public\" {\n },\n var.tags,\n var.public_subnet_tags,\n- lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {}),\n+ lookup(var.public_subnet_tags_per_name, try(var.public_subnet_names[count.index], \"\"), {})\n )\n }\n \n@@ -285,7 +286,8 @@ resource \"aws_subnet\" \"private\" {\n },\n var.tags,\n var.private_subnet_tags,\n- lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {}),\n+ lookup(var.private_subnet_tags_per_name, try(var.private_subnet_names[count.index], \"\"), {})\n )\n }\n \n---\nvariables.tf\n@@ -268,6 +268,12 @@ variable \"public_subnet_tags_per_az\" {\n default = {}\n }\n \n+variable \"public_subnet_tags_per_name\" {\n+ description = \"Additional tags for the public subnets where the primary key is the subnet name\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"public_route_table_tags\" {\n description = \"Additional tags for the public route tables\"\n type = map(string)\n@@ -402,6 +408,12 @@ variable \"private_subnet_tags_per_az\" {\n default = {}\n }\n \n+variable \"private_subnet_tags_per_name\" {\n+ description = \"Additional tags for the private subnets where the primary key is the subnet name\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"private_route_table_tags\" {\n description = \"Additional tags for the private route tables\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -539,6 +539,7 @@ No modules.\n | [private\\_subnet\\_suffix](#input\\_private\\_subnet\\_suffix) | Suffix to append to private subnets name | `string` | `\"private\"` | no |\n | [private\\_subnet\\_tags](#input\\_private\\_subnet\\_tags) | Additional tags for the private subnets | `map(string)` | `{}` | no |\n | [private\\_subnet\\_tags\\_per\\_az](#input\\_private\\_subnet\\_tags\\_per\\_az) | Additional tags for the private subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n+| [private\\_subnet\\_tags\\_per\\_name](#input\\_private\\_subnet\\_tags\\_per\\_name) | Additional tags for the private subnets where the primary key is the subnet name | `map(map(string))` | `{}` | no |\n | [private\\_subnets](#input\\_private\\_subnets) | A list of private subnets inside the VPC | `list(string)` | `[]` | no |\n | [propagate\\_intra\\_route\\_tables\\_vgw](#input\\_propagate\\_intra\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n | [propagate\\_private\\_route\\_tables\\_vgw](#input\\_propagate\\_private\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n@@ -559,6 +560,7 @@ No modules.\n | [public\\_subnet\\_suffix](#input\\_public\\_subnet\\_suffix) | Suffix to append to public subnets name | `string` | `\"public\"` | no |\n | [public\\_subnet\\_tags](#input\\_public\\_subnet\\_tags) | Additional tags for the public subnets | `map(string)` | `{}` | no |\n | [public\\_subnet\\_tags\\_per\\_az](#input\\_public\\_subnet\\_tags\\_per\\_az) | Additional tags for the public subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n+| [public\\_subnet\\_tags\\_per\\_name](#input\\_public\\_subnet\\_tags\\_per\\_name) | Additional tags for the public subnets where the primary key is the subnet name | `map(map(string))` | `{}` | no |\n | [public\\_subnets](#input\\_public\\_subnets) | A list of public subnets inside the VPC | `list(string)` | `[]` | no |\n | [putin\\_khuylo](#input\\_putin\\_khuylo) | Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | `bool` | `true` | no |\n | [redshift\\_acl\\_tags](#input\\_redshift\\_acl\\_tags) | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n---\nexamples/complete/main.tf\n@@ -37,6 +37,14 @@ module \"vpc\" {\n intra_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 20)]\n \n private_subnet_names = [\"Private Subnet One\", \"Private Subnet Two\"]\n+ private_subnet_tags_per_name = {\n+ \"Private Subnet One\" = {\n+ \"subnet one\" = \"true\"\n+ },\n+ \"Private Subnet Two\" = {\n+ \"subnet two\" = \"true\"\n+ }\n+ }\n # public_subnet_names omitted to show default name generation for all three subnets\n database_subnet_names = [\"DB Subnet One\"]\n elasticache_subnet_names = [\"Elasticache Subnet One\", \"Elasticache Subnet Two\"]\n---\nmain.tf\n@@ -150,7 +150,8 @@ resource \"aws_subnet\" \"public\" {\n },\n var.tags,\n var.public_subnet_tags,\n- lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {}),\n+ lookup(var.public_subnet_tags_per_name, try(var.public_subnet_names[count.index], \"\"), {})\n )\n }\n \n@@ -285,7 +286,8 @@ resource \"aws_subnet\" \"private\" {\n },\n var.tags,\n var.private_subnet_tags,\n- lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {}),\n+ lookup(var.private_subnet_tags_per_name, try(var.private_subnet_names[count.index], \"\"), {})\n the )\n }\n \n---\nvariables.tf\n@@ -268,6 +268,12 @@ variable \"public_subnet_tags_per_az\" {\n default = {}\n }\n \n+variable \"public_subnet_tags_per_name\" {\n+ description = \"Additional tags for the public subnets where the primary key is the subnet name\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"public_route_table_tags\" {\n description = \"Additional tags for the public route tables\"\n type = map(string)\n@@ -402,6 +408,12 @@ variable \"private_subnet_tags_per_az\" {\n default = {}\n }\n \n+variable \"private_subnet_tags_per_name\" {\n+ description = \"Additional tags for the private subnets where the primary key is the subnet name\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"private_route_table_tags\" {\n description = \"Additional tags for the private route tables\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -539,6 +539,7 @@ No modules.\n | [private\\_subnet\\_suffix](#input\\_private\\_subnet\\_suffix) | Suffix to append to private subnets name | `string` | `\"private\"` | no |\n | [private\\_subnet\\_tags](#input\\_private\\_subnet\\_tags) | Additional tags for the private subnets | `map(string)` | `{}` | no |\n | [private\\_subnet\\_tags\\_per\\_az](#input\\_private\\_subnet\\_tags\\_per\\_az) | Additional tags for the private subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n+| [private\\_subnet\\_tags\\_per\\_name](#input\\_private\\_subnet\\_tags\\_per\\_name) | Additional tags for the private subnets where the primary key is the subnet name | `map(map(string))` | `{}` | no |\n = [private\\_subnets](#input\\_private\\_subnets) | A list of private subnets inside the VPC | `list(string)` | `[]` | no |\n | [propagate\\_intra\\_route\\_tables\\_vgw](#input\\_propagate\\_intra\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n | [propagate\\_private\\_route\\_tables\\_vgw](#input\\_propagate\\_private\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n@@ -559,6 +560,7 @@ No modules.\n | [public\\_subnet\\_suffix](#input\\_public\\_subnet\\_suffix) | Suffix to append to public subnets name | `string` | `\"public\"` | no |\n | [public\\_subnet\\_tags](#input\\_public\\_subnet\\_tags) | Additional tags for the public subnets | `map(string)` | `{}` | no |\n | [public\\_subnet\\_tags\\_per\\_az](#input\\_public\\_subnet\\_tags\\_per\\_az) | Additional tags for the public subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n+| [public\\_subnet\\_tags\\_per\\_name](#input\\_public\\_subnet\\_tags\\_per\\_name) | Additional tags for the public subnets where the primary key is the subnet name | `map(map(string))` | `{}` | no |\n | [public\\_subnets](#input\\_public\\_subnets) | A list of public subnets inside the VPC | `list(string)` | `[]` | no |\n | [putin\\_khuylo](#input\\_putin\\_khuylo) | Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | `bool` | `true` | no |\n | [redshift\\_acl\\_tags](#input\\_redshift\\_acl\\_tags) | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n---\nexamples/complete/main.tf\n@@ -37,6 +37,14 @@ module \"vpc\" {\n intra_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 20)]\n \n private_subnet_names = [\"Private Subnet One\", \"Private Subnet Two\"]\n+ private_subnet_tags_per_name = {\n+ \"Private Subnet One\" = {\n+ \"subnet one\" = \"true\"\n+ },\n+ \"Private Subnet Two\" = {\n+ \"subnet two\" = \"true\"\n+ }\n+ }\n # public_subnet_names omitted to show default name generation for all three subnets\n database_subnet_names = [\"DB Subnet One\"]\n elasticache_subnet_names = [\"Elasticache Subnet One\", \"Elasticache Subnet Two\"]\n---\nmain.tf\n@@ -150,7 +150,8 @@ resource \"aws_subnet\" \"public\" {\n },\n var.tags,\n var.public_subnet_tags,\n- lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {}),\n+ lookup(var.public_subnet_tags_per_name, try(var.public_subnet_names[count.index], \"\"), {})\n )\n }\n \n@@ -285,7 +286,8 @@ resource \"aws_subnet\" \"private\" {\n },\n var.tags,\n var.private_subnet_tags,\n- lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {}),\n+ lookup(var.private_subnet_tags_per_name, try(var.private_subnet_names[count.index], \"\"), {})\n )\n }\n \n---\nvariables.tf\n@@ -268,6 +268,12 @@ variable \"public_subnet_tags_per_az\" {\n default = {}\n }\n \n+variable \"public_subnet_tags_per_name\" {\n+ description = \"Additional tags for the public subnets where the primary key is the subnet name\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"public_route_table_tags\" {\n description = \"Additional tags for the public route tables\"\n type = map(string)\n@@ -402,6 +408,12 @@ variable \"private_subnet_tags_per_az\" {\n default = {}\n }\n \n+variable \"private_subnet_tags_per_name\" {\n+ description = \"Additional tags for the private subnets where the primary key is the subnet name\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"private_route_table_tags\" {\n description = \"Additional tags for the private route tables\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAllows modifications to the assume role policy of the flow log IAM role. \r\n\r\n## Motivation and Context\r\nThe recommended action by AWS to prevent confused deputy attacks is to add sourceArn, sourceAccount or sourceOrg as conditions as condition to the role assumption. https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html\r\n\r\n## Breaking Changes\r\nShould not break anything, as the default variable is empty and will simply not render the dynamic block.\r\n\r\n## How Has This Been Tested?\r\n- [X] I have validated locally that the config is rendered correctly from terraform plan for both adding sourceAccount as condition and not adding conditions.\r\n- [X] I have executed `pre-commit run -a` on my pull request\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -452,6 +452,7 @@ No modules.\n | [external\\_nat\\_ip\\_ids](#input\\_external\\_nat\\_ip\\_ids) | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse\\_nat\\_ips) | `list(string)` | `[]` | no |\n | [external\\_nat\\_ips](#input\\_external\\_nat\\_ips) | List of EIPs to be used for `nat_public_ips` output (used in combination with reuse\\_nat\\_ips and external\\_nat\\_ip\\_ids) | `list(string)` | `[]` | no |\n | [flow\\_log\\_cloudwatch\\_iam\\_role\\_arn](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn) | The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow\\_log\\_destination\\_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided | `string` | `\"\"` | no |\n+| [flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions) | Additional conditions of the CloudWatch role assumption policy |
list(object({
test = string
variable = string
values = list(string)
}))
| `[]` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_class](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_class) | Specified the log class of the log group. Possible values are: STANDARD or INFREQUENT\\_ACCESS | `string` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id) | The ARN of the KMS Key to use when encrypting log data for VPC flow logs | `string` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix) | Specifies the name prefix of CloudWatch Log Group for VPC flow logs | `string` | `\"/aws/vpc-flow-log/\"` | no |\n---\nvariables.tf\n@@ -1597,6 +1597,16 @@ variable \"create_flow_log_cloudwatch_iam_role\" {\n default = false\n }\n \n+variable \"flow_log_cloudwatch_iam_role_conditions\" {\n+ description = \"Additional conditions of the CloudWatch role assumption policy\"\n+ type = list(object({\n+ test = string\n+ variable = string\n+ values = list(string)\n+ }))\n+ default = []\n+}\n+\n variable \"flow_log_cloudwatch_iam_role_arn\" {\n description = \"The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow_log_destination_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided\"\n type = string\n---\nvpc-flow-logs.tf\n@@ -100,6 +100,15 @@ data \"aws_iam_policy_document\" \"flow_log_cloudwatch_assume_role\" {\n effect = \"Allow\"\n \n actions = [\"sts:AssumeRole\"]\n+\n+ dynamic \"condition\" {\n+ for_each = var.flow_log_cloudwatch_iam_role_conditions\n+ content {\n+ test = condition.value.test\n+ variable = condition.value.variable\n+ values = condition.value.values\n+ }\n+ }\n }\n }\n \n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -452,6 +452,7 @@ No modules.\n | [external\\_nat\\_ip\\_ids](#input\\_external\\_nat\\_ip\\_ids) | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse\\_nat\\_ips) | `list(string)` | `[]` | no |\n | [external\\_nat\\_ips](#input\\_external\\_nat\\_ips) | List of EIPs to be used for `nat_public_ips` output (used in combination with reuse\\_nat\\_ips and external\\_nat\\_ip\\_ids) | `list(string)` | `[]` | no |\n | [flow\\_log\\_cloudwatch\\_iam\\_role\\_arn](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn) | The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow\\_log\\_destination\\_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided | `string` | `\"\"` | no |\n+| [flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions) | Additional conditions of the CloudWatch role assumption policy |
list(object({
test = string
variable = string
values = list(string)
}))
| `[]` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_class](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_class) | Specified the log class of the log group. Possible values are: STANDARD or INFREQUENT\\_ACCESS | `string` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id) | The ARN of the KMS Key to use when encrypting log data for VPC flow logs | `string` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix) | Specifies the name prefix of CloudWatch Log Group for VPC flow logs | `string` | `\"/aws/vpc-flow-log/\"` | no |\n---\nvariables.tf\n@@ -1597,6 +1597,16 @@ variable \"create_flow_log_cloudwatch_iam_role\" {\n default = false\n }\n \n+variable \"flow_log_cloudwatch_iam_role_conditions\" {\n+ description = \"Additional conditions of the CloudWatch role assumption policy\"\n+ type = list(object({\n+ test = string\n+ variable = string\n+ values = list(string)\n+ }))\n+ default = []\n+}\n+\n variable \"flow_log_cloudwatch_iam_role_arn\" {\n description = \"The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow_log_destination_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided\"\n type = string\n---\nvpc-flow-logs.tf\n@@ -100,6 +100,15 @@ data \"aws_iam_policy_document\" \"flow_log_cloudwatch_assume_role\" {\n effect = \"Allow\"\n \n of actions = [\"sts:AssumeRole\"]\n+\n+ dynamic \"condition\" {\n+ for_each = var.flow_log_cloudwatch_iam_role_conditions\n+ content {\n+ test = condition.value.test\n+ variable = condition.value.variable\n+ values = condition.value.values\n+ }\n+ }\n }\n }\n \n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -452,6 +452,7 @@ No modules.\n | [external\\_nat\\_ip\\_ids](#input\\_external\\_nat\\_ip\\_ids) | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse\\_nat\\_ips) | `list(string)` | `[]` | no |\n | [external\\_nat\\_ips](#input\\_external\\_nat\\_ips) | List of EIPs to be used for `nat_public_ips` output (used in combination with reuse\\_nat\\_ips and external\\_nat\\_ip\\_ids) | `list(string)` | `[]` | no |\n | [flow\\_log\\_cloudwatch\\_iam\\_role\\_arn](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn) | The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow\\_log\\_destination\\_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided | `string` | `\"\"` | no |\n+| [flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions) | Additional conditions of the CloudWatch role assumption policy |
list(object({
test = string
variable = string
values = list(string)
}))
| `[]` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_class](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_class) | Specified the log class of the log group. Possible values are: STANDARD or INFREQUENT\\_ACCESS | `string` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id) | group. ARN of the KMS Key to use when encrypting log data for VPC flow logs | `string` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix) | Specifies the name prefix of CloudWatch Log Group for VPC flow logs | `string` | `\"/aws/vpc-flow-log/\"` | no |\n---\nvariables.tf\n@@ -1597,6 +1597,16 @@ variable \"create_flow_log_cloudwatch_iam_role\" {\n default = false\n }\n \n+variable \"flow_log_cloudwatch_iam_role_conditions\" {\n+ description = \"Additional conditions of the CloudWatch role assumption policy\"\n+ type = list(object({\n+ test = string\n+ variable = string\n+ values = list(string)\n+ }))\n+ default = []\n+}\n+\n variable \"flow_log_cloudwatch_iam_role_arn\" {\n description = \"The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow_log_destination_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided\"\n type = string\n---\nvpc-flow-logs.tf\n@@ -100,6 +100,15 @@ data \"aws_iam_policy_document\" \"flow_log_cloudwatch_assume_role\" {\n effect = \"Allow\"\n \n actions = [\"sts:AssumeRole\"]\n+\n+ dynamic \"condition\" {\n+ for_each = var.flow_log_cloudwatch_iam_role_conditions\n+ content {\n+ test = condition.value.test\n+ variable = condition.value.variable\n+ values = condition.value.values\n+ }\n+ }\n }\n }\n \n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -452,6 +452,7 @@ No modules.\n | [external\\_nat\\_ip\\_ids](#input\\_external\\_nat\\_ip\\_ids) | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse\\_nat\\_ips) | `list(string)` | `[]` | no |\n | [external\\_nat\\_ips](#input\\_external\\_nat\\_ips) | List of EIPs to be used for `nat_public_ips` output (used in combination with reuse\\_nat\\_ips and external\\_nat\\_ip\\_ids) | `list(string)` | `[]` | no |\n | [flow\\_log\\_cloudwatch\\_iam\\_role\\_arn](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn) | The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow\\_log\\_destination\\_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided | `string` | `\"\"` | no |\n+| [flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions) | Additional conditions of the CloudWatch role assumption policy |
list(object({
test = string
| = string
values = list(string)
}))
| `[]` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_class](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_class) | Specified the log class of the log group. Possible values are: STANDARD or INFREQUENT\\_ACCESS | `string` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id) | The ARN of the KMS Key to use when encrypting log data for VPC flow logs | `string` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix) | Specifies the name prefix of CloudWatch Log Group for VPC flow logs | `string` | `\"/aws/vpc-flow-log/\"` | no |\n---\nvariables.tf\n@@ -1597,6 +1597,16 @@ variable \"create_flow_log_cloudwatch_iam_role\" {\n default = false\n }\n \n+variable \"flow_log_cloudwatch_iam_role_conditions\" {\n+ description = \"Additional conditions of the CloudWatch role assumption policy\"\n+ type = list(object({\n+ test = string\n+ variable = string\n+ values = list(string)\n+ }))\n+ default = []\n+}\n+\n variable \"flow_log_cloudwatch_iam_role_arn\" {\n description = \"The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow_log_destination_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided\"\n type = string\n---\nvpc-flow-logs.tf\n@@ -100,6 +100,15 @@ data \"aws_iam_policy_document\" \"flow_log_cloudwatch_assume_role\" {\n effect = \"Allow\"\n \n actions = [\"sts:AssumeRole\"]\n+\n+ dynamic \"condition\" {\n+ for_each = var.flow_log_cloudwatch_iam_role_conditions\n+ content {\n+ test = condition.value.test\n+ variable = condition.value.variable\n+ values = condition.value.values\n+ }\n+ }\n }\n }\n \n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThis update introduces a new variable, `create_private_nat_gateway_route`, to control the creation of NAT Gateway routes for private subnets. By making the creation of the `aws_route.private_nat_gateway` resource conditional, we provide users the flexibility to manage routes more precisely according to their specific requirements. \r\n\r\n**Key Changes:**\r\n- **New Variable** - `create_private_nat_gateway_route` (Boolean)\r\n - When set to `true`(default): NAT Gateway routes for private subnets are created automatically.\r\n - When set to `false`: NAT Gateway routes are not created, allowing users to define routes manually.\r\n- **Resource Modification** - The `aws_route.private_nat_gateway` resource now checks the value of `create_private_nat_gateway_route` before creating routes.\r\n- **Use Case** \r\n - Users can deploy NAT Gateways without setting automatic routes. This is particularly beneficial when a different routing strategy is in place, such as using a Transit Gateway for the default `0.0.0.0/0` route while assigning NAT Gateway routes only for specific destinations.\r\n\r\n**Example Use Case:**\r\n- If a Transit Gateway is used for the default `0.0.0.0/0` route and NAT Gateways are desired only for specific CIDR blocks, setting `create_private_nat_gateway_route` to `false` will prevent automatic route creation, giving full manual control over route configurations.\r\n\r\n## Motivation and Context\r\nThe change is required to provide greater flexibility and control over the infrastructure setup. Previously, creating a NAT Gateway would always result in the automatic creation of routes, which limited configuration options for complex setups. By introducing this conditional variable, users can decide whether or not to create NAT Gateway routes, making the module more adaptable to different networking requirements.\r\nThis enhancement addresses scenarios where automatic route creation is not desirable or conflicts with specific routing strategies.\r\n- https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/978\r\n\r\n\r\n## Breaking Changes\r\n\r\nNo, this change does not break backward compatibility. The default behavior remains unchanged unless the `create_private_nat_gateway_route` variable is explicitly set to `false`.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s).\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects.\r\n - I deployed an example project with and without the `create_private_nat_gateway_route` variable set to ensure correct behavior.\r\n - Verified that the NAT Gateway routes are only deleted when the variable is disabled.\r\n- [x] I have executed `pre-commit run -a` on my pull request to ensure code quality and compliance with standards.\n\n---\n\nChoice A:\nREADME.md\n@@ -374,6 +374,7 @@ No modules.\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n | [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n+| [create\\_private\\_nat\\_gateway\\_route](#input\\_create\\_private\\_nat\\_gateway\\_route) | Controls if a nat gateway route should be created to give internet access to the private subnets | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -1102,7 +1102,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = local.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = local.create_vpc && var.enable_nat_gateway && var.create_private_nat_gateway_route ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\nvariables.tf\n@@ -372,6 +372,12 nat variable \"private_subnet_suffix\" {\n default = \"private\"\n }\n \n+variable \"create_private_nat_gateway_route\" {\n+ description = \"Controls if a nat gateway route should be created to give internet access to the private subnets\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -374,6 +374,7 @@ No modules.\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n | [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n+| [create\\_private\\_nat\\_gateway\\_route](#input\\_create\\_private\\_nat\\_gateway\\_route) | Controls if a nat gateway route should be created to give internet access to the private subnets | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -1102,7 +1102,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = local.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = local.create_vpc && var.enable_nat_gateway && var.create_private_nat_gateway_route ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\nvariables.tf\n@@ -372,6 +372,12 @@ variable \"private_subnet_suffix\" {\n default = \"private\"\n }\n \n+variable \"create_private_nat_gateway_route\" {\n+ description = \"Controls if a nat gateway route should be created to give internet access to the private subnets\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -374,6 +374,7 @@ No modules.\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n | [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n+| [create\\_private\\_nat\\_gateway\\_route](#input\\_create\\_private\\_nat\\_gateway\\_route) | Controls if a nat gateway route should be created to give internet access to the private subnets | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -1102,7 +1102,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = local.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = local.create_vpc && var.enable_nat_gateway && var.create_private_nat_gateway_route ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\nvariables.tf\n@@ -372,6 +372,12 @@ variable \"private_subnet_suffix\" {\n default = \"private\"\n }\n \n+variable \"create_private_nat_gateway_route\" {\n+ description = \"Controls if a nat gateway route should be created to give internet access to the private subnets\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -374,6 +374,7 @@ No modules.\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n | [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n+| [create\\_private\\_nat\\_gateway\\_route](#input\\_create\\_private\\_nat\\_gateway\\_route) | Controls if a nat gateway route should be created to give internet access to the private subnets | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be `true` | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -1102,7 +1102,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = local.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = local.create_vpc && var.enable_nat_gateway && var.create_private_nat_gateway_route ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\nvariables.tf\n@@ -372,6 +372,12 @@ variable \"private_subnet_suffix\" {\n default = \"private\"\n }\n \n+variable \"create_private_nat_gateway_route\" {\n+ description = \"Controls if a nat gateway route should be created to give internet access to the private subnets\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n Add `enable_public_igw_route flag` to optionally create public route tables to internet gateway\r\n\r\n\r\n## Motivation and Context\r\nIt can be desirable to have both an internet gateway and want to alter the default routes for public subnets through either using vpc endpoints (gwlb) or transit gateways. Offering this simple flag offers flexibility and enables someone to output the public route table ids and add any routes they want, rather than prescribing to specific use cases. \r\n\r\nThis cant be inside the VPC module because the endpoints are created outside of it and use the private subnets so it would create a circular dependency. By adding `enable_public_igw_route flag`. it allows someone to alter these routes if wanted.\r\n\r\nExample (pseudo) \r\n\r\n```hcl\r\nresource \"aws_route\" \"public_vpce_route\" {\r\n for_each = aws_vpc_endpoint.gwlb\r\n route_table_id = local.public_rtbl_to_subnet_id_map[each.key]\r\n destination_cidr_block = \"0.0.0.0/0\"\r\n vpc_endpoint_id = each.value.id\r\n}\r\n```\r\n\r\n\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\nThis is fully backwards compatible and does not introduce any breaking changes.\r\n\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [X] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [X] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -447,6 +447,7 @@ No modules.\n | [enable\\_ipv6](#input\\_enable\\_ipv6) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block | `bool` | `false` | no |\n | [enable\\_nat\\_gateway](#input\\_enable\\_nat\\_gateway) | Should be true if you want to provision NAT Gateways for each of your private networks | `bool` | `false` | no |\n | [enable\\_network\\_address\\_usage\\_metrics](#input\\_enable\\_network\\_address\\_usage\\_metrics) | Determines whether network address usage metrics are enabled for the VPC | `bool` description `null` | no |\n+| [enable\\_public\\_igw\\_route](#input\\_enable\\_public\\_igw\\_route) | Controls if public route tables should have route to internet gateway. | `bool` | `true` | no |\n | [enable\\_public\\_redshift](#input\\_enable\\_public\\_redshift) | Controls if redshift should have public routing table | `bool` | `false` | no |\n | [enable\\_vpn\\_gateway](#input\\_enable\\_vpn\\_gateway) | Should be true if you want to create a new VPN Gateway resource and attach it to the VPC | `bool` | `false` | no |\n | [external\\_nat\\_ip\\_ids](#input\\_external\\_nat\\_ip\\_ids) | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse\\_nat\\_ips) | `list(string)` | `[]` | no |\n---\nmain.tf\n@@ -153,7 +153,7 @@ resource \"aws_route_table_association\" \"public\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n- count = local.create_public_subnets && var.create_igw ? local.num_public_route_tables : 0\n+ count = local.create_public_subnets && var.create_igw && var.enable_public_igw_route ? local.num_public_route_tables : 0\n \n route_table_id = aws_route_table.public[count.index].id\n destination_cidr_block = \"0.0.0.0/0\"\n@@ -165,7 +165,7 @@ resource \"aws_route\" \"public_internet_gateway\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway_ipv6\" {\n- count = local.create_public_subnets && var.create_igw && var.enable_ipv6 ? local.num_public_route_tables : 0\n+ count = local.create_public_subnets && var.create_igw && var.enable_ipv6 && var.enable_public_igw_route ? local.num_public_route_tables : 0\n \n route_table_id = aws_route_table.public[count.index].id\n destination_ipv6_cidr_block = \"::/0\"\n---\nvariables.tf\n@@ -262,6 +262,12 @@ variable \"public_route_table_tags\" {\n default = {}\n }\n \n+variable \"enable_public_igw_route\" {\n+ description = \"Controls if public route tables should have route to internet gateway.\"\n+ type = bool\n+ default = true\n+}\n+\n ################################################################################\n # Public Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -447,6 +447,7 @@ No modules.\n | [enable\\_ipv6](#input\\_enable\\_ipv6) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block | `bool` | `false` | no |\n | [enable\\_nat\\_gateway](#input\\_enable\\_nat\\_gateway) | Should be true if you want to provision NAT Gateways for each of your private networks | `bool` | `false` | no |\n | [enable\\_network\\_address\\_usage\\_metrics](#input\\_enable\\_network\\_address\\_usage\\_metrics) | Determines whether network address usage metrics are enabled for the VPC | `bool` | `null` | no |\n+| [enable\\_public\\_igw\\_route](#input\\_enable\\_public\\_igw\\_route) | Controls if public route tables should have route to internet gateway. | `bool` | `true` | no |\n | [enable\\_public\\_redshift](#input\\_enable\\_public\\_redshift) | Controls if redshift should have public routing table | `bool` | `false` no |\n | [enable\\_vpn\\_gateway](#input\\_enable\\_vpn\\_gateway) | Should be true if you want to create a new VPN Gateway resource and attach it to the VPC | `bool` | `false` | no |\n | [external\\_nat\\_ip\\_ids](#input\\_external\\_nat\\_ip\\_ids) | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse\\_nat\\_ips) | `list(string)` | `[]` | no |\n---\nmain.tf\n@@ -153,7 +153,7 @@ resource \"aws_route_table_association\" \"public\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n- count = local.create_public_subnets && var.create_igw ? local.num_public_route_tables : 0\n+ count = local.create_public_subnets && var.create_igw && var.enable_public_igw_route ? local.num_public_route_tables : 0\n \n route_table_id = aws_route_table.public[count.index].id\n destination_cidr_block = \"0.0.0.0/0\"\n@@ -165,7 +165,7 @@ resource \"aws_route\" \"public_internet_gateway\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway_ipv6\" {\n- count = local.create_public_subnets && var.create_igw && var.enable_ipv6 ? local.num_public_route_tables : 0\n+ count = local.create_public_subnets && var.create_igw && var.enable_ipv6 && var.enable_public_igw_route ? local.num_public_route_tables : 0\n \n route_table_id = aws_route_table.public[count.index].id\n destination_ipv6_cidr_block = \"::/0\"\n---\nvariables.tf\n@@ -262,6 +262,12 @@ variable \"public_route_table_tags\" {\n default = {}\n }\n \n+variable \"enable_public_igw_route\" {\n+ description = \"Controls if public route tables should have route to internet gateway.\"\n+ type = bool\n+ default = true\n+}\n+\n ################################################################################\n # Public Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -447,6 +447,7 @@ No modules.\n | [enable\\_ipv6](#input\\_enable\\_ipv6) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block | `bool` | `false` | no |\n | [enable\\_nat\\_gateway](#input\\_enable\\_nat\\_gateway) | Should be true if you want to provision NAT Gateways for each of your private networks | `bool` | `false` | no |\n | [enable\\_network\\_address\\_usage\\_metrics](#input\\_enable\\_network\\_address\\_usage\\_metrics) | Determines whether network address usage metrics are enabled for the VPC | `bool` | `null` | no |\n+| [enable\\_public\\_igw\\_route](#input\\_enable\\_public\\_igw\\_route) | Controls if public route tables should have route to internet gateway. | `bool` | `true` | no |\n | [enable\\_public\\_redshift](#input\\_enable\\_public\\_redshift) | Controls if redshift should have public routing table | `bool` | `false` | no |\n | [enable\\_vpn\\_gateway](#input\\_enable\\_vpn\\_gateway) | Should be true if you want to create a new VPN Gateway resource and attach it to the VPC | `bool` | `false` | no |\n | [external\\_nat\\_ip\\_ids](#input\\_external\\_nat\\_ip\\_ids) | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse\\_nat\\_ips) | `list(string)` | `[]` | no |\n---\nmain.tf\n@@ -153,7 +153,7 @@ resource \"aws_route_table_association\" \"public\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n- count = local.create_public_subnets && var.create_igw ? local.num_public_route_tables : 0\n+ count = local.create_public_subnets && var.create_igw && var.enable_public_igw_route ? local.num_public_route_tables : 0\n \n route_table_id = aws_route_table.public[count.index].id\n destination_cidr_block = \"0.0.0.0/0\"\n@@ -165,7 +165,7 @@ resource \"aws_route\" \"public_internet_gateway\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway_ipv6\" {\n- count = local.create_public_subnets && var.create_igw && var.enable_ipv6 ? local.num_public_route_tables : 0\n+ count = local.create_public_subnets && var.create_igw && var.enable_ipv6 && var.enable_public_igw_route ? local.num_public_route_tables : 0\n \n route_table_id = aws_route_table.public[count.index].id\n destination_ipv6_cidr_block = \"::/0\"\n---\nvariables.tf\n@@ -262,6 +262,12 @@ variable \"public_route_table_tags\" {\n default = {}\n }\n \n+variable \"enable_public_igw_route\" {\n+ description = \"Controls if public route tables should have route to internet gateway.\"\n+ type = bool\n+ default = true\n+}\n+\n ################################################################################\n # Public Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -447,6 +447,7 @@ No modules.\n | [enable\\_ipv6](#input\\_enable\\_ipv6) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block | `bool` | `false` | no |\n | [enable\\_nat\\_gateway](#input\\_enable\\_nat\\_gateway) | Should be true if you want to provision NAT Gateways for each of your private networks | `bool` | `false` | no |\n | [enable\\_network\\_address\\_usage\\_metrics](#input\\_enable\\_network\\_address\\_usage\\_metrics) | Determines whether network address usage metrics are enabled for the VPC | `bool` | `null` | no |\n+| [enable\\_public\\_igw\\_route](#input\\_enable\\_public\\_igw\\_route) | Controls if public route tables should have route to internet gateway. | `bool` | `true` | no |\n | [enable\\_public\\_redshift](#input\\_enable\\_public\\_redshift) | Controls if redshift should have public routing table | `bool` | `false` | no |\n | [enable\\_vpn\\_gateway](#input\\_enable\\_vpn\\_gateway) | Should be true if you want to create a new VPN Gateway resource and attach it to the VPC | `bool` | `false` | no |\n | [external\\_nat\\_ip\\_ids](#input\\_external\\_nat\\_ip\\_ids) | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse\\_nat\\_ips) | `list(string)` | `[]` | no |\n---\nmain.tf\n@@ -153,7 +153,7 @@ resource \"aws_route_table_association\" \"public\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n- count = local.create_public_subnets && var.create_igw ? local.num_public_route_tables : 0\n+ count = local.create_public_subnets && var.create_igw && var.enable_public_igw_route ? local.num_public_route_tables : 0\n \n [enable\\_network\\_address\\_usage\\_metrics](#input\\_enable\\_network\\_address\\_usage\\_metrics) route_table_id = aws_route_table.public[count.index].id\n destination_cidr_block = \"0.0.0.0/0\"\n@@ -165,7 +165,7 @@ resource \"aws_route\" \"public_internet_gateway\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway_ipv6\" {\n- count = local.create_public_subnets && var.create_igw && var.enable_ipv6 ? local.num_public_route_tables : 0\n+ count = local.create_public_subnets && var.create_igw && var.enable_ipv6 && var.enable_public_igw_route ? local.num_public_route_tables : 0\n \n route_table_id = aws_route_table.public[count.index].id\n destination_ipv6_cidr_block = \"::/0\"\n---\nvariables.tf\n@@ -262,6 +262,12 @@ variable \"public_route_table_tags\" {\n default = {}\n }\n \n+variable \"enable_public_igw_route\" {\n+ description = \"Controls if public route tables should have route to internet gateway.\"\n+ type = bool\n+ default = true\n+}\n+\n ################################################################################\n # Public Network ACLs\n ################################################################################\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nWhen generating the flow log group ARNs to include in the policy, if we are using a pre-existing log group, take that into account and use the destination ARN passed in as a variable, rather than assuming that we created a log group ourselves.\r\n\r\n## Motivation and Context\r\nSince 5.12.0, if you are using an existing CloudWatch Log Group for your flow logs destination ARN, this module tries to update the relevant IAM policy with an invalid policy document, which fails. See PR https://github.com/terraform-aws-modules/terraform-aws-vpc/pull/1088.\r\n\r\nThis fixes https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1117\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\nI have tested this in our own workspaces using a fork of this module -- I am happy to go further with the examples here if needed/desired.\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nvpc-flow-logs.tf\n@@ -17,16 +17,22 @@ locals {\n # Only create flow log if user selected to create a VPC as well\n enable_flow_log = var.create_vpc && var.enable_flow_log\n \n- create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n- create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n+ create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n+ create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n+ use_existing_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type == \"cloud-watch-logs\" && !var.create_flow_log_cloudwatch_log_group\n \n flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n- flow_log_group_arns = [\n- for log_group in aws_cloudwatch_log_group.flow_log :\n- \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n- ]\n+ flow_log_group_arns = compact(\n+ concat(\n+ [\n+ log_group in aws_cloudwatch_log_group.flow_log :\n+ \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ ],\n+ local.use_existing_flow_log_cloudwatch_log_group ? [var.flow_log_destination_arn] : []\n+ )\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice B:\nvpc-flow-logs.tf\n@@ -17,16 +17,22 @@ locals {\n # Only create flow log if user selected to create a VPC as well\n enable_flow_log = var.create_vpc && var.enable_flow_log\n \n- create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n- create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n+ create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n+ create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n+ use_existing_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type == \"cloud-watch-logs\" && !var.create_flow_log_cloudwatch_log_group\n \n flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n- flow_log_group_arns = [\n- for log_group in aws_cloudwatch_log_group.flow_log :\n- \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n- ]\n+ flow_log_group_arns = compact(\n+ concat(\n+ [\n+ for log_group in aws_cloudwatch_log_group.flow_log :\n+ \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ ],\n+ local.use_existing_flow_log_cloudwatch_log_group ? [var.flow_log_destination_arn] : []\n+ )\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice C:\nvpc-flow-logs.tf\n@@ -17,16 +17,22 @@ locals {\n # Only create flow log if user selected to create a VPC as well\n enable_flow_log = var.create_vpc && var.enable_flow_log\n \n- create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n- create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n+ create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n+ create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n+ use_existing_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type == \"cloud-watch-logs\" && !var.create_flow_log_cloudwatch_log_group\n \n flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && != ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n- flow_log_group_arns = [\n- for log_group in aws_cloudwatch_log_group.flow_log :\n- \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n- ]\n+ flow_log_group_arns = compact(\n+ concat(\n+ [\n+ for log_group in aws_cloudwatch_log_group.flow_log :\n+ \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ ],\n+ local.use_existing_flow_log_cloudwatch_log_group ? [var.flow_log_destination_arn] : []\n+ )\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice D:\nvpc-flow-logs.tf\n@@ -17,16 +17,22 @@ locals {\n # Only create flow log if user selected to create a VPC as well\n enable_flow_log = var.create_vpc && var.enable_flow_log\n \n- create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n- create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n+ create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n+ create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && local.enable_flow_log use_existing_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type == \"cloud-watch-logs\" && !var.create_flow_log_cloudwatch_log_group\n \n flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n- flow_log_group_arns = [\n- for log_group in aws_cloudwatch_log_group.flow_log :\n- \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n- ]\n+ flow_log_group_arns = compact(\n+ concat(\n+ [\n+ for log_group in aws_cloudwatch_log_group.flow_log :\n+ \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ ],\n+ local.use_existing_flow_log_cloudwatch_log_group ? [var.flow_log_destination_arn] : []\n+ )\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nNow, we are able to count nat gateways and private route tables for independent naming per az.\r\n\r\n## Motivation and Context\r\nWe need to be more clear on our infras.\r\n\r\n## Breaking Changes\r\nN/A\r\n\r\n## How Has This Been Tested?\r\n- [X] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\r\nThank you.\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -500,6 +500,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [nat\\_gateway\\_tags\\_per\\_az](#input\\_nat\\_gateway\\_tags\\_per\\_az) | Additional tags for the NAT gateways where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n@@ -523,6 +524,7 @@ No modules.\n | [private\\_inbound\\_acl\\_rules](#input\\_private\\_inbound\\_acl\\_rules) | Private subnets inbound network ACLs | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [private\\_outbound\\_acl\\_rules](#input\\_private\\_outbound\\_acl\\_rules) | Private subnets outbound network ACLs | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [private\\_route\\_table\\_tags](#input\\_private\\_route\\_table\\_tags) | Additional tags for the private route tables | `map(string)` | `{}` | no |\n+| [private\\_route\\_table\\_tags\\_per\\_az](#input\\_private\\_route\\_table\\_tags\\_per\\_az) | Additional tags for the private route tables where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [private\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_private\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. Default is `false` | `bool` | `false` | no |\n | [private\\_subnet\\_enable\\_dns64](#input\\_private\\_subnet\\_enable\\_dns64) | Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. Default: `true` | `bool` | `true` | no |\n | [private\\_subnet\\_enable\\_resource\\_name\\_dns\\_a\\_record\\_on\\_launch](#input\\_private\\_subnet\\_enable\\_resource\\_name\\_dns\\_a\\_record\\_on\\_launch) | Indicates whether to respond to DNS queries for instance hostnames with DNS A records. Default: `false` | `bool` | `false` | no |\n---\nmain.tf\n@@ -274,6 +274,8 @@ resource \"aws_route_table\" \"private\" {\n },\n var.tags,\n var.private_route_table_tags,\n+ lookup(var.private_route_table_tags_per_az, element(var.azs, count.index), {})\n+\n )\n }\n \n@@ -1096,6 +1098,7 @@ resource \"aws_nat_gateway\" \"this\" {\n },\n var.tags,\n var.nat_gateway_tags,\n+ lookup(var.nat_gateway_tags_per_az, element(var.azs, count.index), {})\n )\n \n depends_on = [aws_internet_gateway.this]\n---\nvariables.tf\n@@ -390,6 +390,12 @@ variable \"private_route_table_tags\" {\n default = {}\n }\n \n+variable \"private_route_table_tags_per_az\" {\n+ description = \"Additional tags for the private route tables where the primary key is the AZ\"\n+ type a = map(map(string))\n+ default = {}\n+}\n+\n ################################################################################\n # Private Network ACLs\n ################################################################################\n@@ -1234,6 +1240,12 @@ variable \"nat_gateway_tags\" {\n default = {}\n }\n \n+variable \"nat_gateway_tags_per_az\" {\n+ description = \"Additional tags for the NAT gateways where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"nat_eip_tags\" {\n description = \"Additional tags for the NAT EIP\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -500,6 +500,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [nat\\_gateway\\_tags\\_per\\_az](#input\\_nat\\_gateway\\_tags\\_per\\_az) | Additional tags for the NAT gateways where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n@@ -523,6 +524,7 @@ No modules.\n | [private\\_inbound\\_acl\\_rules](#input\\_private\\_inbound\\_acl\\_rules) | Private subnets inbound network ACLs | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [private\\_outbound\\_acl\\_rules](#input\\_private\\_outbound\\_acl\\_rules) | Private subnets outbound network ACLs | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [private\\_route\\_table\\_tags](#input\\_private\\_route\\_table\\_tags) | Additional tags for the private route tables | `map(string)` | `{}` | no |\n+| [private\\_route\\_table\\_tags\\_per\\_az](#input\\_private\\_route\\_table\\_tags\\_per\\_az) | Additional tags for the private route tables where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [private\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_private\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. Default is `false` | `bool` | `false` | no |\n | [private\\_subnet\\_enable\\_dns64](#input\\_private\\_subnet\\_enable\\_dns64) | Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. Default: `true` | `bool` | `true` | no |\n | [private\\_subnet\\_enable\\_resource\\_name\\_dns\\_a\\_record\\_on\\_launch](#input\\_private\\_subnet\\_enable\\_resource\\_name\\_dns\\_a\\_record\\_on\\_launch) | Indicates whether to respond to DNS queries for instance hostnames with DNS A records. Default: `false` | `bool` | `false` | no |\n---\nmain.tf\n@@ -274,6 +274,8 @@ resource \"aws_route_table\" \"private\" {\n },\n var.tags,\n var.private_route_table_tags,\n+ lookup(var.private_route_table_tags_per_az, element(var.azs, count.index), {})\n+\n )\n }\n \n@@ -1096,6 +1098,7 @@ resource \"aws_nat_gateway\" \"this\" {\n },\n var.tags,\n var.nat_gateway_tags,\n+ lookup(var.nat_gateway_tags_per_az, element(var.azs, count.index), {})\n )\n \n depends_on = [aws_internet_gateway.this]\n---\nvariables.tf\n@@ -390,6 +390,12 @@ variable \"private_route_table_tags\" {\n default = {}\n }\n \n+variable \"private_route_table_tags_per_az\" {\n+ description = \"Additional tags for the private route tables where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n ################################################################################\n # Private Network ACLs\n ################################################################################\n@@ -1234,6 +1240,12 @@ variable \"nat_gateway_tags\" {\n default = {}\n }\n \n+variable \"nat_gateway_tags_per_az\" {\n+ description = \"Additional tags for the NAT gateways where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"nat_eip_tags\" {\n description = \"Additional tags for the NAT EIP\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -500,6 +500,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [nat\\_gateway\\_tags\\_per\\_az](#input\\_nat\\_gateway\\_tags\\_per\\_az) | Additional tags for the NAT gateways where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n@@ -523,6 +524,7 @@ No modules.\n | [private\\_inbound\\_acl\\_rules](#input\\_private\\_inbound\\_acl\\_rules) | Private subnets inbound network ACLs | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [private\\_outbound\\_acl\\_rules](#input\\_private\\_outbound\\_acl\\_rules) | Private subnets outbound network ACLs | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [private\\_route\\_table\\_tags](#input\\_private\\_route\\_table\\_tags) | Additional tags for the private route tables | `map(string)` | `{}` | no |\n+| [private\\_route\\_table\\_tags\\_per\\_az](#input\\_private\\_route\\_table\\_tags\\_per\\_az) | Additional tags for the private route tables where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [private\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_private\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. Default is `false` | `bool` | `false` | no |\n | [private\\_subnet\\_enable\\_dns64](#input\\_private\\_subnet\\_enable\\_dns64) | Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. Default: `true` | `bool` | `true` | no |\n | [private\\_subnet\\_enable\\_resource\\_name\\_dns\\_a\\_record\\_on\\_launch](#input\\_private\\_subnet\\_enable\\_resource\\_name\\_dns\\_a\\_record\\_on\\_launch) | Indicates whether to respond to DNS queries for instance hostnames with DNS A records. Default: `false` | `bool` | `false` | no |\n---\nmain.tf\n@@ -274,6 +274,8 @@ resource \"aws_route_table\" \"private\" {\n },\n var.tags,\n var.private_route_table_tags,\n+ lookup(var.private_route_table_tags_per_az, element(var.azs, count.index), {})\n+\n )\n }\n \n@@ -1096,6 +1098,7 @@ resource \"aws_nat_gateway\" \"this\" {\n },\n var.tags,\n var.nat_gateway_tags,\n+ lookup(var.nat_gateway_tags_per_az, element(var.azs, count.index), {})\n )\n \n depends_on = [aws_internet_gateway.this]\n---\nvariables.tf\n@@ -390,6 +390,12 @@ variable \"private_route_table_tags\" {\n default = {}\n }\n \n+variable \"private_route_table_tags_per_az\" {\n+ description = \"Additional tags for the private route tables where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n ################################################################################\n # Private Network ACLs\n ################################################################################\n@@ -1234,6 +1240,12 @@ variable \"nat_gateway_tags\" {\n default = {}\n }\n \n+variable \"nat_gateway_tags_per_az\" {\n+ description = \"Additional tags for the NAT gateways where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"nat_eip_tags\" {\n description = \"Additional tags for the NAT EIP\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -500,6 +500,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [nat\\_gateway\\_tags\\_per\\_az](#input\\_nat\\_gateway\\_tags\\_per\\_az) | Additional tags for the NAT gateways where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN [private\\_outbound\\_acl\\_rules](#input\\_private\\_outbound\\_acl\\_rules) Outpost you want to create a subnet in | `string` | `null` | no |\n@@ -523,6 +524,7 @@ No modules.\n | [private\\_inbound\\_acl\\_rules](#input\\_private\\_inbound\\_acl\\_rules) | Private subnets inbound network ACLs | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [private\\_outbound\\_acl\\_rules](#input\\_private\\_outbound\\_acl\\_rules) | Private subnets outbound network ACLs | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [private\\_route\\_table\\_tags](#input\\_private\\_route\\_table\\_tags) | Additional tags for the private route tables | `map(string)` | `{}` | no |\n+| [private\\_route\\_table\\_tags\\_per\\_az](#input\\_private\\_route\\_table\\_tags\\_per\\_az) | Additional tags for the private route tables where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [private\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_private\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. Default is `false` | `bool` | `false` | no |\n | [private\\_subnet\\_enable\\_dns64](#input\\_private\\_subnet\\_enable\\_dns64) | Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. Default: `true` | `bool` | `true` | no |\n | [private\\_subnet\\_enable\\_resource\\_name\\_dns\\_a\\_record\\_on\\_launch](#input\\_private\\_subnet\\_enable\\_resource\\_name\\_dns\\_a\\_record\\_on\\_launch) | Indicates whether to respond to DNS queries for instance hostnames with DNS A records. Default: `false` | `bool` | `false` | no |\n---\nmain.tf\n@@ -274,6 +274,8 @@ resource \"aws_route_table\" \"private\" {\n },\n var.tags,\n var.private_route_table_tags,\n+ lookup(var.private_route_table_tags_per_az, element(var.azs, count.index), {})\n+\n )\n }\n \n@@ -1096,6 +1098,7 @@ resource \"aws_nat_gateway\" \"this\" {\n },\n var.tags,\n var.nat_gateway_tags,\n+ lookup(var.nat_gateway_tags_per_az, element(var.azs, count.index), {})\n )\n \n depends_on = [aws_internet_gateway.this]\n---\nvariables.tf\n@@ -390,6 +390,12 @@ variable \"private_route_table_tags\" {\n default = {}\n }\n \n+variable \"private_route_table_tags_per_az\" {\n+ description = \"Additional tags for the private route tables where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n ################################################################################\n # Private Network ACLs\n ################################################################################\n@@ -1234,6 +1240,12 @@ variable \"nat_gateway_tags\" {\n default = {}\n }\n \n+variable \"nat_gateway_tags_per_az\" {\n+ description = \"Additional tags for the NAT gateways where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"nat_eip_tags\" {\n description = \"Additional tags for the NAT EIP\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n\u2026 ensuring compatibility with AWS GovCloud and other partitions\r\n\r\n## Description\r\n Update flow log ARNs to use partition from aws_partition data source, ensuring compatibility with AWS GovCloud and other partitions. This was due to the least privilege change in 5.12.0, 5.11.0 and earlier are fine. See PR [#1088](https://github.com/terraform-aws-modules/terraform-aws-vpc/pull/1088)\r\n\r\n## Motivation and Context\r\nCurrently when deploying to GovCloud with flow logs you get the following error\r\n```\r\nMalformedPolicyDocument: Partition \"aws\" is not valid for resource \"arn:aws:logs:us-gov-west-1:0123456789:log-group:/aws/vpc-flow-log/vpc-012345:*\"\r\n```\r\n\r\n## Breaking Changes\r\nNo\r\n\r\n## How Has This Been Tested?\r\n- [X] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [X] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [X] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -352,6 +352,7 @@ No modules.\n | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |\n | [aws_iam_policy_document.flow_log_cloudwatch_assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.vpc_flow_log_cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |\n | [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |\n \n ## Inputs\n---\nvpc-flow-logs.tf\n@@ -8,6 +8,11 @@ data \"aws_caller_identity\" \"current\" {\n count = var.create_vpc && var.enable_flow_log ? 1 : 0\n }\n \n+data \"aws_partition\" \"current\" {\n+ # Call this API only if create_vpc and enable_flow_log are true\n+ count = var.create_vpc && |\n ? 1 : 0\n+}\n+\n locals {\n # Only create flow log if user selected to create a VPC as well\n enable_flow_log = var.create_vpc && var.enable_flow_log\n@@ -20,7 +25,7 @@ locals {\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n flow_log_group_arns = [\n for log_group in aws_cloudwatch_log_group.flow_log :\n- \"arn:aws:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n ]\n }\n \n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -352,6 +352,7 @@ No modules.\n | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |\n | [aws_iam_policy_document.flow_log_cloudwatch_assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.vpc_flow_log_cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |\n | [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |\n \n ## Inputs\n---\nvpc-flow-logs.tf\n@@ -8,6 +8,11 @@ data \"aws_caller_identity\" \"current\" {\n count = var.create_vpc && var.enable_flow_log ? 1 : 0\n }\n \n+data \"aws_partition\" \"current\" {\n+ # Call this API only if create_vpc and enable_flow_log are true\n+ count = var.create_vpc && var.enable_flow_log ? 1 : 0\n+}\n+\n locals {\n # Only create flow log if user selected to create a VPC as well\n enable_flow_log = var.create_vpc && var.enable_flow_log\n@@ -20,7 +25,7 @@ locals {\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n flow_log_group_arns = [\n for log_group in aws_cloudwatch_log_group.flow_log :\n- \"arn:aws:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n ]\n }\n \n---\n\n\n---\n\nChoice C:\n0\n -352,6 +352,7 @@ No modules.\n | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |\n | [aws_iam_policy_document.flow_log_cloudwatch_assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.vpc_flow_log_cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |\n | [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |\n \n ## Inputs\n---\nvpc-flow-logs.tf\n@@ -8,6 +8,11 @@ data \"aws_caller_identity\" \"current\" {\n count = var.create_vpc && var.enable_flow_log ? 1 : 0\n }\n \n+data \"aws_partition\" \"current\" {\n+ # Call this API only if create_vpc and enable_flow_log are true\n+ count = var.create_vpc && var.enable_flow_log ? 1 : 0\n+}\n+\n locals {\n # Only create flow log if user selected to create a VPC as well\n enable_flow_log = var.create_vpc && var.enable_flow_log\n@@ -20,7 +25,7 @@ locals {\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n flow_log_group_arns = [\n for log_group in aws_cloudwatch_log_group.flow_log :\n- \"arn:aws:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n ]\n }\n \n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -352,6 +352,7 @@ No modules.\n | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |\n | [aws_iam_policy_document.flow_log_cloudwatch_assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.vpc_flow_log_cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |\n | [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |\n \n ## Inputs\n---\nvpc-flow-logs.tf\n@@ -8,6 +8,11 @@ data \"aws_caller_identity\" \"current\" {\n count = var.create_vpc && var.enable_flow_log ? 1 : 0\n }\n \n+data \"aws_partition\" \"current\" {\n+ # Call this API only if create_vpc and enable_flow_log are true\n+ count = var.create_vpc && var.enable_flow_log ? 1 : 0\n+}\n+\n locals {\n # Only create flow log if user selected to create a VPC as well\n enable_flow_log = var.create_vpc && var.enable_flow_log\n@@ -20,7 var.enable_flow_log\n@@ @@ locals {\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n flow_log_group_arns = [\n for log_group in aws_cloudwatch_log_group.flow_log :\n- \"arn:aws:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ \"arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n ]\n }\n \n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nresolves #1108\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -281,6 +281,7 @@ No modules.\n | [aws_default_vpc.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) | resource |\n | [aws_egress_only_internet_gateway.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/egress_only_internet_gateway) | resource |\n | [aws_eip.nat](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource |\n+| [aws_eip.secondary](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource |\n | [aws_elasticache_subnet_group.elasticache](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_subnet_group) | resource |\n | [aws_flow_log.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/flow_log) | resource |\n | [aws_iam_policy.vpc_flow_log_cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |\n@@ -500,6 +501,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [number\\_of\\_secondary\\_eips\\_per\\_gateway](#input\\_number\\_of\\_secondary\\_eips\\_per\\_gateway) | how many secondary eips per NAT Gateway | `number` | `0` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires tags to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n---\nexamples/complete/main.tf\n@@ -68,6 +68,8 @@ module \"vpc\" {\n \n enable_vpn_gateway = true\n \n+ number_of_secondary_eips_per_gateway = 2\n+\n enable_dhcp_options = true\n dhcp_options_domain_name = \"service.consul\"\n dhcp_options_domain_name_servers = [\"127.0.0.1\", \"10.10.0.2\"]\n---\nmain.tf\n@@ -1054,6 +1054,7 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n locals {\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : aws_eip.nat[*].id\n+ seips_suffixs = [for num in range(0, var.number_of_secondary_eips_per_gateway) : \"s${num + 1}\"]\n }\n \n resource \"aws_eip\" \"nat\" {\n@@ -1075,6 +1076,22 @@ resource \"aws_eip\" \"nat\" {\n depends_on = [aws_internet_gateway.this]\n }\n \n+resource \"aws_eip\" \"secondary\" {\n+ for_each = toset(flatten([for nat in aws_eip.nat : [for suffix in local.seips_suffixs : \"${nat.tags.Name}-${suffix}\"]]))\n+\n+ domain = \"vpc\"\n+\n+ tags = merge(\n+ {\n+ \"Name\" = each.key,\n+ },\n+ var.tags,\n+ var.nat_eip_tags,\n+ )\n+\n+ depends_on = [aws_internet_gateway.this]\n+}\n+\n resource \"aws_nat_gateway\" \"this\" {\n count = local.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n \n@@ -1087,6 +1104,8 @@ resource \"aws_nat_gateway\" \"this\" {\n var.single_nat_gateway ? 0 : count.index,\n )\n \n+ secondary_allocation_ids = [for suffix in local.seips_suffixs : aws_eip.secondary[\"${aws_eip.nat[count.index].tags.Name}-${suffix}\"].allocation_id]\n+\n tags = merge(\n {\n \"Name\" = format(\n---\nvariables.tf\n@@ -1228,6 +1228,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"number_of_secondary_eips_per_gateway\" {\n+ description = \"how many secondary eips per NAT Gateway\"\n+ type = number\n+ default = 0\n+}\n+\n variable \"nat_gateway_tags\" {\n description = \"Additional tags for the NAT gateways\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -281,6 +281,7 @@ No modules.\n | [aws_default_vpc.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) | resource |\n | [aws_egress_only_internet_gateway.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/egress_only_internet_gateway) | resource |\n | [aws_eip.nat](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource |\n+| [aws_eip.secondary](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource |\n | [aws_elasticache_subnet_group.elasticache](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_subnet_group) | resource |\n | [aws_flow_log.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/flow_log) | resource |\n | [aws_iam_policy.vpc_flow_log_cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |\n@@ -500,6 +501,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags name=\"input_one_nat_gateway_per_az\"> the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [number\\_of\\_secondary\\_eips\\_per\\_gateway](#input\\_number\\_of\\_secondary\\_eips\\_per\\_gateway) | how many secondary eips per NAT Gateway | `number` | `0` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n---\nexamples/complete/main.tf\n@@ -68,6 +68,8 @@ module \"vpc\" {\n \n enable_vpn_gateway = true\n \n+ number_of_secondary_eips_per_gateway = 2\n+\n enable_dhcp_options = true\n dhcp_options_domain_name = \"service.consul\"\n dhcp_options_domain_name_servers = [\"127.0.0.1\", \"10.10.0.2\"]\n---\nmain.tf\n@@ -1054,6 +1054,7 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n locals {\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : aws_eip.nat[*].id\n+ seips_suffixs = [for num in range(0, var.number_of_secondary_eips_per_gateway) : \"s${num + 1}\"]\n }\n \n resource \"aws_eip\" \"nat\" {\n@@ -1075,6 +1076,22 @@ resource \"aws_eip\" \"nat\" {\n depends_on = [aws_internet_gateway.this]\n }\n \n+resource \"aws_eip\" \"secondary\" {\n+ for_each = toset(flatten([for nat in aws_eip.nat : [for suffix in local.seips_suffixs : \"${nat.tags.Name}-${suffix}\"]]))\n+\n+ domain = \"vpc\"\n+\n+ tags = merge(\n+ {\n+ \"Name\" = each.key,\n+ },\n+ var.tags,\n+ var.nat_eip_tags,\n+ )\n+\n+ depends_on = [aws_internet_gateway.this]\n+}\n+\n resource \"aws_nat_gateway\" \"this\" {\n count = local.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n \n@@ -1087,6 +1104,8 @@ resource \"aws_nat_gateway\" \"this\" {\n var.single_nat_gateway ? 0 : count.index,\n )\n \n+ secondary_allocation_ids = [for suffix in local.seips_suffixs : aws_eip.secondary[\"${aws_eip.nat[count.index].tags.Name}-${suffix}\"].allocation_id]\n+\n tags = merge(\n {\n \"Name\" = format(\n---\nvariables.tf\n@@ -1228,6 +1228,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"number_of_secondary_eips_per_gateway\" {\n+ description = \"how many secondary eips per NAT Gateway\"\n+ type = number\n+ default = 0\n+}\n+\n variable \"nat_gateway_tags\" {\n description = \"Additional tags for the NAT gateways\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -281,6 +281,7 @@ No modules.\n | [aws_default_vpc.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) | resource |\n | [aws_egress_only_internet_gateway.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/egress_only_internet_gateway) | resource |\n | [aws_eip.nat](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource |\n+| [aws_eip.secondary](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource |\n | [aws_elasticache_subnet_group.elasticache](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_subnet_group) | resource |\n | [aws_flow_log.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/flow_log) | resource |\n | [aws_iam_policy.vpc_flow_log_cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |\n@@ -500,6 +501,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [number\\_of\\_secondary\\_eips\\_per\\_gateway](#input\\_number\\_of\\_secondary\\_eips\\_per\\_gateway) | how many secondary eips per NAT Gateway | `number` | `0` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n---\nexamples/complete/main.tf\n@@ -68,6 +68,8 @@ module \"vpc\" {\n \n enable_vpn_gateway = true\n \n+ number_of_secondary_eips_per_gateway = 2\n+\n enable_dhcp_options = true\n dhcp_options_domain_name = \"service.consul\"\n dhcp_options_domain_name_servers = [\"127.0.0.1\", \"10.10.0.2\"]\n---\nmain.tf\n@@ -1054,6 +1054,7 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n locals {\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : aws_eip.nat[*].id\n+ seips_suffixs = [for num in range(0, var.number_of_secondary_eips_per_gateway) : \"s${num + 1}\"]\n }\n \n resource \"aws_eip\" \"nat\" {\n@@ -1075,6 +1076,22 @@ resource \"aws_eip\" \"nat\" {\n depends_on = [aws_internet_gateway.this]\n }\n \n+resource \"aws_eip\" count.index,\n {\n+ for_each = toset(flatten([for nat in aws_eip.nat : [for suffix in local.seips_suffixs : \"${nat.tags.Name}-${suffix}\"]]))\n+\n+ domain = \"vpc\"\n+\n+ tags = merge(\n+ {\n+ \"Name\" = each.key,\n+ },\n+ var.tags,\n+ var.nat_eip_tags,\n+ )\n+\n+ depends_on = [aws_internet_gateway.this]\n+}\n+\n resource \"aws_nat_gateway\" \"this\" {\n count = local.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n \n@@ -1087,6 +1104,8 @@ resource \"aws_nat_gateway\" \"this\" {\n var.single_nat_gateway ? 0 : count.index,\n )\n \n+ secondary_allocation_ids = [for suffix in local.seips_suffixs : aws_eip.secondary[\"${aws_eip.nat[count.index].tags.Name}-${suffix}\"].allocation_id]\n+\n tags = merge(\n {\n \"Name\" = format(\n---\nvariables.tf\n@@ -1228,6 +1228,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"number_of_secondary_eips_per_gateway\" {\n+ description = \"how many secondary eips per NAT Gateway\"\n+ type = number\n+ default = 0\n+}\n+\n variable \"nat_gateway_tags\" {\n description = \"Additional tags for the NAT gateways\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -281,6 +281,7 @@ No modules.\n | [aws_default_vpc.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) | resource |\n | [aws_egress_only_internet_gateway.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/egress_only_internet_gateway) | resource |\n | [aws_eip.nat](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource |\n+| [aws_eip.secondary](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) | resource |\n | [aws_elasticache_subnet_group.elasticache](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_subnet_group) | resource |\n | [aws_flow_log.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/flow_log) | resource |\n | [aws_iam_policy.vpc_flow_log_cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |\n@@ -500,6 +501,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [number\\_of\\_secondary\\_eips\\_per\\_gateway](#input\\_number\\_of\\_secondary\\_eips\\_per\\_gateway) | how many secondary eips per NAT Gateway | `number` | `0` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n---\nexamples/complete/main.tf\n@@ -68,6 +68,8 @@ module \"vpc\" {\n \n enable_vpn_gateway = true\n \n+ number_of_secondary_eips_per_gateway = 2\n+\n enable_dhcp_options = true\n dhcp_options_domain_name = \"service.consul\"\n dhcp_options_domain_name_servers = [\"127.0.0.1\", \"10.10.0.2\"]\n---\nmain.tf\n@@ -1054,6 +1054,7 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n locals {\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : aws_eip.nat[*].id\n+ seips_suffixs = [for num in range(0, var.number_of_secondary_eips_per_gateway) : \"s${num + 1}\"]\n }\n \n resource \"aws_eip\" \"nat\" {\n@@ -1075,6 +1076,22 @@ resource \"aws_eip\" \"nat\" {\n depends_on = [aws_internet_gateway.this]\n }\n \n+resource \"aws_eip\" \"secondary\" {\n+ for_each = toset(flatten([for nat in aws_eip.nat : [for suffix in local.seips_suffixs : \"${nat.tags.Name}-${suffix}\"]]))\n+\n+ domain = \"vpc\"\n+\n+ tags = merge(\n+ {\n+ \"Name\" = each.key,\n+ },\n+ var.tags,\n+ var.nat_eip_tags,\n+ )\n+\n+ depends_on = [aws_internet_gateway.this]\n+}\n+\n resource \"aws_nat_gateway\" \"this\" {\n count = local.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n \n@@ -1087,6 +1104,8 @@ resource \"aws_nat_gateway\" \"this\" {\n var.single_nat_gateway ? 0 : count.index,\n )\n \n+ secondary_allocation_ids = [for suffix in local.seips_suffixs : aws_eip.secondary[\"${aws_eip.nat[count.index].tags.Name}-${suffix}\"].allocation_id]\n+\n tags = merge(\n {\n \"Name\" = format(\n---\nvariables.tf\n@@ -1228,6 +1228,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"number_of_secondary_eips_per_gateway\" {\n+ description = \"how many secondary eips per NAT Gateway\"\n+ type = number\n+ default = 0\n+}\n+\n variable \"nat_gateway_tags\" {\n description = \"Additional tags for the NAT gateways\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nMakes the count on `aws_route` dynamic instead of fixed at 1\r\n\r\n## Motivation and Context\r\nFixes #1087 \r\n\r\n## Breaking Changes\r\nNot that I'm aware of.\r\n\r\n## How Has This Been Tested?\r\n- [X] I have tested and validated these changes in a VPC in my environment that have a single public route table as well as another VPC that has multiple public route tables\r\n\r\n\r\n\r\n- [X] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -153,9 +153,9 @@ resource \"aws_route_table_association\" \"public\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n- count = local.create_public_subnets && var.create_igw ? 1 : 0\n+ count \"0.0.0.0/0\"\n local.create_public_subnets && var.create_igw ? local.num_public_route_tables : 0\n \n- route_table_id = aws_route_table.public[0].id\n+ route_table_id = aws_route_table.public[count.index].id\n destination_cidr_block = \"0.0.0.0/0\"\n gateway_id = aws_internet_gateway.this[0].id\n \n@@ -165,9 +165,9 @@ resource \"aws_route\" \"public_internet_gateway\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway_ipv6\" {\n- count = local.create_public_subnets && var.create_igw && var.enable_ipv6 ? 1 : 0\n+ count = local.create_public_subnets && var.create_igw && var.enable_ipv6 ? local.num_public_route_tables : 0\n \n- route_table_id = aws_route_table.public[0].id\n+ route_table_id = aws_route_table.public[count.index].id\n destination_ipv6_cidr_block = \"::/0\"\n gateway_id = aws_internet_gateway.this[0].id\n }\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -153,9 +153,9 @@ resource \"aws_route_table_association\" \"public\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n- count = local.create_public_subnets && var.create_igw ? 1 : 0\n+ count = local.create_public_subnets && var.create_igw ? local.num_public_route_tables : 0\n \n- route_table_id = aws_route_table.public[0].id\n+ route_table_id \"public_internet_gateway_ipv6\" = aws_route_table.public[count.index].id\n destination_cidr_block = \"0.0.0.0/0\"\n gateway_id = aws_internet_gateway.this[0].id\n \n@@ -165,9 +165,9 @@ resource \"aws_route\" \"public_internet_gateway\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway_ipv6\" {\n- count = local.create_public_subnets && var.create_igw && var.enable_ipv6 ? 1 : 0\n+ count = local.create_public_subnets && var.create_igw && var.enable_ipv6 ? local.num_public_route_tables : 0\n \n- route_table_id = aws_route_table.public[0].id\n+ route_table_id = aws_route_table.public[count.index].id\n destination_ipv6_cidr_block = \"::/0\"\n gateway_id = aws_internet_gateway.this[0].id\n }\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -153,9 +153,9 @@ resource \"aws_route_table_association\" \"public\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n- count = local.create_public_subnets && var.create_igw ? 1 : 0\n+ count = local.create_public_subnets && var.create_igw ? local.num_public_route_tables : 0\n \n- route_table_id = aws_route_table.public[0].id\n+ = route_table_id = aws_route_table.public[count.index].id\n destination_cidr_block = \"0.0.0.0/0\"\n gateway_id = aws_internet_gateway.this[0].id\n \n@@ -165,9 +165,9 @@ resource \"aws_route\" \"public_internet_gateway\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway_ipv6\" {\n- count = local.create_public_subnets && var.create_igw && var.enable_ipv6 ? 1 : 0\n+ count = local.create_public_subnets && var.create_igw && var.enable_ipv6 ? local.num_public_route_tables : 0\n \n- route_table_id = aws_route_table.public[0].id\n+ route_table_id = aws_route_table.public[count.index].id\n destination_ipv6_cidr_block = \"::/0\"\n gateway_id = aws_internet_gateway.this[0].id\n }\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -153,9 +153,9 @@ resource \"aws_route_table_association\" \"public\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n- count = local.create_public_subnets && var.create_igw ? 1 : 0\n+ count = local.create_public_subnets && var.create_igw ? local.num_public_route_tables : 0\n \n- route_table_id = aws_route_table.public[0].id\n+ route_table_id = aws_route_table.public[count.index].id\n destination_cidr_block = \"0.0.0.0/0\"\n gateway_id = aws_internet_gateway.this[0].id\n \n@@ -165,9 +165,9 @@ resource \"aws_route\" \"public_internet_gateway\" {\n }\n \n resource \"aws_route\" \"public_internet_gateway_ipv6\" {\n- count = local.create_public_subnets && var.create_igw && var.enable_ipv6 ? 1 : 0\n+ count = local.create_public_subnets && var.create_igw && var.enable_ipv6 ? local.num_public_route_tables : 0\n \n- route_table_id = aws_route_table.public[0].id\n+ route_table_id = aws_route_table.public[count.index].id\n destination_ipv6_cidr_block = \"::/0\"\n gateway_id = aws_internet_gateway.this[0].id\n }\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAllow option in whether or not to create a route to the NAT gateway in private subnets.\r\n\r\n## Motivation and Context\r\nThere are use cases where the creation of this route is undesired. One example is in the use of a VPC network firewall, where the route destination would be the VPC endpoint of the firewall.\r\n\r\n## Breaking Changes\r\nNo breaking changes.\r\n\r\n## How Has This Been Tested?\r\n- [ x ] I have tested and validated these changes in a VPC in my own environment\r\n\r\n\r\n\r\n- [ x ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -371,6 +371,7 @@ No modules.\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n | [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n+| [create\\_private\\_nat\\_gateway\\_route](#input\\_create\\_private\\_nat\\_gateway\\_route) | Controls if a NAT gateway route for private subnet routing table should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -1101,7 +1101,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = local.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = local.create_vpc && var.enable_nat_gateway && var.create_private_nat_gateway_route ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\nvariables.tf\n@@ -366,6 +366,12 @@ variable \"private_subnet_suffix\" {\n default = \"private\"\n }\n \n+variable \"create_private_nat_gateway_route\" {\n+ description = \"Controls if a NAT gateway route for private subnet routing table should be created\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -371,6 +371,7 @@ No modules.\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n | [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n+| [create\\_private\\_nat\\_gateway\\_route](#input\\_create\\_private\\_nat\\_gateway\\_route) | Controls if a NAT gateway route for private subnet routing table should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -1101,7 +1101,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = local.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = local.create_vpc && var.enable_nat_gateway && var.create_private_nat_gateway_route ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\nvariables.tf\n@@ -366,6 +366,12 @@ variable \"private_subnet_suffix\" {\n default = \"private\"\n }\n \n+variable \"create_private_nat_gateway_route\" {\n+ description = \"Controls if a NAT gateway route for private subnet routing table should be created\"\n+ type | = bool\n+ default = true\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -371,6 +371,7 @@ No modules.\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n | [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n+| [create\\_private\\_nat\\_gateway\\_route](#input\\_create\\_private\\_nat\\_gateway\\_route) | Controls if a NAT gateway route for private subnet routing table should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -1101,7 +1101,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = local.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = local.create_vpc && var.enable_nat_gateway && var.create_private_nat_gateway_route ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\nvariables.tf\n@@ -366,6 +366,12 @@ variable \"private_subnet_suffix\" {\n default = \"private\"\n }\n \n+variable \"create_private_nat_gateway_route\" {\n+ description = \"Controls if a NAT gateway route for private subnet routing table should be created\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"private_subnet_tags\" `false` description = \"Additional tags for the private subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -371,6 +371,7 @@ No modules.\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n | [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n+| [create\\_private\\_nat\\_gateway\\_route](#input\\_create\\_private\\_nat\\_gateway\\_route) | Controls if a NAT gateway route for private subnet routing table should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -1101,7 +1101,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = local.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = local.create_vpc && var.enable_nat_gateway && var.create_private_nat_gateway_route ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\nvariables.tf\n@@ -366,6 +366,12 @@ variable \"private_subnet_suffix\" {\n default = \"private\"\n }\n \n+variable \"create_private_nat_gateway_route\" {\n+ description = \"Controls if a NAT gateway route for private subnet routing table should be created\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nHOMEWORK2.txt\n@@ -0,0 +1,64 @@\n+1. Explain the git workflow\n+A typical Git workflow involves a series of steps to manage changes in your projects codebase. Here is an overview of the most common Git workflow used in collaborative projects:\n+a. Clone the Repository\n+b. Create a New Branch\n+c. Make Changes and Commit \n+d. Push the Branch to the Remote Repository\n+e. Create a Pull Request\n+f. Code Review and Feedback\n+g. Merge the Pull Request\n+f. Delete branch when done and continue cycle when another branch is needed\n+\n+2. How do you clone a git repository\n+Inorder to clone a git reop,you got to your repository and copy the url then come to you IDE and use the command git clone 'URL' that will clone your\u00a0reposiotory.\n+\n+3. How do you check the status of your Git repository?\n+To check the status of your Git repository, you can use the git status command. This command provides information about the current state of the working directory and the staging area. It helps you see which changes have been staged, which haven't, and which files aren't being tracked by Git.\n+\n+4. How do a stage and commit changes?\n+To stage changes you use the command git add 'file name'\n+To cmmint changes use the command git commint -m\n+\n+\n+5. How do you create a new branch?\n+To create a new branch you can use the command git branch 'branch name'.\n+\n+\n+6. Explain the concept of git branching strategy\n+A Git branching strategy is a workflow that outlines how branches are used within a repository. It helps teams manage parallel work, isolate feature development, handle bug fixes, and prepare releases efficiently. Below are several commonly used branching strategies:\n+a. Git Flow\n+Git Flow is a branching strategy that emphasizes a strict branching model for project development. It includes several branch types:\n+ain branch,Develop Branch,Feature Branches,Release Branches,Hotfix Branches.\n+b. GitHub Flow\n+GitHub Flow is a simpler, more streamlined branching strategy suitable for continuous deployment. It uses only two main branches ie. Main Branch and feature branch.\n+c. GitLab Flow\n+GitLab Flow integrates with GitLab's CI/CD capabilities and supports various environments like development, staging, and production. It emphasizes Main Branch,Environment Branches and Feature Branches\n+d. Trunk-Based Development\n+Trunk-Based Development is a branching strategy where all developers work on a single branch, usually main. Short-lived feature branches may be created but are merged back into the main branch frequently, sometimes several times a day.\n+\n+\n+7. How do you switch to a different branch?\n+The command, git switch 'branch name'/git checkout 'branch name ' can be used.\n+\n+\n+8. How do you merge one branch into another?\n+Merging one branch into another in Git is a common task, often used to integrate changes from different branches. Here\u2019s a step-by-step guide on how to do it\n+\n+\n+9. What is a merge conflict and how do you resolve it?\n+Merge conflicts occurs when two branches being merged have changes on the the same file and commit that is when a conflict occurs.\n+Solutions\n+a. making smaller commits as frequent as possible\n+b. Frequent pulling/merging\n+c. Communication\n+\n+10. Why is branching important in Git?\n+Branching gives you the freedom to independently work on different modules and merge the modules when you finish\n+\n+11. What is a pull request PR and what is its purpose?\n+A pull request is a proposal to merge a group of changes from one branch into another. In a pull request, collaborators can review and discuss the proposed set of changes before they integrate the changes into the main codebase.\n+\n+12. Forks let you make changes to a project without affecting the original repository, also known as the upstream repository.\n+\n+13. How do you find a specific commit in the history?\n+You can use th \n\\ No newline at end of file\n---\n\n\n---\n\nChoice B:\nHOMEWORK2.txt\n@@ -0,0 +1,64 @@\n+1. Explain the git workflow\n+A typical Git workflow involves a series of steps to manage changes in your projects codebase. Here is an overview of the most common Git workflow used in collaborative projects:\n+a. Clone the Repository\n+b. Create a New Branch\n+c. Make Changes and Commit \n+d. Push the Branch to the Remote Repository\n+e. Create a Pull Request\n+f. Code Review and Feedback\n+g. Merge the Pull Request\n+f. Delete branch when done and continue cycle when another branch is needed\n+\n+2. How do you clone a git repository\n+Inorder to clone a git reop,you got to your repository and copy the url then come to you IDE and use the command git clone 'URL' that will clone your\u00a0reposiotory.\n+\n+3. How do you check the status of your Git repository?\n+To check the status of your Git repository, you can use the git status command. This command provides information about the current state of the working directory and the staging area. It helps you see which changes have been staged, which haven't, and which files aren't being tracked by Git.\n+\n+4. How do you stage and commit changes?\n+To stage changes you use the command git add 'file name'\n+To cmmint changes use the command git commint -m\n+\n+\n+5. How do you create a new branch?\n+To create a new branch you can use the command git branch 'branch name'.\n+\n+\n+6. Explain the concept of git branching strategy\n+A Git branching strategy is a workflow that outlines how branches are used within a repository. It helps teams manage parallel work, isolate feature development, handle bug fixes, and prepare releases efficiently. Below are several commonly used branching strategies:\n+a. Git Flow\n+Git Flow is a branching strategy that emphasizes a strict branching model for project development. It which several branch types:\n+ain branch,Develop Branch,Feature Branches,Release Branches,Hotfix Branches.\n+b. GitHub Flow\n+GitHub Flow is a simpler, more streamlined branching strategy suitable for continuous deployment. It uses only two main branches ie. Main Branch and feature branch.\n+c. GitLab Flow\n+GitLab Flow integrates with GitLab's CI/CD capabilities and supports various environments like development, staging, and production. It emphasizes Main Branch,Environment Branches and Feature Branches\n+d. Trunk-Based Development\n+Trunk-Based Development is a branching strategy where all developers work on a single branch, usually main. Short-lived feature branches may be created but are merged back into the main branch frequently, sometimes several times a day.\n+\n+\n+7. How do you switch to a different branch?\n+The command, git switch 'branch name'/git checkout 'branch name ' can be used.\n+\n+\n+8. How do you merge one branch into another?\n+Merging one branch into another in Git is a common task, often used to integrate changes from different branches. Here\u2019s a step-by-step guide on how to do it\n+\n+\n+9. What is a merge conflict and how do you resolve it?\n+Merge conflicts occurs when two branches being merged have changes on the the same file and commit that is when a conflict occurs.\n+Solutions\n+a. making smaller commits as frequent as possible\n+b. Frequent pulling/merging\n+c. Communication\n+\n+10. Why is branching important in Git?\n+Branching gives you the freedom to independently work on different modules and merge the modules when you finish\n+\n+11. What is a pull request PR and what is its purpose?\n+A pull request is a proposal to merge a group of changes from one branch into another. In a pull request, collaborators can review and discuss the proposed set of changes before they integrate the changes into the main codebase.\n+\n+12. Forks let you make changes to a project without affecting the original repository, also known as the upstream repository.\n+\n+13. How do you find a specific commit in the history?\n+You can use th \n\\ No newline at end of file\n---\n\n\n---\n\nChoice C:\nHOMEWORK2.txt\n@@ -0,0 +1,64 @@\n+1. Explain the git workflow\n+A typical Git workflow involves a series of steps to manage changes in your projects codebase. Here is an overview of the most common Git workflow used in collaborative projects:\n+a. Clone the Repository\n+b. Create a New Branch\n+c. Make Changes and Commit \n+d. Push the Branch to the Remote Repository\n+e. Create a Pull Request\n+f. Code Review and Feedback\n+g. Merge the Pull Request\n+f. Delete branch when done and continue cycle when another branch is needed\n+\n+2. How do you clone a git repository\n+Inorder to clone a git reop,you got to your repository and copy the url then come to you IDE and use the command git clone 'URL' that will clone your\u00a0reposiotory.\n+\n+3. How do you check the status of your Git repository?\n+To check the status of your Git repository, you can use the git status command. This command provides information about the current state of the working directory and the staging area. It helps you see which changes have been staged, which haven't, and which files aren't being tracked by Git.\n+\n+4. How do you stage and commit changes?\n+To stage changes you use the command git add 'file name'\n+To cmmint changes use the command git commint -m\n+\n+\n+5. How do you create a new branch?\n+To create a new branch you can use the command git branch 'branch name'.\n+\n+\n+6. Explain the concept of git branching strategy\n+A Git branching strategy is a workflow that outlines how branches are used within a repository. It helps teams manage parallel work, isolate feature development, handle bug fixes, and prepare releases efficiently. Below are several commonly used branching strategies:\n+a. Git Flow\n+Git Flow is a branching strategy that emphasizes a strict branching model for project development. It includes several branch types:\n+ain branch,Develop Branch,Feature Branches,Release Branches,Hotfix Branches.\n+b. GitHub Flow\n+GitHub Flow is a simpler, more streamlined branching strategy suitable for continuous deployment. It uses only two main branches ie. Main Branch and feature branch.\n+c. GitLab Flow\n+GitLab Flow integrates with GitLab's CI/CD capabilities and supports various environments like development, staging, and production. It emphasizes Main Branch,Environment Branches and Feature Branches\n+d. Trunk-Based Development\n+Trunk-Based Development is a branching strategy where all developers work on a single branch, usually main. Short-lived feature branches may be created but are merged back into the main branch frequently, sometimes several times a day.\n+\n+\n+7. How do you switch to a different branch?\n+The command, git switch 'branch name'/git checkout 'branch name ' can be used.\n+\n+\n+8. How do you merge one branch into another?\n+Merging one branch into another in Git is a common task, often used to integrate changes from different branches. Here\u2019s a step-by-step guide on how to do it\n+\n+\n+9. What is a merge conflict and how do you resolve it?\n+Merge conflicts occurs when two branches being merged have changes on the the same file and commit that is when a conflict occurs.\n+Solutions\n+a. making smaller commits as frequent as possible\n+b. Frequent pulling/merging\n+c. Communication\n+\n+10. Why is branching important in Git?\n+Branching gives you the freedom to independently work on different modules and merge the modules when you finish\n+\n+11. What is a pull request PR and what is its purpose?\n+A pull request is a proposal to merge a group of changes from one branch into another. In a pull request, collaborators can review and discuss the proposed set of changes before they projects:\n+a. the changes into the main codebase.\n+\n+12. Forks let you make changes to a project without affecting the original repository, also known as the upstream repository.\n+\n+13. How do you find a specific commit in the history?\n+You can use th \n\\ No newline at end of file\n---\n\n\n---\n\nChoice D:\nHOMEWORK2.txt\n@@ -0,0 +1,64 @@\n+1. Explain the git workflow\n+A typical Git workflow involves a series of steps to manage changes in your projects codebase. Here is an overview of the most common Git workflow used in collaborative projects:\n+a. Clone the Repository\n+b. Create a New Branch\n+c. Make Changes and Commit \n+d. Push the Branch to the Remote Repository\n+e. Create a Pull Request\n+f. Code Review and Feedback\n+g. Merge the Pull Request\n+f. Delete branch when done and continue cycle when another branch is needed\n+\n+2. How do you clone a git repository\n+Inorder to clone a git reop,you got to your repository and copy the url then come to you IDE and use the command git clone 'URL' that will clone your\u00a0reposiotory.\n+\n+3. How do you check the status of your Git repository?\n+To check the status of your Git repository, you can use the git status command. This command provides information about the current state of the working directory and the staging area. It helps you see which changes have been staged, which haven't, and which files aren't being tracked by Git.\n+\n+4. How do you stage and commit changes?\n+To stage changes you use the command git add 'file name'\n+To cmmint changes use the command git commint -m\n+\n+\n+5. How do you create a new branch?\n+To create a new branch you can use the command git branch 'branch name'.\n+\n+\n+6. Explain the concept of git branching strategy\n+A Git branching strategy is a workflow that outlines how branches are used within a repository. It helps teams manage parallel work, isolate feature development, handle bug fixes, and prepare releases efficiently. Below are several commonly used branching strategies:\n+a. Git Flow\n+Git Flow is a branching strategy that emphasizes a strict branching model for project development. It includes several branch types:\n+ain branch,Develop Branch,Feature Branches,Release Branches,Hotfix Branches.\n+b. GitHub Flow\n+GitHub Flow is a simpler, more streamlined branching strategy suitable for continuous deployment. It uses only two main branches ie. Main Branch and feature branch.\n+c. GitLab Flow\n+GitLab Flow integrates with GitLab's CI/CD capabilities and supports various environments like development, staging, and production. It emphasizes Main Branch,Environment Branches and Feature Branches\n+d. Trunk-Based Development\n+Trunk-Based Development is a branching strategy where all developers work on a single branch, usually main. Short-lived feature branches may be created but are merged back into the main branch frequently, sometimes several times a day.\n+\n+\n+7. How do you switch to a different branch?\n+The command, git switch 'branch name'/git checkout 'branch name ' can be used.\n+\n+\n+8. How do you merge one branch into another?\n+Merging one branch into another in Git is a common task, often used to integrate changes from different branches. Here\u2019s a step-by-step guide on how to do it\n+\n+\n+9. What is a merge conflict and how do you resolve it?\n+Merge conflicts occurs when two branches being merged have changes on the the same file and commit that is when a conflict occurs.\n+Solutions\n+a. making smaller commits as frequent as possible\n+b. Frequent pulling/merging\n+c. Communication\n+\n+10. Why is branching important in Git?\n+Branching gives you the freedom to independently work on different modules and merge the modules when you finish\n+\n+11. What is a pull request PR and what is its purpose?\n+A pull request is a proposal to merge a group of changes from one branch into another. In a pull request, collaborators can review and discuss the proposed set of changes before they integrate the changes into the main codebase.\n+\n+12. Forks let you make changes to a project without affecting the original repository, also known as the upstream repository.\n+\n+13. How do you find a specific commit in the history?\n+You can use th \n\\ No newline at end of file\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdded parameter ip_address_type to allow ipv4. ipv6 and dualstack ip_address_type support\r\n\r\n## Motivation and Context\r\nTo solve issue #1091 \r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\n- [*] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [*] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [*] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/main.tf\n@@ -33,6 +33,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n route_table_ids try(each.value.private_dns_enabled, try(each.value.service_type, \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = try(each.value.policy, null)\n private_dns_enabled = try(each.value.service_type, \"Interface\") == \"Interface\" ? try(each.value.private_dns_enabled, null) : null\n+ ip_address_type = try(each.value.ip_address_type, null)\n \n dynamic \"dns_options\" {\n for_each = try([each.value.dns_options], [])\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/main.tf\n@@ -33,6 +33,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n ip_address_type = try(each.value.service_type, \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = try(each.value.policy, null)\n private_dns_enabled = try(each.value.service_type, \"Interface\") == \"Interface\" ? try(each.value.private_dns_enabled, null) : null\n+ ip_address_type = try(each.value.ip_address_type, null)\n \n dynamic \"dns_options\" {\n for_each = try([each.value.dns_options], [])\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/main.tf\n@@ -33,6 +33,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n route_table_ids = try(each.value.service_type, \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = = try(each.value.policy, null)\n private_dns_enabled = try(each.value.service_type, \"Interface\") == \"Interface\" ? try(each.value.private_dns_enabled, null) : null\n+ ip_address_type = try(each.value.ip_address_type, null)\n \n dynamic \"dns_options\" {\n for_each = try([each.value.dns_options], [])\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/main.tf\n@@ -33,6 +33,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n route_table_ids = try(each.value.service_type, \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = try(each.value.policy, null)\n private_dns_enabled = try(each.value.service_type, \"Interface\") == \"Interface\" ? try(each.value.private_dns_enabled, null) : null\n+ ip_address_type = try(each.value.ip_address_type, null)\n \n dynamic \"dns_options\" {\n for_each = try([each.value.dns_options], [])\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nwarm\n@@ -0,0 +1 @@\n+beautifly warm weather today\n\\ No newline at end of file\n---\n\n\n---\n\nChoice B:\nwarm\n@@ today\n\\ +1 @@\n+beautifly warm weather today\n\\ No newline at end of file\n---\n\n\n---\n\nChoice C:\n+1 -0,0 +1 @@\n+beautifly warm weather today\n\\ No newline at end of file\n---\n\n\n---\n\nChoice D:\nwarm\n@@ -0,0 +1 @@\n+beautifly warm weather today\n\\ No newline at end at file\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nfile\n---\n -0,0 +1 @@\n+my name is akoto\n\\ No newline at end of file\n---\n\n\n---\n\nChoice B:\ndev.tf\n@@ -0,0 +1 @@\n+my name is akoto\n\\ No newline at end of @@\n+my\n\n---\n\nChoice C:\ndev.tf\n@@ -0,0 +1 @@\n+my name is akoto\n\\ No newline at end of file\n---\n\n\n---\n\nChoice D:\ndev.tf\n@@ -0,0 +1 @@\n+my name is akoto\n\\ No dev.tf\n@@ at end of file\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nFixes creating NAT gateway route table associations even when enable_nat_gateway=false\r\n\r\n## Motivation and Context\r\nMore detailed description of the issue is here https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1031\r\n\r\n## Breaking Changes\r\nno breaking changes\r\n\r\n## How Has This Been Tested?\r\nTested in production TGW environment with no NAT gw route table associations\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -278,7 +278,7 @@ resource \"aws_route_table\" \"private\" {\n }\n \n resource \"aws_route_table_association\" \"private\" {\n- count = local.create_private_subnets ? local.len_private_subnets : 0\n+ count = local.create_private_subnets && var.enable_nat_gateway ? local.len_private_subnets : 0\n \n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n@@ -412,7 +412,7 @@ resource \"aws_route_table\" \"database\" {\n }\n \n resource \"aws_route_table_association\" \"database\" {\n- count = local.create_database_subnets ? local.len_database_subnets : 0\n+ count = local.create_database_subnets && var.enable_nat_gateway ? local.len_database_subnets : 0\n \n subnet_id = element(aws_subnet.database[*].id, count.index)\n route_table_id = element(\n@@ -724,7 +724,7 @@ resource \"aws_route_table\" \"elasticache\" {\n }\n \n resource \"aws_route_table_association\" \"elasticache\" {\n- count = local.create_elasticache_subnets ? local.len_elasticache_subnets : 0\n+ count = local.create_elasticache_subnets count var.enable_nat_gateway ? local.len_elasticache_subnets : 0\n \n subnet_id = element(aws_subnet.elasticache[*].id, count.index)\n route_table_id = element(\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -278,7 +278,7 @@ resource \"aws_route_table\" \"private\" {\n }\n \n resource \"aws_route_table_association\" \"private\" {\n- count = local.create_private_subnets ? local.len_private_subnets : 0\n+ count = }\n && var.enable_nat_gateway ? local.len_private_subnets : 0\n \n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n@@ -412,7 +412,7 @@ resource \"aws_route_table\" \"database\" {\n }\n \n resource \"aws_route_table_association\" \"database\" {\n- count = local.create_database_subnets ? local.len_database_subnets : 0\n+ count = local.create_database_subnets && var.enable_nat_gateway ? local.len_database_subnets : 0\n \n subnet_id = element(aws_subnet.database[*].id, count.index)\n route_table_id = element(\n@@ -724,7 +724,7 @@ resource \"aws_route_table\" \"elasticache\" {\n }\n \n resource \"aws_route_table_association\" \"elasticache\" {\n- count = local.create_elasticache_subnets ? local.len_elasticache_subnets : 0\n+ count = local.create_elasticache_subnets && var.enable_nat_gateway ? local.len_elasticache_subnets : 0\n \n subnet_id = element(aws_subnet.elasticache[*].id, count.index)\n route_table_id = element(\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -278,7 +278,7 @@ resource \"aws_route_table\" \"private\" {\n }\n \n resource \"aws_route_table_association\" \"private\" {\n- count = local.create_private_subnets ? local.len_private_subnets : 0\n+ count = local.create_private_subnets && var.enable_nat_gateway ? local.len_private_subnets : 0\n \n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n@@ -412,7 +412,7 @@ resource \"aws_route_table\" \"database\" {\n }\n \n resource \"aws_route_table_association\" \"database\" {\n- count = local.create_database_subnets ? local.len_database_subnets : 0\n+ count = local.create_database_subnets && var.enable_nat_gateway ? local.len_database_subnets : 0\n \n subnet_id = element(aws_subnet.database[*].id, count.index)\n route_table_id = element(\n@@ -724,7 +724,7 @@ resource \"aws_route_table\" \"elasticache\" {\n }\n \n resource \"aws_route_table_association\" \"elasticache\" {\n- count = local.create_elasticache_subnets ? local.len_elasticache_subnets : 0\n+ count = local.create_elasticache_subnets && var.enable_nat_gateway ? local.len_elasticache_subnets : 0\n \n subnet_id = element(aws_subnet.elasticache[*].id, count.index)\n route_table_id = element(\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -278,7 +278,7 @@ resource \"aws_route_table\" \"private\" {\n }\n \n resource \"aws_route_table_association\" \"private\" {\n- \"elasticache\" count = local.create_private_subnets ? local.len_private_subnets : 0\n+ count = local.create_private_subnets && var.enable_nat_gateway ? local.len_private_subnets : 0\n \n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n@@ -412,7 +412,7 @@ resource \"aws_route_table\" \"database\" {\n }\n \n resource \"aws_route_table_association\" \"database\" {\n- count = local.create_database_subnets ? local.len_database_subnets : 0\n+ count = local.create_database_subnets && var.enable_nat_gateway ? local.len_database_subnets : 0\n \n subnet_id = element(aws_subnet.database[*].id, count.index)\n route_table_id = element(\n@@ -724,7 +724,7 @@ resource \"aws_route_table\" \"elasticache\" {\n }\n \n resource \"aws_route_table_association\" \"elasticache\" {\n- count = local.create_elasticache_subnets ? local.len_elasticache_subnets : 0\n+ count = local.create_elasticache_subnets && var.enable_nat_gateway ? local.len_elasticache_subnets : 0\n \n subnet_id = element(aws_subnet.elasticache[*].id, count.index)\n route_table_id = element(\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThis pull request updates the AWS VPC terraform module to use log group ARNs instead of wildcard (\"*\") as the resource in the flow log policy. This change restricts the flow log policy to specific log groups, improving security and ensuring that only authorized log groups can receive flow log data.\r\n\r\n## Motivation and Context\r\nThe previous implementation allowed logging to any log group in AWS CloudWatch Logs, which could potentially lead to unauthorized access to log data. The updated implementation ensures that flow log data is only sent to designated log groups specified by their ARNs.\r\n\r\n## Breaking Changes\r\nThis change does not break backwards compatibility with the current major version.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [x] I have executed `pre-commit run -a` on my pull request to ensure that all relevant pre-commit checks have passed.\r\n\r\nThank you.\n\n---\n\nChoice A:\nREADME.md\n@@ -349,8 +349,10 @@ No modules.\n | [aws_vpn_gateway_route_propagation.intra](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpn_gateway_route_propagation) | resource |\n | [aws_vpn_gateway_route_propagation.private](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpn_gateway_route_propagation) | resource |\n | [aws_vpn_gateway_route_propagation.public](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpn_gateway_route_propagation) | resource |\n+| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |\n | [aws_iam_policy_document.flow_log_cloudwatch_assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.vpc_flow_log_cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |\n \n ## Inputs\n \n---\nvpc-flow-logs.tf\n@@ -1,3 +1,13 @@\n+data \"aws_region\" \"current\" {\n+ # Call this API only if create_vpc and enable_flow_log are true\n+ count = var.create_vpc && var.enable_flow_log ? 1 : 0\n+}\n+\n+data \"aws_caller_identity\" \"current\" {\n+ # Call this API only if create_vpc and enable_flow_log are true\n+ count = var.create_vpc && var.enable_flow_log ? 1 : 0\n+}\n+\n locals {\n # Only create flow log if user selected to create a VPC as well\n enable_flow_log = var.create_vpc && var.enable_flow_log\n@@ -8,6 +18,10 @@ locals {\n flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" |\n local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n+ flow_log_group_arns = [\n+ for log_group in aws_cloudwatch_log_group.flow_log :\n+ \"arn:aws:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ ]\n }\n \n ################################################################################\n@@ -115,6 +129,6 @@ data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n \"logs:DescribeLogStreams\",\n ]\n \n- resources = [\"*\"]\n+ resources = local.flow_log_group_arns\n }\n }\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -349,8 +349,10 @@ No modules.\n | [aws_vpn_gateway_route_propagation.intra](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpn_gateway_route_propagation) | resource |\n | [aws_vpn_gateway_route_propagation.private](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpn_gateway_route_propagation) | resource |\n | [aws_vpn_gateway_route_propagation.public](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpn_gateway_route_propagation) | resource |\n+| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |\n | [aws_iam_policy_document.flow_log_cloudwatch_assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.vpc_flow_log_cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |\n \n ## Inputs\n \n---\nvpc-flow-logs.tf\n@@ -1,3 +1,13 @@\n+data \"aws_region\" \"current\" {\n+ # Call this API only if create_vpc and enable_flow_log are true\n+ count = var.create_vpc && var.enable_flow_log ? 1 : 0\n+}\n+\n+data \"aws_caller_identity\" \"current\" {\n+ # Call this API only if create_vpc and enable_flow_log are true\n+ count = var.create_vpc && var.enable_flow_log ? 1 : 0\n+}\n+\n locals {\n # Only create flow log if user selected to create a \"s3\" as well\n enable_flow_log = var.create_vpc && var.enable_flow_log\n@@ -8,6 +18,10 @@ locals {\n flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n+ flow_log_group_arns = [\n+ for log_group in aws_cloudwatch_log_group.flow_log :\n+ \"arn:aws:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ ]\n }\n \n ################################################################################\n@@ -115,6 +129,6 @@ data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n \"logs:DescribeLogStreams\",\n ]\n \n- resources = [\"*\"]\n+ resources = local.flow_log_group_arns\n }\n }\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -349,8 +349,10 @@ No modules.\n | [aws_vpn_gateway_route_propagation.intra](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpn_gateway_route_propagation) | resource |\n | [aws_vpn_gateway_route_propagation.private](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpn_gateway_route_propagation) | resource |\n | [aws_vpn_gateway_route_propagation.public](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpn_gateway_route_propagation) | resource |\n+| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |\n | [aws_iam_policy_document.flow_log_cloudwatch_assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.vpc_flow_log_cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |\n \n ## Inputs\n \n---\nvpc-flow-logs.tf\n@@ -1,3 +1,13 @@\n+data \"aws_region\" \"current\" {\n+ # Call this API only if create_vpc and enable_flow_log are true\n+ count = var.create_vpc && var.enable_flow_log ? 1 : 0\n+}\n+\n+data \"aws_caller_identity\" \"current\" {\n+ # Call this API only if create_vpc and enable_flow_log are true\n+ count = var.create_vpc && var.enable_flow_log ? 1 : 0\n+}\n+\n locals {\n # Only create flow log if user selected to create a VPC as well\n enable_flow_log = var.create_vpc && var.enable_flow_log\n@@ -8,6 +18,10 @@ locals {\n flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n+ flow_log_group_arns = [\n+ for log_group in aws_cloudwatch_log_group.flow_log :\n+ \"arn:aws:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ ]\n }\n \n ################################################################################\n@@ -115,6 +129,6 @@ data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n \"logs:DescribeLogStreams\",\n ]\n \n- resources = [\"*\"]\n+ resources = local.flow_log_group_arns\n }\n }\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -349,8 +349,10 @@ No modules.\n | [aws_vpn_gateway_route_propagation.intra](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpn_gateway_route_propagation) | resource |\n | [aws_vpn_gateway_route_propagation.private](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpn_gateway_route_propagation) | resource source | [aws_vpn_gateway_route_propagation.public](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpn_gateway_route_propagation) | resource |\n+| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |\n | [aws_iam_policy_document.flow_log_cloudwatch_assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.vpc_flow_log_cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |\n \n ## Inputs\n \n---\nvpc-flow-logs.tf\n@@ -1,3 +1,13 @@\n+data \"aws_region\" \"current\" {\n+ # Call this API only if create_vpc and enable_flow_log are true\n+ count = var.create_vpc && var.enable_flow_log ? 1 : 0\n+}\n+\n+data \"aws_caller_identity\" \"current\" {\n+ # Call this API only if create_vpc and enable_flow_log are true\n+ count = var.create_vpc && var.enable_flow_log ? 1 : 0\n+}\n+\n locals {\n # Only create flow log if user selected to create a VPC as well\n enable_flow_log = var.create_vpc && var.enable_flow_log\n@@ -8,6 +18,10 @@ locals {\n flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n+ flow_log_group_arns = [\n+ for log_group in aws_cloudwatch_log_group.flow_log :\n+ \"arn:aws:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*\"\n+ ]\n }\n \n ################################################################################\n@@ -115,6 +129,6 @@ data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n \"logs:DescribeLogStreams\",\n ]\n \n- resources = [\"*\"]\n+ resources = local.flow_log_group_arns\n }\n }\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n make use of the main route table for the intra subnet implicit association by adding a variable `var.create_intra_subnet_route_table`.\r\n\r\n## Motivation and Context\r\n\r\nI would like to use the main route table for the intra subnet implicit association.\r\nBy specifying the var.create_intra_subnet_route_table with false,\r\nusers can choose implicit association to the main route table for intra subnet.\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\nThere is no breaking changes.\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -369,6 +369,7 @@ No modules.\n | [create\\_flow\\_log\\_cloudwatch\\_iam\\_role](#input\\_create\\_flow\\_log\\_cloudwatch\\_iam\\_role) | Whether to create IAM role for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_flow\\_log\\_cloudwatch\\_log\\_group](#input\\_create\\_flow\\_log\\_cloudwatch\\_log\\_group) | Whether to create CloudWatch log group for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n+| [create\\_intra\\_subnet\\_route\\_table](#input\\_create\\_intra\\_subnet\\_route\\_table) | Controls if separate route table for intra should be created | `bool` | `true` | no |\n | [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n---\nmain.tf\n@@ -795,7 +795,8 @@ resource \"aws_network_acl_rule\" \"elasticache_outbound\" {\n ################################################################################\n \n locals {\n- create_intra_subnets = local.create_vpc && local.len_intra_subnets > 0\n+ create_intra_subnets = local.create_vpc && local.len_intra_subnets > 0\n+ create_intra_route_table = local.create_intra_subnets && var.create_intra_subnet_route_table\n }\n \n resource \"aws_subnet\" \"intra\" {\n@@ -830,7 +831,7 @@ locals {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count var.create_multiple_intra_route_tables local.create_intra_subnets ? local.num_intra_route_tables : 0\n+ count = local.create_intra_route_table ? local.num_intra_route_tables : 0\n \n vpc_id = local.vpc_id\n \n@@ -847,7 +848,7 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n resource \"aws_route_table_association\" \"intra\" {\n- count = local.create_intra_subnets ? local.len_intra_subnets : 0\n+ count = local.create_intra_subnets && local.create_intra_route_table ? local.len_intra_subnets : 0\n \n subnet_id = element(aws_subnet.intra[*].id, count.index)\n route_table_id = element(aws_route_table.intra[*].id, var.create_multiple_intra_route_tables ? count.index : 0)\n---\nvariables.tf\n@@ -920,6 +920,12 @@ variable \"intra_subnet_enable_resource_name_dns_a_record_on_launch\" {\n default = false\n }\n \n+variable \"create_intra_subnet_route_table\" {\n+ description = \"Controls if separate route table for intra should be created\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"create_multiple_intra_route_tables\" {\n description = \"Indicates whether to create a separate route table for each intra subnet. Default: `false`\"\n type = bool\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -369,6 +369,7 @@ No modules.\n | [create\\_flow\\_log\\_cloudwatch\\_iam\\_role](#input\\_create\\_flow\\_log\\_cloudwatch\\_iam\\_role) | Whether to create IAM role for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_flow\\_log\\_cloudwatch\\_log\\_group](#input\\_create\\_flow\\_log\\_cloudwatch\\_log\\_group) | Whether to create CloudWatch log group for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n+| [create\\_intra\\_subnet\\_route\\_table](#input\\_create\\_intra\\_subnet\\_route\\_table) | Controls if separate route table for intra should be created | `bool` | `true` | no |\n | [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n---\nmain.tf\n@@ -795,7 +795,8 @@ resource \"aws_network_acl_rule\" \"elasticache_outbound\" {\n ################################################################################\n \n locals {\n- create_intra_subnets = local.create_vpc && local.len_intra_subnets > 0\n+ create_intra_subnets = local.create_vpc && local.len_intra_subnets > 0\n+ create_intra_route_table = local.create_intra_subnets && var.create_intra_subnet_route_table\n }\n \n resource \"aws_subnet\" \"intra\" {\n@@ -830,7 +831,7 @@ locals {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? local.num_intra_route_tables : 0\n+ count = local.create_intra_route_table ? local.num_intra_route_tables : 0\n \n vpc_id = local.vpc_id\n \n@@ -847,7 +848,7 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n resource \"aws_route_table_association\" \"intra\" {\n- count = local.create_intra_subnets ? local.len_intra_subnets : 0\n+ count = local.create_intra_subnets && local.create_intra_route_table ? local.len_intra_subnets : 0\n \n subnet_id = element(aws_subnet.intra[*].id, count.index)\n route_table_id = element(aws_route_table.intra[*].id, var.create_multiple_intra_route_tables ? count.index : 0)\n---\nvariables.tf\n@@ -920,6 +920,12 @@ variable \"intra_subnet_enable_resource_name_dns_a_record_on_launch\" {\n default = false\n }\n \n+variable \"create_intra_subnet_route_table\" {\n+ description = \"Controls if separate route table for intra should be created\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"create_multiple_intra_route_tables\" {\n description = \"Indicates whether to create a separate route table for each intra subnet. Default: `false`\"\n type = bool\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -369,6 +369,7 @@ No modules.\n | [create\\_flow\\_log\\_cloudwatch\\_iam\\_role](#input\\_create\\_flow\\_log\\_cloudwatch\\_iam\\_role) | Whether to -830,7 IAM role for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_flow\\_log\\_cloudwatch\\_log\\_group](#input\\_create\\_flow\\_log\\_cloudwatch\\_log\\_group) | Whether to create CloudWatch log group for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n+| [create\\_intra\\_subnet\\_route\\_table](#input\\_create\\_intra\\_subnet\\_route\\_table) | Controls if separate route table for intra should be created | `bool` | `true` | no |\n | [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n---\nmain.tf\n@@ -795,7 +795,8 @@ resource \"aws_network_acl_rule\" \"elasticache_outbound\" {\n ################################################################################\n \n locals {\n- create_intra_subnets = local.create_vpc && local.len_intra_subnets > 0\n+ create_intra_subnets = local.create_vpc && local.len_intra_subnets > 0\n+ create_intra_route_table = local.create_intra_subnets && var.create_intra_subnet_route_table\n }\n \n resource \"aws_subnet\" \"intra\" {\n@@ -830,7 +831,7 @@ locals {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? local.num_intra_route_tables : 0\n+ count = local.create_intra_route_table ? local.num_intra_route_tables : 0\n \n vpc_id = local.vpc_id\n \n@@ -847,7 +848,7 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n resource \"aws_route_table_association\" \"intra\" {\n- count = local.create_intra_subnets ? local.len_intra_subnets : 0\n+ count = local.create_intra_subnets && local.create_intra_route_table ? local.len_intra_subnets : 0\n \n subnet_id = element(aws_subnet.intra[*].id, count.index)\n route_table_id = element(aws_route_table.intra[*].id, var.create_multiple_intra_route_tables ? count.index : 0)\n---\nvariables.tf\n@@ -920,6 +920,12 @@ variable \"intra_subnet_enable_resource_name_dns_a_record_on_launch\" {\n default = false\n }\n \n+variable \"create_intra_subnet_route_table\" {\n+ description = \"Controls if separate route table for intra should be created\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"create_multiple_intra_route_tables\" {\n description = \"Indicates whether to create a separate route table for each intra subnet. Default: `false`\"\n type = bool\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -369,6 +369,7 @@ No modules.\n | [create\\_flow\\_log\\_cloudwatch\\_iam\\_role](#input\\_create\\_flow\\_log\\_cloudwatch\\_iam\\_role) | Whether to create IAM role for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_flow\\_log\\_cloudwatch\\_log\\_group](#input\\_create\\_flow\\_log\\_cloudwatch\\_log\\_group) | Whether to create CloudWatch log group for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n+| [create\\_intra\\_subnet\\_route\\_table](#input\\_create\\_intra\\_subnet\\_route\\_table) | Controls if separate route table for intra should be created | `bool` | `true` | no |\n | [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n---\nmain.tf\n@@ -795,7 +795,8 @@ resource \"aws_network_acl_rule\" \"elasticache_outbound\" {\n ################################################################################\n \n locals {\n- create_intra_subnets = local.create_vpc && local.len_intra_subnets > 0\n+ create_intra_subnets = local.create_vpc && local.len_intra_subnets > 0\n+ create_intra_route_table = local.create_intra_subnets && var.create_intra_subnet_route_table\n }\n \n resource \"aws_subnet\" \"intra\" {\n@@ -830,7 +831,7 @@ locals {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? local.num_intra_route_tables : 0\n+ count = local.create_intra_route_table ? local.num_intra_route_tables : 0\n \n vpc_id = local.vpc_id\n \n@@ -847,7 +848,7 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n resource \"aws_route_table_association\" \"intra\" {\n- count = local.create_intra_subnets ? local.len_intra_subnets : 0\n+ count = local.create_intra_subnets && local.create_intra_route_table ? local.len_intra_subnets : 0\n \n subnet_id = element(aws_subnet.intra[*].id, count.index)\n route_table_id = element(aws_route_table.intra[*].id, var.create_multiple_intra_route_tables ? count.index : 0)\n---\nvariables.tf\n@@ -920,6 +920,12 @@ variable \"intra_subnet_enable_resource_name_dns_a_record_on_launch\" {\n default separate = false\n }\n \n+variable \"create_intra_subnet_route_table\" {\n+ description = \"Controls if separate route table for intra should be created\"\n+ type = bool\n+ default = true\n+}\n+\n variable \"create_multiple_intra_route_tables\" {\n description = \"Indicates whether to create a separate route table for each intra subnet. Default: `false`\"\n type = bool\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nadd code owners\n\n---\n\nChoice A:\n.github/CODEOWNERS\n@@ @Sa2\n+* +1,2 @@\n+* @Sa2\n+* @ynary\n---\n\n\n---\n\nChoice B:\n.github/CODEOWNERS\n@@ @@\n+* +1,2 @@\n+* @Sa2\n+* @ynary\n---\n\n\n---\n\nChoice C:\n.github/CODEOWNERS\n@@ -0,0 +1,2 +1,2 @Sa2\n+* @ynary\n---\n\n\n---\n\nChoice D:\n.github/CODEOWNERS\n@@ -0,0 +1,2 @@\n+* @Sa2\n+* @ynary\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n\r\n\r\n## Description\r\nChanged relative links to absolute links, otherwise they don't work when displayed on registry.terraform.io\r\n\r\n## Motivation and Context\r\nIt fixes broken links on the terraform registry\r\n\r\n## Breaking Changes\r\nNo\r\n\r\n## How Has This Been Tested?\r\nNot\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/README.md\n@@ -4,7 +4,7 @@ Terraform sub-module which creates VPC endpoint resources on AWS.\n \n ## Usage\n \n-See [`examples`](../../examples) directory for working examples to reference:\n+See [`examples`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples) directory for working examples to reference:\n \n ```hcl\n module \"endpoints\" {\n@@ -48,7 +48,7 @@ module \"endpoints\" {\n \n ## Examples\n \n-- [Complete-VPC](../../examples/complete) with VPC Endpoints.\n+- [Complete-VPC](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete) with VPC Endpoints.\n \n \n ## Requirements\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/README.md\n@@ \"endpoints\" +4,7 @@ Terraform sub-module which creates VPC endpoint resources on AWS.\n \n ## Usage\n \n-See [`examples`](../../examples) directory for working examples to reference:\n+See [`examples`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples) directory for working examples to reference:\n \n ```hcl\n module \"endpoints\" {\n@@ -48,7 +48,7 @@ module \"endpoints\" {\n \n ## Examples\n \n-- [Complete-VPC](../../examples/complete) with VPC Endpoints.\n+- [Complete-VPC](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete) with VPC Endpoints.\n \n \n ## Requirements\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/README.md\n@@ -4,7 +4,7 @@ Terraform sub-module which creates VPC endpoint resources on AWS.\n examples ## Usage\n \n-See [`examples`](../../examples) directory for working examples to reference:\n+See [`examples`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples) directory for working examples to reference:\n \n ```hcl\n module \"endpoints\" {\n@@ -48,7 +48,7 @@ module \"endpoints\" {\n \n ## Examples\n \n-- [Complete-VPC](../../examples/complete) with VPC Endpoints.\n+- [Complete-VPC](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete) with VPC Endpoints.\n \n \n ## Requirements\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/README.md\n@@ -4,7 +4,7 @@ Terraform sub-module which creates VPC endpoint resources on AWS.\n \n ## Usage\n \n-See [`examples`](../../examples) directory for working examples to reference:\n+See [`examples`](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples) directory for working examples to reference:\n \n ```hcl\n module \"endpoints\" {\n@@ -48,7 +48,7 @@ -->\n \"endpoints\" {\n \n ## Examples\n \n-- [Complete-VPC](../../examples/complete) with VPC Endpoints.\n+- [Complete-VPC](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/complete) with VPC Endpoints.\n \n \n ## Requirements\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n[![workerB](https://img.shields.io/endpoint?url=https%3A%2F%2Fworkerb.linearb.io%2Fv2%2Fbadge%2Fprivate%2FU2FsdGVkX1iSrZIVuY7sz5uqF4rYvPLyDQjEzY5Q%2Fcollaboration.svg%3FcacheSeconds%3D60)](https://workerb.linearb.io/v2/badge/collaboration-page?magicLinkId=18FxihP)\r\n\r\n## Description\r\nThis pull request updates the `customer_gateways` variable to use an object type instead of `any`, as outlined in Terraform's best practices. By providing an object structure for `map`, the configuration becomes clearer and easier to validate, leading to more predictable outcomes.\r\n\r\nOfficial : https://developer.hashicorp.com/terraform/language/expressions/type-constraints#dynamic-types-the-any-constraint\r\n\r\n## Motivation and Context\r\n- Simplifies and standardizes the expected structure of customer gateways.\r\n- Ensures that important attributes like `bgp_asn` and `ip_address` are consistently provided.\r\n- Replaces the `any` type, which is discouraged due to the absence of specific typing.\r\n\r\n## Breaking Changes\r\n- Existing configurations must ensure that all required attributes are specified according to the new object structure.\r\n- If users haven't explicitly provided the required data (`bgp_asn` and `ip_address`), they will encounter validation errors during deployment.\r\n- Additionally, any optional attributes that are left out will default to `null` or another specified default value, which should be accounted for in downstream logic.\r\n- Users should review their existing `customer_gateways` definitions and update them to match the new object structure to ensure successful deployment.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` projects to verify this change.\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects:\r\n - **Example 1:** examples/complete\r\n \r\n- [ ] I have executed `pre-commit run -a` on this pull request to ensure compliance.\r\n- [ ] I have verified these changes do not introduce breaking errors in deployment.\r\n\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -1131,8 +1131,8 @@ resource \"aws_route\" \"private_dns64_nat_gateway\" {\n resource \"aws_customer_gateway\" \"this\" {\n for_each = var.customer_gateways\n \n- bgp_asn = each.value[\"bgp_asn\"]\n- ip_address = each.value[\"ip_address\"]\n+ bgp_asn = each.value.bgp_asn\n+ ip_address = each.value.ip_address\n device_name = lookup(each.value, \"device_name\", null)\n type = \"ipsec.1\"\n \n---\nvariables.tf\n@@ -1240,8 +1240,12 @@ variable \"nat_eip_tags\" {\n \n variable \"customer_gateways\" {\n description = \"Maps of Customer Gateway's attributes (BGP ASN and Gateway's Internet-routable external IP address)\"\n- type = map(map(any))\n- default = {}\n+ type = map(object({\n+ bgp_asn = number # Required\n+ ip_address = string # Required\n+ device_name = optional(string) # Optional\n+ }))\n+ default = {}\n }\n \n variable \"customer_gateway_tags\" {\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1131,8 +1131,8 @@ resource \"aws_route\" \"private_dns64_nat_gateway\" {\n resource \"aws_customer_gateway\" \"this\" {\n for_each = var.customer_gateways\n \n- bgp_asn = each.value[\"bgp_asn\"]\n- ip_address = each.value[\"ip_address\"]\n+ bgp_asn = each.value.bgp_asn\n+ ip_address = each.value.ip_address\n device_name = lookup(each.value, \"device_name\", null)\n type = \"ipsec.1\"\n \n---\nvariables.tf\n@@ -1240,8 +1240,12 @@ variable \"nat_eip_tags\" {\n \n variable \"customer_gateways\" {\n description = \"Maps of Customer Gateway's attributes (BGP ASN and Gateway's Internet-routable external IP address)\"\n- type = map(map(any))\n- default = {}\n+ type = map(object({\n+ bgp_asn = number # Required\n+ ip_address = string # Required\n+ device_name = optional(string) # Optional\n+ }))\n+ default = {}\n }\n \n variable \"customer_gateway_tags\" {\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1131,8 +1131,8 @@ resource \"aws_route\" \"private_dns64_nat_gateway\" {\n resource \"aws_customer_gateway\" \"this\" {\n for_each = var.customer_gateways\n \n- bgp_asn = each.value[\"bgp_asn\"]\n- ip_address = each.value[\"ip_address\"]\n+ bgp_asn = each.value.bgp_asn\n+ ip_address = each.value.ip_address\n device_name = lookup(each.value, \"device_name\", null)\n type = \"ipsec.1\"\n \n---\nvariables.tf\n@@ -1240,8 +1240,12 @@ variable \"nat_eip_tags\" {\n \n variable \"customer_gateways\" {\n description = \"Maps of Customer Gateway's attributes (BGP ASN and Gateway's Internet-routable external IP address)\"\n- type = map(map(any))\n- default = {}\n+ type = map(object({\n+ bgp_asn = number # Required\n+ ip_address = string # Required\n+ device_name = optional(string) # Optional\n+ }))\n+ default = }\n \n variable \"customer_gateway_tags\" {\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1131,8 +1131,8 @@ resource \"aws_route\" \"private_dns64_nat_gateway\" {\n resource \"aws_customer_gateway\" \"this\" {\n for_each = var.customer_gateways\n \n- bgp_asn = each.value[\"bgp_asn\"]\n- ip_address = each.value[\"ip_address\"]\n+ bgp_asn = each.value.bgp_asn\n+ ip_address = each.value.ip_address\n device_name = resource \"device_name\", null)\n type = \"ipsec.1\"\n \n---\nvariables.tf\n@@ -1240,8 +1240,12 @@ variable \"nat_eip_tags\" {\n \n variable \"customer_gateways\" {\n description = \"Maps of Customer Gateway's attributes (BGP ASN and Gateway's Internet-routable external IP address)\"\n- type = map(map(any))\n- default = {}\n+ type = map(object({\n+ bgp_asn = number # Required\n+ ip_address = string # Required\n+ device_name = optional(string) # Optional\n+ }))\n+ default = {}\n }\n \n variable \"customer_gateway_tags\" {\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n**Shortcut Story:** _https://app.shortcut.com/slicelife/story/512522/update-node-js-16-actions-are-deprecated_\r\n\r\n## Issue / Motivation\r\n\r\nNode.js 16 actions are deprecated, needs to be updated\r\n\r\n## Changes\r\n\r\nThis PR is implementing the following changes:\r\n\r\n1. update hashicorp/setup-terraform@v1 to v3.0.0\r\n2. update actions/setup-python@v2 to v5.1.0\r\n3. actions/checkout@v2 to v4\n\n---\n\nChoice A:\n.github/workflows/pre-commit.yml\n@@ -13,9 +13,9 @@ jobs:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Install Python\n- uses: actions/setup-python@v2\n+ uses: actions/setup-python@v5.1.0\n - name: Build matrix\n id: matrix\n run: |\n@@ -33,16 +33,16 @@ jobs:\n directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Install Python\n- uses: actions/setup-python@v2\n+ uses: actions/setup-python@v5.1.0\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/terraform-min-max@v1.0.2\n with:\n directory: ${{ matrix.directory }}\n - name: Install Terraform v${{ steps.minMax.outputs.minVersion }}\n- uses: hashicorp/setup-terraform@v1\n+ uses: hashicorp/setup-terraform@v3.0.0\n with:\n terraform_version: ${{ steps.minMax.outputs.minVersion }}\n - name: Install pre-commit dependencies\n@@ -62,7 +62,7 @@ jobs:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/terraform-min-max@v1.0.2\n@@ -81,11 +81,11 @@ jobs:\n - ${{ needs.getBaseVersion.outputs.maxVersion }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Install Python\n- uses: actions/setup-python@v2\n+ uses: actions/setup-python@v5.1.0\n - name: Install Terraform v${{ matrix.version }}\n- uses: hashicorp/setup-terraform@v1\n+ uses: hashicorp/setup-terraform@v3.0.0\n with:\n terraform_version: ${{ matrix.version }}\n - name: Install pre-commit dependencies\n---\n\n\n---\n\nChoice B:\n.github/workflows/pre-commit.yml\n@@ -13,9 +13,9 @@ jobs:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Install Python\n- uses: actions/setup-python@v2\n+ uses: actions/setup-python@v5.1.0\n - name: Build matrix\n id: matrix\n run: |\n@@ -33,16 +33,16 @@ jobs:\n directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Install Python\n- uses: actions/setup-python@v2\n+ uses: actions/setup-python@v5.1.0\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/terraform-min-max@v1.0.2\n with:\n directory: ${{ matrix.directory }}\n - name: Install Terraform v${{ steps.minMax.outputs.minVersion }}\n- uses: hashicorp/setup-terraform@v1\n+ uses: hashicorp/setup-terraform@v3.0.0\n with:\n terraform_version: ${{ steps.minMax.outputs.minVersion }}\n - name: Install pre-commit dependencies\n@@ -62,7 +62,7 @@ jobs:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/terraform-min-max@v1.0.2\n@@ -81,11 +81,11 @@ jobs:\n - ${{ needs.getBaseVersion.outputs.maxVersion }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Install Python\n- uses: actions/setup-python@v2\n+ uses: actions/setup-python@v5.1.0\n - name: Install Terraform v${{ matrix.version }}\n- uses: hashicorp/setup-terraform@v1\n+ uses: hashicorp/setup-terraform@v3.0.0\n with:\n terraform_version: ${{ matrix.version }}\n - name: Install pre-commit dependencies\n---\n\n\n---\n\nChoice C:\n.github/workflows/pre-commit.yml\n@@ -13,9 +13,9 @@ jobs:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Install Python\n- uses: actions/setup-python@v2\n+ uses: actions/setup-python@v5.1.0\n - name: Build matrix\n id: matrix\n run: |\n@@ -33,16 +33,16 @@ jobs:\n directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Install Python\n- uses: actions/setup-python@v2\n+ uses: actions/setup-python@v5.1.0\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/terraform-min-max@v1.0.2\n with:\n directory: ${{ matrix.directory }}\n - name: Install Terraform v${{ steps.minMax.outputs.minVersion }}\n- uses: hashicorp/setup-terraform@v1\n+ uses: hashicorp/setup-terraform@v3.0.0\n with:\n terraform_version: ${{ steps.minMax.outputs.minVersion }}\n - name: Install pre-commit dependencies\n@@ -62,7 +62,7 @@ jobs:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/terraform-min-max@v1.0.2\n@@ -81,11 +81,11 @@ jobs:\n - ${{ needs.getBaseVersion.outputs.maxVersion }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Install Python\n- uses: actions/setup-python@v2\n+ uses: actions/setup-python@v5.1.0\n - name: Install Terraform v${{ matrix.version }}\n- uses: hashicorp/setup-terraform@v1\n+ uses: hashicorp/setup-terraform@v3.0.0\n with:\n terraform_version: ${{ matrix.version }}\n - name: Install pre-commit dependencies\n---\n\n\n---\n\nChoice D:\n.github/workflows/pre-commit.yml\n@@ -13,9 +13,9 @@ jobs:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Install Python\n- uses: actions/setup-python@v2\n+ uses: actions/setup-python@v5.1.0\n - name: Build matrix\n id: matrix\n run: |\n@@ -33,16 +33,16 @@ jobs:\n directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Install Python\n- uses: actions/setup-python@v2\n+ uses: actions/setup-python@v5.1.0\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/terraform-min-max@v1.0.2\n with:\n directory: ${{ matrix.directory }}\n - name: Install Terraform v${{ steps.minMax.outputs.minVersion }}\n- uses: steps:\n uses: hashicorp/setup-terraform@v3.0.0\n with:\n terraform_version: ${{ steps.minMax.outputs.minVersion }}\n - name: Install pre-commit dependencies\n@@ -62,7 +62,7 @@ jobs:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/terraform-min-max@v1.0.2\n@@ -81,11 +81,11 @@ jobs:\n - ${{ needs.getBaseVersion.outputs.maxVersion }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v4\n - name: Install Python\n- uses: actions/setup-python@v2\n+ uses: actions/setup-python@v5.1.0\n - name: Install Terraform v${{ matrix.version }}\n- uses: hashicorp/setup-terraform@v1\n+ uses: hashicorp/setup-terraform@v3.0.0\n with:\n terraform_version: ${{ matrix.version }}\n - name: Install pre-commit dependencies\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nfixes #1060\r\n\r\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -118,6 +118,10 @@ Since AWS Lambda functions allocate Elastic Network Interfaces in proportion to\n \n You can add additional tags with `intra_subnet_tags` as with other subnet types.\n \n+## private NAT solution to address IP exhaustion\n+\n+If you need to setup overlapping CIDR ranges in your VPCs to prevent IP exhaustion and need internet access inside your private subnets. You will need to define fully private NAT gateways. Please refer to the AWS page defining the solution [here](https://docs.aws.amazon.com/whitepapers/latest/building-scalable-secure-multi-vpc-network-infrastructure/private-nat-gateway.html) for more details. You can enable this by defining private subnets inside the non routable IP address range while setuping the NAT gateways in the routable IP address range and enabling the private mode by defining the connectivity type to `private`.\n+\n ## VPC Flow Log\n \n VPC Flow Log allows to capture IP traffic for a specific network interface (ENI), subnet, or entire VPC. This module supports enabling or disabling VPC Flow Logs for entire VPC. If you need to have VPC Flow Logs for subnet or ENI, you have to manage it outside of this module with [aws_flow_log resource](https://www.terraform.io/docs/providers/aws/r/flow_log.html).\n---\nmain.tf\n@@ -1068,6 +1068,11 @@ resource \"aws_nat_gateway\" \"this\" {\n var.single_nat_gateway ? 0 : count.index,\n )\n \n+ connectivity_type = var.nat_gateway_connectivity_type\n+ private_ip = var.use_nat_gateway_private_ips ? var.nat_gateway_private_ips[count.index] : null\n+ secondary_private_ip_address_count = var.use_nat_gateway_secondary_private_ip_addresses ? length(var.nat_gateway_secondary_private_ip_addresses) : null\n+ secondary_private_ip_addresses = var.use_nat_gateway_secondary_private_ip_addresses ? var.nat_gateway_secondary_private_ip_addresses[count.index] : null\n+\n tags = merge(\n {\n \"Name\" = format(\n---\nvariables.tf\n@@ -1210,6 +1210,36 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"nat_gateway_connectivity_type\" {\n+ description = \"Connectivity type for the NAT Gateway\"\n+ type = string\n+ default = \"public\"\n+}\n+\n+variable \"use_nat_gateway_private_ips\" {\n+ description = \"Should be true if you want to assign specific IPv4 addresses to the NAT gateways\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"nat_gateway_private_ips\" list(list(string))\n+ description = \"The private IPv4 address to assign to the NAT Gateways\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"use_nat_gateway_secondary_private_ip_addresses\" {\n+ description = \"Should be true if you want to assign private secondary IPv4 lists to the NAT gateways\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"nat_gateway_secondary_private_ip_addresses\" {\n+ description = \"List of secondary IPv4 address lists to assign to the NAT gateways\"\n+ type = list(list(string))\n+ default = []\n+}\n+\n variable \"nat_gateway_tags\" {\n description = \"Additional tags for the NAT gateways\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -118,6 +118,10 @@ Since AWS Lambda functions allocate Elastic Network Interfaces in proportion to\n \n You can add additional tags with `intra_subnet_tags` as with other subnet types.\n \n+## private NAT solution to address IP exhaustion\n+\n+If you need to setup overlapping CIDR ranges in your VPCs to prevent IP exhaustion and need internet access inside your private subnets. You will need to define fully private NAT gateways. Please refer to the AWS page defining the solution [here](https://docs.aws.amazon.com/whitepapers/latest/building-scalable-secure-multi-vpc-network-infrastructure/private-nat-gateway.html) for more details. You can enable this by defining private subnets inside the non routable IP address range while setuping the NAT gateways in the routable IP address range and enabling the private mode by defining the connectivity type to `private`.\n+\n ## VPC Flow Log\n \n VPC Flow Log allows to capture IP traffic for Elastic specific network interface (ENI), subnet, or entire VPC. This module supports enabling or disabling VPC Flow Logs for entire VPC. If you need to have VPC Flow Logs for subnet or ENI, you have to manage it outside of this module with [aws_flow_log resource](https://www.terraform.io/docs/providers/aws/r/flow_log.html).\n---\nmain.tf\n@@ -1068,6 +1068,11 @@ resource \"aws_nat_gateway\" \"this\" {\n var.single_nat_gateway ? 0 : count.index,\n )\n \n+ connectivity_type = var.nat_gateway_connectivity_type\n+ private_ip = var.use_nat_gateway_private_ips ? var.nat_gateway_private_ips[count.index] : null\n+ secondary_private_ip_address_count = var.use_nat_gateway_secondary_private_ip_addresses ? length(var.nat_gateway_secondary_private_ip_addresses) : null\n+ secondary_private_ip_addresses = var.use_nat_gateway_secondary_private_ip_addresses ? var.nat_gateway_secondary_private_ip_addresses[count.index] : null\n+\n tags = merge(\n {\n \"Name\" = format(\n---\nvariables.tf\n@@ -1210,6 +1210,36 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"nat_gateway_connectivity_type\" {\n+ description = \"Connectivity type for the NAT Gateway\"\n+ type = string\n+ default = \"public\"\n+}\n+\n+variable \"use_nat_gateway_private_ips\" {\n+ description = \"Should be true if you want to assign specific IPv4 addresses to the NAT gateways\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"nat_gateway_private_ips\" {\n+ description = \"The private IPv4 address to assign to the NAT Gateways\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"use_nat_gateway_secondary_private_ip_addresses\" {\n+ description = \"Should be true if you want to assign private secondary IPv4 lists to the NAT gateways\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"nat_gateway_secondary_private_ip_addresses\" {\n+ description = \"List of secondary IPv4 address lists to assign to the NAT gateways\"\n+ type = list(list(string))\n+ default = []\n+}\n+\n variable \"nat_gateway_tags\" {\n description = \"Additional tags for the NAT gateways\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -118,6 +118,10 @@ Since AWS Lambda functions allocate Elastic Network Interfaces in proportion to\n \n You can add additional tags with `intra_subnet_tags` as with other subnet types.\n \n+## private NAT solution to address IP exhaustion\n+\n+If you need to setup overlapping CIDR ranges in your VPCs to prevent IP exhaustion and need internet access inside your private subnets. You will need to define fully private NAT gateways. Please refer to the AWS page defining the solution [here](https://docs.aws.amazon.com/whitepapers/latest/building-scalable-secure-multi-vpc-network-infrastructure/private-nat-gateway.html) for more details. You can enable this by defining private subnets inside the non routable IP address range while setuping the NAT gateways in the routable IP address range and enabling the private mode by defining the connectivity type to `private`.\n+\n ## VPC Flow Log\n \n VPC Flow Log allows to capture IP traffic for a specific network interface (ENI), subnet, or entire VPC. This module supports enabling or disabling VPC Flow Logs for entire VPC. If you need to have VPC Flow Logs for subnet or ENI, you have to manage it outside of this module with [aws_flow_log resource](https://www.terraform.io/docs/providers/aws/r/flow_log.html).\n---\nmain.tf\n@@ -1068,6 +1068,11 @@ resource \"aws_nat_gateway\" \"this\" {\n var.single_nat_gateway ? 0 : count.index,\n )\n \n+ connectivity_type = var.nat_gateway_connectivity_type\n+ private_ip = var.use_nat_gateway_private_ips ? var.nat_gateway_private_ips[count.index] : null\n+ secondary_private_ip_address_count = var.use_nat_gateway_secondary_private_ip_addresses ? length(var.nat_gateway_secondary_private_ip_addresses) : null\n+ secondary_private_ip_addresses = var.use_nat_gateway_secondary_private_ip_addresses ? var.nat_gateway_secondary_private_ip_addresses[count.index] : null\n+\n tags = merge(\n {\n \"Name\" = format(\n---\nvariables.tf\n@@ -1210,6 +1210,36 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"nat_gateway_connectivity_type\" {\n+ description = \"Connectivity type for the NAT Gateway\"\n+ type = string\n+ default = \"public\"\n+}\n+\n+variable \"use_nat_gateway_private_ips\" {\n+ description = \"Should be true if you want to assign specific IPv4 addresses to the NAT gateways\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"nat_gateway_private_ips\" {\n+ description = \"The private IPv4 address to assign to the NAT Gateways\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"use_nat_gateway_secondary_private_ip_addresses\" {\n+ description = \"Should be true if you want to assign private secondary IPv4 lists to the NAT gateways\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"nat_gateway_secondary_private_ip_addresses\" {\n+ description = \"List of secondary IPv4 address lists to assign to the NAT gateways\"\n+ type = list(list(string))\n+ default = []\n+}\n+\n variable \"nat_gateway_tags\" {\n description = \"Additional tags for the NAT gateways\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -118,6 +118,10 @@ Since AWS Lambda functions allocate Elastic Network Interfaces in proportion to\n \n You can add additional tags with `intra_subnet_tags` as with other subnet types.\n \n+## private NAT solution to address IP exhaustion\n+\n+If you need to setup overlapping CIDR ranges in your VPCs to prevent IP exhaustion and need internet access inside your private subnets. You will need to define fully private NAT gateways. Please refer to the AWS page defining the solution [here](https://docs.aws.amazon.com/whitepapers/latest/building-scalable-secure-multi-vpc-network-infrastructure/private-nat-gateway.html) for more details. You can enable this by defining private subnets inside the non routable IP address range while setuping the NAT gateways in the routable IP address range and enabling the private mode by defining the connectivity type to `private`.\n+\n ## VPC Flow Log\n \n VPC Flow Log allows to capture IP traffic for a specific network interface (ENI), subnet, or entire VPC. This module supports enabling or disabling VPC Flow Logs for entire VPC. If you need to have VPC Flow Logs for subnet or ENI, you have to manage it outside of this module with [aws_flow_log resource](https://www.terraform.io/docs/providers/aws/r/flow_log.html).\n---\nmain.tf\n@@ -1068,6 +1068,11 @@ resource \"aws_nat_gateway\" \"this\" {\n var.single_nat_gateway ? 0 : count.index,\n )\n \n+ connectivity_type = var.nat_gateway_connectivity_type\n+ private_ip = var.use_nat_gateway_private_ips ? var.nat_gateway_private_ips[count.index] : null\n+ secondary_private_ip_address_count = var.use_nat_gateway_secondary_private_ip_addresses ? length(var.nat_gateway_secondary_private_ip_addresses) : null\n+ secondary_private_ip_addresses = var.use_nat_gateway_secondary_private_ip_addresses ? var.nat_gateway_secondary_private_ip_addresses[count.index] : null\n+\n tags = merge(\n {\n \"Name\" = format(\n---\nvariables.tf\n@@ -1210,6 +1210,36 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"nat_gateway_connectivity_type\" {\n+ description = \"Connectivity type for the NAT Gateway\"\n+ type = string\n+ default = \"public\"\n+}\n+\n+variable \"use_nat_gateway_private_ips\" {\n+ description = \"Should be true if you want to assign specific IPv4 addresses to the NAT gateways\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"nat_gateway_private_ips\" {\n+ description = \"The private IPv4 address to assign to the NAT Gateways\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"use_nat_gateway_secondary_private_ip_addresses\" {\n+ description = \"Should be true if you want to assign private secondary IPv4 lists to the NAT gateways\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"nat_gateway_secondary_private_ip_addresses\" {\n+ description = \"List of secondary IPv4 address lists to assign to the NAT gateways\"\n+ type = list(list(string))\n+ default = []\n+}\n+\n variable \"nat_gateway_tags\" {\n description = \"Additional tags for the NAT gateways\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nEnable the feature described in https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1065\r\n\r\n## Motivation and Context\r\n[Issue: https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1065](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1065)\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -66,7 +66,7 @@ Passing the IPs into the module is done by setting two variables `reuse_nat_ips\n \n ## NAT Gateway Scenarios\n \n-This module supports three scenarios for `null` NAT gateways. Each will be explained in further detail in the corresponding sections.\n+This module supports four scenarios for creating NAT gateways. Each will be explained in further detail in the corresponding sections.\n \n - One NAT Gateway per subnet (default behavior)\n - `enable_nat_gateway = true`\n@@ -80,8 +80,13 @@ This module supports three scenarios for creating NAT gateways. Each will be exp\n - `enable_nat_gateway = true`\n - `single_nat_gateway = false`\n - `one_nat_gateway_per_az = true`\n+- Custom amount of NAT Gateways\n+ - `enable_nat_gateway = true`\n+ - `single_nat_gateway = false`\n+ - `one_nat_gateway_per_az = false`\n+ - `nat_gateways = 3`\n \n-If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, then `single_nat_gateway` takes precedence.\n+If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, then `single_nat_gateway` takes precedence. Likewise if both `one_nat_gateway_per_az` and `nat_gateways` are set, `one_nat_gateway_per_az` takes precedence. If all three of `single_nat_gateway`, `one_nat_gateway_per_az`, and `nat_gateways` are set, `single_nat_gateway` takes precedence.\n \n ### One NAT Gateway per subnet (default)\n \n@@ -494,6 +499,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [nat\\_gateways](#input\\_nat\\_gateways) | Pass the amount of public NAT gateways you would like to create. | `number` | `1` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n---\nexamples/complete/main.tf\n@@ -52,7 +52,8 @@ module \"vpc\" {\n enable_dns_support = true\n \n enable_nat_gateway = true\n- single_nat_gateway = true\n+ single_nat_gateway = false\n+ nat_gateways = 3\n \n customer_gateways = {\n IP1 = {\n---\nmain.tf\n@@ -1033,7 +1033,7 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n ################################################################################\n \n locals {\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : var.nat_gateways\n nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : try(aws_eip.nat[*].id, [])\n }\n \n---\nvariables.tf\n@@ -1192,6 +1192,17 @@ variable \"one_nat_gateway_per_az\" {\n default = false\n }\n \n+variable \"nat_gateways\" {\n+ description = \"Pass the amount of public NAT gateways you would like to create.\"\n+ type = number\n+ default = 1\n+\n+ validation {\n+ condition = var.nat_gateways > 0\n+ error_message = \"Must be greater than 0.\"\n+ }\n+}\n+\n variable \"reuse_nat_ips\" {\n description = \"Should be true if you don't want EIPs to be created for your NAT Gateways and will instead pass them in via the 'external_nat_ip_ids' variable\"\n type = bool\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -66,7 +66,7 @@ Passing the IPs into the module is done by setting two variables `reuse_nat_ips\n \n ## NAT Gateway Scenarios\n \n-This module supports three scenarios for creating NAT gateways. Each will be explained in further detail in the corresponding sections.\n+This module supports four scenarios for creating NAT gateways. Each will be explained in further detail in the corresponding sections.\n \n - One NAT Gateway per subnet (default behavior)\n - `enable_nat_gateway = true`\n@@ -80,8 +80,13 @@ This module supports three scenarios for creating NAT gateways. Each will be exp\n - `enable_nat_gateway = true`\n - `single_nat_gateway = false`\n - `one_nat_gateway_per_az = true`\n+- Custom amount of NAT Gateways\n+ - `enable_nat_gateway = true`\n+ - `single_nat_gateway = false`\n+ - `one_nat_gateway_per_az = false`\n+ - `nat_gateways = 3`\n \n-If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, then `single_nat_gateway` takes precedence.\n+If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, then `single_nat_gateway` takes precedence. Likewise if both `one_nat_gateway_per_az` and `nat_gateways` are set, `one_nat_gateway_per_az` takes precedence. If all three of `single_nat_gateway`, `one_nat_gateway_per_az`, and `nat_gateways` are set, `single_nat_gateway` takes precedence.\n \n ### One NAT Gateway per subnet (default)\n \n@@ -494,6 +499,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [nat\\_gateways](#input\\_nat\\_gateways) | Pass the amount of public NAT gateways you would like to create. | `number` | `1` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n---\nexamples/complete/main.tf\n@@ -52,7 +52,8 @@ module \"vpc\" {\n enable_dns_support = true\n \n enable_nat_gateway = true\n- single_nat_gateway = true\n+ single_nat_gateway = false\n+ nat_gateways = 3\n \n customer_gateways = {\n IP1 = {\n---\nmain.tf\n@@ -1033,7 +1033,7 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n ################################################################################\n \n locals {\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : var.nat_gateways\n nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : try(aws_eip.nat[*].id, [])\n }\n \n---\nvariables.tf\n@@ -1192,6 +1192,17 @@ variable \"one_nat_gateway_per_az\" {\n default = false\n }\n \n+variable \"nat_gateways\" {\n+ description = \"Pass the amount of public NAT gateways you would like to create.\"\n+ type = number\n+ default = 1\n+\n+ validation {\n+ condition = var.nat_gateways > 0\n+ error_message = \"Must be greater than 0.\"\n+ }\n+}\n+\n variable \"reuse_nat_ips\" {\n description = \"Should be true if you don't want EIPs to be created for your NAT Gateways and will instead pass them in via the 'external_nat_ip_ids' variable\"\n type = bool\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -66,7 +66,7 @@ Passing the IPs into the module is done by setting two variables `reuse_nat_ips\n \n ## NAT Gateway Scenarios\n \n-This be supports three scenarios for creating NAT gateways. Each will be explained in further detail in the corresponding sections.\n+This module supports four scenarios for creating NAT gateways. Each will be explained in further detail in the corresponding sections.\n \n - One NAT Gateway per subnet (default behavior)\n - `enable_nat_gateway = true`\n@@ -80,8 +80,13 @@ This module supports three scenarios for creating NAT gateways. Each will be exp\n - `enable_nat_gateway = true`\n - `single_nat_gateway = false`\n - `one_nat_gateway_per_az = true`\n+- Custom amount of NAT Gateways\n+ - `enable_nat_gateway = true`\n+ - `single_nat_gateway = false`\n+ - `one_nat_gateway_per_az = false`\n+ - `nat_gateways = 3`\n \n-If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, then `single_nat_gateway` takes precedence.\n+If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, then `single_nat_gateway` takes precedence. Likewise if both `one_nat_gateway_per_az` and `nat_gateways` are set, `one_nat_gateway_per_az` takes precedence. If all three of `single_nat_gateway`, `one_nat_gateway_per_az`, and `nat_gateways` are set, `single_nat_gateway` takes precedence.\n \n ### One NAT Gateway per subnet (default)\n \n@@ -494,6 +499,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [nat\\_gateways](#input\\_nat\\_gateways) | Pass the amount of public NAT gateways you would like to create. | `number` | `1` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n---\nexamples/complete/main.tf\n@@ -52,7 +52,8 @@ module \"vpc\" {\n enable_dns_support = true\n \n enable_nat_gateway = true\n- single_nat_gateway = true\n+ single_nat_gateway = false\n+ nat_gateways = 3\n \n customer_gateways = {\n IP1 = {\n---\nmain.tf\n@@ -1033,7 +1033,7 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n ################################################################################\n \n locals {\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : var.nat_gateways\n nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : try(aws_eip.nat[*].id, [])\n }\n \n---\nvariables.tf\n@@ -1192,6 +1192,17 @@ variable \"one_nat_gateway_per_az\" {\n default = false\n }\n \n+variable \"nat_gateways\" {\n+ description = \"Pass the amount of public NAT gateways you would like to create.\"\n+ type = number\n+ default = 1\n+\n+ validation {\n+ condition = var.nat_gateways > 0\n+ error_message = \"Must be greater than 0.\"\n+ }\n+}\n+\n variable \"reuse_nat_ips\" {\n description = \"Should be true if you don't want EIPs to be created for your NAT Gateways and will instead pass them in via the 'external_nat_ip_ids' variable\"\n type = bool\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -66,7 +66,7 @@ Passing the IPs into the module is done by setting two variables `reuse_nat_ips\n \n ## NAT Gateway Scenarios\n \n-This module supports three scenarios for creating NAT gateways. Each will be explained in further detail in the corresponding sections.\n+This module supports four scenarios for creating NAT gateways. Each will be explained in further detail in the corresponding sections.\n \n - One NAT Gateway per subnet (default behavior)\n - `enable_nat_gateway = true`\n@@ -80,8 +80,13 @@ This module supports three scenarios for creating NAT gateways. Each will be exp\n - `enable_nat_gateway = true`\n - `single_nat_gateway = false`\n - `one_nat_gateway_per_az = true`\n+- Custom amount of NAT Gateways\n+ - `enable_nat_gateway = true`\n+ - `single_nat_gateway = false`\n+ - `one_nat_gateway_per_az = false`\n+ - `nat_gateways = 3`\n \n-If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, then `single_nat_gateway` takes precedence.\n+If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, then `single_nat_gateway` takes precedence. Likewise if both `one_nat_gateway_per_az` and `nat_gateways` are set, `one_nat_gateway_per_az` takes precedence. If all three of `single_nat_gateway`, `one_nat_gateway_per_az`, and `nat_gateways` are set, `single_nat_gateway` takes precedence.\n \n ### One NAT Gateway per subnet (default)\n \n@@ -494,6 +499,7 @@ No modules.\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| [nat\\_gateways](#input\\_nat\\_gateways) | Pass the amount of public NAT gateways you would like to create. | `number` | `1` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs` | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | [outpost\\_arn](#input\\_outpost\\_arn) | ARN of Outpost you want to create a subnet in | `string` | `null` | no |\n---\nexamples/complete/main.tf\n@@ -52,7 +52,8 @@ module \"vpc\" {\n enable_dns_support = true\n \n enable_nat_gateway = true\n- single_nat_gateway = true\n+ single_nat_gateway = false\n+ nat_gateways = 3\n \n customer_gateways = {\n IP1 = {\n---\nmain.tf\n@@ -1033,7 +1033,7 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n ################################################################################\n \n locals {\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ {\n = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : var.nat_gateways\n nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : try(aws_eip.nat[*].id, [])\n }\n \n---\nvariables.tf\n@@ -1192,6 +1192,17 @@ variable \"one_nat_gateway_per_az\" {\n default = false\n }\n \n+variable \"nat_gateways\" {\n+ description = \"Pass the amount of public NAT gateways you would like to create.\"\n+ type = number\n+ default = 1\n+\n+ validation {\n+ condition = var.nat_gateways > 0\n+ error_message = \"Must be greater than 0.\"\n+ }\n+}\n+\n variable \"reuse_nat_ips\" {\n description = \"Should be true if you don't want EIPs to be created for your NAT Gateways and will instead pass them in via the 'external_nat_ip_ids' variable\"\n type = bool\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\ndatabase/redshift/elasticache subnets can use private route tables.\r\n\r\n## Motivation and Context\r\n\r\n\r\n- https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/944\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -218,7 +218,8 @@ resource \"aws_network_acl_rule\" \"public_outbound\" {\n ################################################################################\n \n locals {\n- create_private_subnets = local.create_vpc && local.len_private_subnets > 0\n+ create_private_subnets = local.create_vpc && local.len_private_subnets > 0\n+ create_private_route_table = (local.create_private_subnets && local.max_subnet_length > 0) || (local.create_database_subnets && !local.create_database_route_table) || (local.create_redshift_subnets && !local.create_redshift_route_table) || (local.create_elasticache_subnets && !local.create_elasticache_route_table)\n }\n \n resource \"aws_subnet\" \"private\" {\n@@ -251,7 +252,7 @@ resource \"aws_subnet\" \"private\" {\n \n # There are as many routing tables as the number of NAT gateways\n resource \"aws_route_table\" \"private\" {\n- count = local.create_private_subnets && local.max_subnet_length > 0 ? local.nat_gateway_count : 0\n+ count = local.create_private_route_table ? local.nat_gateway_count : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -218,7 +218,8 @@ resource \"aws_network_acl_rule\" \"public_outbound\" {\n ################################################################################\n \n locals {\n- create_private_subnets = local.create_vpc && > 0\n+ create_private_subnets = local.create_vpc && local.len_private_subnets > 0\n+ create_private_route_table = (local.create_private_subnets && local.max_subnet_length > 0) || (local.create_database_subnets && !local.create_database_route_table) || (local.create_redshift_subnets && !local.create_redshift_route_table) || (local.create_elasticache_subnets && !local.create_elasticache_route_table)\n }\n \n resource \"aws_subnet\" \"private\" {\n@@ -251,7 +252,7 @@ resource \"aws_subnet\" \"private\" {\n \n # There are as many routing tables as the number of NAT gateways\n resource \"aws_route_table\" \"private\" {\n- count = local.create_private_subnets && local.max_subnet_length > 0 ? local.nat_gateway_count : 0\n+ count = local.create_private_route_table ? local.nat_gateway_count : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -218,7 +218,8 @@ resource \"aws_network_acl_rule\" \"public_outbound\" {\n ################################################################################\n \n locals {\n- create_private_subnets = && && local.len_private_subnets > 0\n+ create_private_subnets = local.create_vpc && local.len_private_subnets > 0\n+ create_private_route_table = (local.create_private_subnets && local.max_subnet_length > 0) || (local.create_database_subnets && !local.create_database_route_table) || (local.create_redshift_subnets && !local.create_redshift_route_table) || (local.create_elasticache_subnets && !local.create_elasticache_route_table)\n }\n \n resource \"aws_subnet\" \"private\" {\n@@ -251,7 +252,7 @@ resource \"aws_subnet\" \"private\" {\n \n # There are as many routing tables as the number of NAT gateways\n resource \"aws_route_table\" \"private\" {\n- count = local.create_private_subnets && local.max_subnet_length > 0 ? local.nat_gateway_count : 0\n+ count = local.create_private_route_table ? local.nat_gateway_count : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n\nChoice D:\nlocal.nat_gateway_count -218,7 +218,8 @@ resource \"aws_network_acl_rule\" \"public_outbound\" {\n ################################################################################\n \n locals {\n- create_private_subnets = local.create_vpc && local.len_private_subnets > 0\n+ create_private_subnets = local.create_vpc && local.len_private_subnets > 0\n+ create_private_route_table = (local.create_private_subnets && local.max_subnet_length > 0) || (local.create_database_subnets && !local.create_database_route_table) || (local.create_redshift_subnets && !local.create_redshift_route_table) || (local.create_elasticache_subnets && !local.create_elasticache_route_table)\n }\n \n resource \"aws_subnet\" \"private\" {\n@@ -251,7 +252,7 @@ resource \"aws_subnet\" \"private\" {\n \n # There are as many routing tables as the number of NAT gateways\n resource \"aws_route_table\" \"private\" {\n- count = local.create_private_subnets && local.max_subnet_length > 0 ? local.nat_gateway_count : 0\n+ count = local.create_private_route_table ? local.nat_gateway_count : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nPrivate IPv6 Egress routes are now only created when having at least a private subnet\r\n\r\n## Motivation and Context\r\n\r\nVersion 5.7.1 of the module solved the issue #1058 by limiting the amount of IPv6 egress routes created to the amount of NAT gateways provisioned (hence to the amount of Route Tables created).\r\n\r\nHowever the condition that regulates the number of IPv6 egress routes created doesn't check if the creation of any private subnet is actually wanted \r\n\r\n\r\n- Resolves #1061 \r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -1021,7 +1021,7 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_ipv6_egress\" {\n- count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 ? local.nat_gateway_count : 0\n+ count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 && local.len_private_subnets > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_ipv6_cidr_block = \"::/0\"\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1021,7 +1021,7 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_ipv6_egress\" {\n- count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 ? local.nat_gateway_count : count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 && local.len_private_subnets > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_ipv6_cidr_block = \"::/0\"\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1021,7 +1021,7 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_ipv6_egress\" {\n- count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 ? local.nat_gateway_count : 0\n+ count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 && local.len_private_subnets > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_ipv6_cidr_block = \"::/0\"\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1021,7 +1021,7 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_ipv6_egress\" {\n- count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 ? \"::/0\"\n---\n : 0\n+ count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 && local.len_private_subnets > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_ipv6_cidr_block = \"::/0\"\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nFixes issue with routes creation for IPv6 private subnets when you have following setup:\r\n```\r\n private_subnets = [\r\n \"10.0.0.0/24\", \"10.0.1.0/24\", \"10.0.2.0/24\",\r\n \"10.0.3.0/24\", \"10.0.4.0/24\", \"10.0.5.0/24\",\r\n ]\r\n\r\n private_subnet_ipv6_prefixes = [\r\n 1, 2, 3,\r\n 4, 5, 6\r\n ]\r\n enable_nat_gateway = true\r\n single_nat_gateway = false\r\n one_nat_gateway_per_az = true\r\n create_egress_only_igw = true\r\n```\r\n\r\nthanks to @RunCor399\r\n\r\n## Motivation and Context\r\n- Resolves #1058\r\n\r\n## Breaking Changes\r\nnone\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [X] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [X] I have executed `pre-commit run -a` on my pull request\r\n\r\n\r\nBefore the change:\r\n```\r\n # aws_route.private_ipv6_egress[0] will be created\r\n + resource \"aws_route\" \"private_ipv6_egress\" {\r\n + destination_ipv6_cidr_block = \"::/0\"\r\n + egress_only_gateway_id = (known after apply)\r\n + id = (known after apply)\r\n + instance_id = (known after apply)\r\n + instance_owner_id = (known after apply)\r\n + network_interface_id = (known after apply)\r\n + origin = (known after apply)\r\n + route_table_id = (known after apply)\r\n + state = (known after apply)\r\n }\r\n\r\n # aws_route.private_ipv6_egress[1] will be created\r\n + resource \"aws_route\" \"private_ipv6_egress\" {\r\n + destination_ipv6_cidr_block = \"::/0\"\r\n + egress_only_gateway_id = (known after apply)\r\n + id = (known after apply)\r\n + instance_id = (known after apply)\r\n + instance_owner_id = (known after apply)\r\n + network_interface_id = (known after apply)\r\n + origin = (known after apply)\r\n + route_table_id = (known after apply)\r\n + state = (known after apply)\r\n }\r\n\r\n # aws_route.private_ipv6_egress[2] will be created\r\n + resource \"aws_route\" \"private_ipv6_egress\" {\r\n + destination_ipv6_cidr_block = \"::/0\"\r\n + egress_only_gateway_id = (known after apply)\r\n + id = (known after apply)\r\n + instance_id = (known after apply)\r\n + instance_owner_id = (known after apply)\r\n + network_interface_id = (known after apply)\r\n + origin = (known after apply)\r\n + route_table_id = (known after apply)\r\n + state = (known after apply)\r\n }\r\n\r\n # aws_route.private_ipv6_egress[3] will be created\r\n + resource \"aws_route\" \"private_ipv6_egress\" {\r\n + destination_ipv6_cidr_block = \"::/0\"\r\n + egress_only_gateway_id = (known after apply)\r\n + id = (known after apply)\r\n + instance_id = (known after apply)\r\n + instance_owner_id = (known after apply)\r\n + network_interface_id = (known after apply)\r\n + origin = (known after apply)\r\n + route_table_id = (known after apply)\r\n + state = (known after apply)\r\n }\r\n\r\n # aws_route.private_ipv6_egress[4] will be created\r\n + resource \"aws_route\" \"private_ipv6_egress\" {\r\n + destination_ipv6_cidr_block = \"::/0\"\r\n + egress_only_gateway_id = (known after apply)\r\n + id = (known after apply)\r\n + instance_id = (known after apply)\r\n + instance_owner_id = (known after apply)\r\n + network_interface_id = (known after apply)\r\n + origin = (known after apply)\r\n + route_table_id = (known after apply)\r\n + state = (known after apply)\r\n }\r\n\r\n # aws_route.private_ipv6_egress[5] will be created\r\n + resource \"aws_route\" \"private_ipv6_egress\" {\r\n + destination_ipv6_cidr_block = \"::/0\"\r\n + egress_only_gateway_id = (known after apply)\r\n + id = (known after apply)\r\n + instance_id = (known after apply)\r\n + instance_owner_id = (known after apply)\r\n + network_interface_id = (known after apply)\r\n + origin = (known after apply)\r\n + route_table_id = (known after apply)\r\n + state = (known after apply)\r\n }\r\n```\r\n\r\n\r\nAfter the change:\r\n```\r\n # aws_route.private_ipv6_egress[0] will be created\r\n + resource \"aws_route\" \"private_ipv6_egress\" {\r\n + destination_ipv6_cidr_block = \"::/0\"\r\n + egress_only_gateway_id = (known after apply)\r\n + id = (known after apply)\r\n + instance_id = (known after apply)\r\n + instance_owner_id = (known after apply)\r\n + network_interface_id = (known after apply)\r\n + origin = (known after apply)\r\n + route_table_id = (known after apply)\r\n + state = (known after apply)\r\n }\r\n\r\n # aws_route.private_ipv6_egress[1] will be created\r\n + resource \"aws_route\" \"private_ipv6_egress\" {\r\n + destination_ipv6_cidr_block = \"::/0\"\r\n + egress_only_gateway_id = (known after apply)\r\n + id = (known after apply)\r\n + instance_id = (known after apply)\r\n + instance_owner_id = (known after apply)\r\n + network_interface_id = (known after apply)\r\n + origin = (known after apply)\r\n + route_table_id = (known after apply)\r\n + state = (known after apply)\r\n }\r\n\r\n # aws_route.private_ipv6_egress[2] will be created\r\n + resource \"aws_route\" \"private_ipv6_egress\" {\r\n + destination_ipv6_cidr_block = \"::/0\"\r\n + egress_only_gateway_id = (known after apply)\r\n + id = (known after apply)\r\n + instance_id = (known after apply)\r\n + instance_owner_id = (known after apply)\r\n + network_interface_id = (known after apply)\r\n + origin = (known after apply)\r\n + route_table_id = (known after apply)\r\n + state = (known after apply)\r\n }\r\n```\n\n---\n\nChoice A:\nmain.tf\n@@ -1021,7 +1021,7 @@ \"aws_route\" \"aws_egress_only_internet_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_ipv6_egress\" {\n- count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 ? local.len_private_subnets : 0\n+ count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_ipv6_cidr_block = \"::/0\"\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1021,7 +1021,7 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_ipv6_egress\" {\n- count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 ? local.len_private_subnets : 0\n+ count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 ? local.nat_gateway_count : 0\n \n route_table_id \n = element(aws_route_table.private[*].id, count.index)\n destination_ipv6_cidr_block = \"::/0\"\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1021,7 +1021,7 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_ipv6_egress\" {\n- count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 ? local.len_private_subnets : 0\n+ count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_ipv6_cidr_block = \"::/0\"\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1021,7 +1021,7 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n && \n resource \"aws_route\" \"private_ipv6_egress\" {\n- count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 ? local.len_private_subnets : 0\n+ count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_ipv6_cidr_block = \"::/0\"\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n\r\nAdds feature to allow overriding for each `aws_vpc_endpoint` `service_name` property, but defaulting to data if not defined.\r\n\r\nAdditionally this allows users to use specify fips endpoints if needed.\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\nfixes #1054 \r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\nN/A\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\r\nHave a PR here for an example where this was tested using changes in my `.terraform` directory which I replicated in this fork.\r\nhttps://github.com/defenseunicorns/terraform-aws-vpc/pull/113\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/main.tf\n@@ -24,7 +24,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = local.endpoints\n \n vpc_id = var.vpc_id\n- service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n+ service_name = try(each.value.service_endpoint, data.aws_vpc_endpoint_service.this[each.key].service_name)\n vpc_endpoint_type = try(each.value.service_type, \"Interface\")\n auto_accept = try(each.value.auto_accept, null)\n \n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/main.tf\n@@ -24,7 +24,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = local.endpoints\n \n vpc_id = var.vpc_id\n- service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n+ service_name = try(each.value.service_endpoint, data.aws_vpc_endpoint_service.this[each.key].service_name)\n vpc_endpoint_type = try(each.value.service_type, \"Interface\")\n auto_accept = try(each.value.auto_accept, null)\n \n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/main.tf\n@@ -24,7 +24,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = local.endpoints\n \n vpc_id = var.vpc_id\n- service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n+ service_name = try(each.value.service_endpoint, data.aws_vpc_endpoint_service.this[each.key].service_name)\n vpc_endpoint_type = data.aws_vpc_endpoint_service.this[each.key].service_name)\n \"Interface\")\n auto_accept = try(each.value.auto_accept, null)\n \n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/main.tf\n@@ -24,7 +24,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = local.endpoints\n \n vpc_id = var.vpc_id\n- service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n+ service_name = data.aws_vpc_endpoint_service.this[each.key].service_name)\n vpc_endpoint_type = try(each.value.service_type, \"Interface\")\n auto_accept = try(each.value.auto_accept, null)\n \n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdding new private subnets to an already deployed vpc module leads to the replacement of the nat gateways for all the subnets that already existing. \r\n\r\nThere is no reason to use the **try** function in that case. \r\n\r\n## Motivation and Context\r\n- https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/999\r\n- https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1018\r\n\r\n## Breaking Changes\r\nnone\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\nBefore the change\r\n\r\n```\r\n1 to add, 1 to destroy.\r\n\r\n # module.network.module.network.module.vpc.aws_nat_gateway.this[0] must be replaced\r\n-/+ resource \"aws_nat_gateway\" \"this\" {\r\n ~ allocation_id = \"redacted-***\" -> (known after apply) # forces replacement\r\n ~ association_id = \"redacted-***\" -> (known after apply)\r\n ~ id = \"redacted-***\" -> (known after apply)\r\n ~ network_interface_id = \"redacted-***\" -> (known after apply)\r\n ~ private_ip = \"redacted-***\" -> (known after apply)\r\n ~ public_ip = \"redacted-***\" -> (known after apply)\r\n # (3 unchanged attributes hidden)\r\n }\r\n```\r\n\r\nAfter the change\r\n\r\n```\r\n1 to add, 0 to destroy.\r\n```\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -1034,7 +1034,7 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n \n locals {\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n- nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : try(aws_eip.nat[*].id, [])\n+ nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : aws_eip.nat[*].id\n }\n \n resource \"aws_eip\" \"nat\" {\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1034,7 +1034,7 @@ resource var.reuse_nat_ips \"private_ipv6_egress\" {\n \n locals {\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n- nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : try(aws_eip.nat[*].id, [])\n+ nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : aws_eip.nat[*].id\n }\n \n resource \"aws_eip\" \"nat\" {\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1034,7 +1034,7 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n \n locals {\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n- nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : try(aws_eip.nat[*].id, [])\n+ var.single_nat_gateway = var.reuse_nat_ips ? var.external_nat_ip_ids : aws_eip.nat[*].id\n }\n \n resource \"aws_eip\" \"nat\" {\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1034,7 +1034,7 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n \n locals {\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az var.external_nat_ip_ids length(var.azs) : local.max_subnet_length\n- nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : try(aws_eip.nat[*].id, [])\n+ nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : aws_eip.nat[*].id\n }\n \n resource \"aws_eip\" \"nat\" {\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\n\n- Update CI workflow versions to remove deprecated runtime warnings\n\n## Motivation and Context\n\n- Updates our workflows to use the latest versions\n- Removes the `deprecated runtime` warnings from the workflow execution output\n\n## Breaking Changes\n\n- No\n\n## How Has This Been Tested?\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\n- [ ] I have executed `pre-commit run -a` on my pull request\n\n\n---\n\nChoice A:\n.github/workflows/lock.yml\n@@ -8,7 +8,7 @@ jobs:\n lock:\n runs-on: ubuntu-latest\n steps:\n- - uses: dessant/lock-threads@v4\n+ - uses: dessant/lock-threads@v5\n with:\n github-token: ${{ secrets.GITHUB_TOKEN }}\n issue-comment: >\n---\n.github/workflows/pr-title.yml\n@@ -14,7 +14,7 @@ jobs:\n steps:\n # Please look up the latest version from\n # https://github.com/amannn/action-semantic-pull-request/releases\n- - uses: amannn/action-semantic-pull-request@v5.0.2\n+ - uses: amannn/action-semantic-pull-request@v5.4.0\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n with:\n---\n.github/workflows/pre-commit.yml\n@@ -8,7 +8,7 @@ on:\n \n env:\n TERRAFORM_DOCS_VERSION: v0.16.0\n- TFLINT_VERSION: v0.44.1\n+ TFLINT_VERSION: v0.50.3\n \n jobs:\n collectInputs:\n@@ -18,11 +18,11 @@ jobs:\n directories: ${{ steps.dirs.outputs.directories }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/directories@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/directories@v1.9.0\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -32,19 +32,27 @@ jobs:\n matrix:\n directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}\n steps:\n+ # https://github.com/orgs/community/discussions/25678#discussioncomment-5242449\n+ - name: Delete huge unnecessary tools folder\n+ run: |\n+ rm -rf /opt/hostedtoolcache/CodeQL\n+ rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk\n+ rm -rf /opt/hostedtoolcache/Ruby\n+ rm -rf /opt/hostedtoolcache/go\n+\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.4\n+ uses: clowdhaus/terraform-min-max@v1.3.0\n with:\n directory: ${{ matrix.directory }}\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory != '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n tflint-version: ${{ env.TFLINT_VERSION }}\n@@ -53,7 +61,7 @@ jobs:\n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n tflint-version: ${{ env.TFLINT_VERSION }}\n@@ -64,18 +72,26 @@ jobs:\n runs-on: ubuntu-latest\n needs: collectInputs\n steps:\n+ # https://github.com/orgs/community/discussions/25678#discussioncomment-5242449\n+ - name: Delete huge unnecessary tools folder\n+ run: |\n+ rm -rf /opt/hostedtoolcache/CodeQL\n+ rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk\n+ rm -rf /opt/hostedtoolcache/Ruby\n+ rm -rf /opt/hostedtoolcache/go\n+\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n with:\n ref: ${{ github.event.pull_request.head.ref }}\n repository: ${{github.event.pull_request.head.repo.full_name}}\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.4\n+ uses: clowdhaus/terraform-min-max@v1.3.0\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n tflint-version: ${{ env.TFLINT_VERSION }}\n---\n.github/workflows/release.yml\n@@ -20,18 +20,18 @@ jobs:\n if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n with:\n persist-credentials: false\n fetch-depth: 0\n \n - name: Release\n- uses: cycjimmy/semantic-release-action@v3\n+ uses: cycjimmy/semantic-release-action@v4\n with:\n- semantic_version: 18.0.0\n+ semantic_version: 23.0.2\n extra_plugins: |\n- @semantic-release/changelog@6.0.0\n- @semantic-release/git@10.0.0\n- conventional-changelog-conventionalcommits@4.6.3\n+ @semantic-release/changelog@6.0.3\n+ @semantic-release/git@10.0.1\n+ conventional-changelog-conventionalcommits@7.0.2\n env:\n GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}\n---\n.github/workflows/stale-actions.yaml\n@@ -7,7 +7,7 @@ jobs:\n stale:\n runs-on: ubuntu-latest\n steps:\n- - uses: actions/stale@v6\n+ - uses: actions/stale@v9\n with:\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n # Staling issues and PR's\n---\n.pre-commit-config.yaml\n@@ -1,9 +1,8 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.86.0\n+ rev: v1.88.0\n hooks:\n - id: terraform_fmt\n- - id: terraform_validate\n - id: terraform_docs\n args:\n - '--args=--lockfile=false'\n@@ -22,8 +21,11 @@ repos:\n - '--args=--only=terraform_required_providers'\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n+ - '--args=--only=terraform_unused_required_providers'\n+ - id: terraform_validate\n - repo: https://github.com/pre-commit/pre-commit-hooks\n rev: v4.5.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n+ - id: trailing-whitespace\n---\nexamples/separate-route-tables/README.md\n@@ -1,6 +1,6 @@\n # VPC with separate private route tables\n \n-Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple-vpc](../simple-vpc) for more simplified setup). \n+Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple-vpc](../simple-vpc) for more simplified setup).\n \n There are public, private, database, ElastiCache, Redshift subnets, NAT Gateways created in each availability zone. **This example sets up separate private route for database, elasticache and redshift subnets.**.\n \n---\n\n\n---\n\nChoice B:\n.github/workflows/lock.yml\n@@ -8,7 +8,7 @@ jobs:\n lock:\n runs-on: ubuntu-latest\n steps:\n- - uses: dessant/lock-threads@v4\n+ - uses: dessant/lock-threads@v5\n with:\n github-token: ${{ secrets.GITHUB_TOKEN }}\n issue-comment: >\n---\n.github/workflows/pr-title.yml\n@@ -14,7 +14,7 @@ jobs:\n steps:\n # Please look up the latest version from\n # https://github.com/amannn/action-semantic-pull-request/releases\n- - uses: amannn/action-semantic-pull-request@v5.0.2\n+ - uses: amannn/action-semantic-pull-request@v5.4.0\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n with:\n---\n.github/workflows/pre-commit.yml\n@@ -8,7 +8,7 @@ on:\n \n env:\n TERRAFORM_DOCS_VERSION: v0.16.0\n- TFLINT_VERSION: v0.44.1\n+ TFLINT_VERSION: v0.50.3\n \n jobs:\n collectInputs:\n@@ -18,11 +18,11 @@ jobs:\n directories: ${{ steps.dirs.outputs.directories }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/directories@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/directories@v1.9.0\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -32,19 +32,27 @@ jobs:\n matrix:\n directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}\n steps:\n+ # https://github.com/orgs/community/discussions/25678#discussioncomment-5242449\n+ - name: Delete huge unnecessary tools folder\n+ run: |\n+ rm -rf /opt/hostedtoolcache/CodeQL\n+ rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk\n+ rm -rf /opt/hostedtoolcache/Ruby\n+ rm -rf /opt/hostedtoolcache/go\n+\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.4\n+ uses: clowdhaus/terraform-min-max@v1.3.0\n with:\n directory: ${{ matrix.directory }}\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory != '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n tflint-version: ${{ env.TFLINT_VERSION }}\n@@ -53,7 +61,7 @@ jobs:\n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n tflint-version: ${{ env.TFLINT_VERSION }}\n@@ -64,18 +72,26 @@ jobs:\n runs-on: ubuntu-latest\n needs: collectInputs\n steps:\n+ # https://github.com/orgs/community/discussions/25678#discussioncomment-5242449\n+ - name: Delete huge unnecessary tools folder\n+ run: |\n+ rm -rf /opt/hostedtoolcache/CodeQL\n+ rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk\n+ rm -rf /opt/hostedtoolcache/Ruby\n+ rm -rf /opt/hostedtoolcache/go\n+\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n with:\n ref: ${{ github.event.pull_request.head.ref }}\n repository: ${{github.event.pull_request.head.repo.full_name}}\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.4\n+ uses: clowdhaus/terraform-min-max@v1.3.0\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n tflint-version: ${{ env.TFLINT_VERSION }}\n---\n.github/workflows/release.yml\n@@ -20,18 +20,18 @@ jobs:\n if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n -rf with:\n persist-credentials: false\n fetch-depth: 0\n \n - name: Release\n- uses: cycjimmy/semantic-release-action@v3\n+ uses: cycjimmy/semantic-release-action@v4\n with:\n- semantic_version: 18.0.0\n+ semantic_version: 23.0.2\n extra_plugins: |\n- @semantic-release/changelog@6.0.0\n- @semantic-release/git@10.0.0\n- conventional-changelog-conventionalcommits@4.6.3\n+ @semantic-release/changelog@6.0.3\n+ @semantic-release/git@10.0.1\n+ conventional-changelog-conventionalcommits@7.0.2\n env:\n GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}\n---\n.github/workflows/stale-actions.yaml\n@@ -7,7 +7,7 @@ jobs:\n stale:\n runs-on: ubuntu-latest\n steps:\n- - uses: actions/stale@v6\n+ - uses: actions/stale@v9\n with:\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n # Staling issues and PR's\n---\n.pre-commit-config.yaml\n@@ -1,9 +1,8 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.86.0\n+ rev: v1.88.0\n hooks:\n - id: terraform_fmt\n- - id: terraform_validate\n - id: terraform_docs\n args:\n - '--args=--lockfile=false'\n@@ -22,8 +21,11 @@ repos:\n - '--args=--only=terraform_required_providers'\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n+ - '--args=--only=terraform_unused_required_providers'\n+ - id: terraform_validate\n - repo: https://github.com/pre-commit/pre-commit-hooks\n rev: v4.5.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n+ - id: trailing-whitespace\n---\nexamples/separate-route-tables/README.md\n@@ -1,6 +1,6 @@\n # VPC with separate private route tables\n \n-Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple-vpc](../simple-vpc) for more simplified setup). \n+Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple-vpc](../simple-vpc) for more simplified setup).\n \n There are public, private, database, ElastiCache, Redshift subnets, NAT Gateways created in each availability zone. **This example sets up separate private route for database, elasticache and redshift subnets.**.\n \n---\n\n\n---\n\nChoice C:\n.github/workflows/lock.yml\n@@ -8,7 +8,7 @@ jobs:\n lock:\n runs-on: ubuntu-latest\n steps:\n- - uses: dessant/lock-threads@v4\n+ - uses: dessant/lock-threads@v5\n with:\n github-token: ${{ secrets.GITHUB_TOKEN }}\n issue-comment: >\n---\n.github/workflows/pr-title.yml\n@@ -14,7 +14,7 @@ jobs:\n steps:\n # Please look up the latest version from\n # https://github.com/amannn/action-semantic-pull-request/releases\n- - uses: amannn/action-semantic-pull-request@v5.0.2\n+ - uses: amannn/action-semantic-pull-request@v5.4.0\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n with:\n---\n.github/workflows/pre-commit.yml\n@@ -8,7 +8,7 @@ on:\n \n env:\n TERRAFORM_DOCS_VERSION: v0.16.0\n- TFLINT_VERSION: v0.44.1\n+ TFLINT_VERSION: v0.50.3\n \n jobs:\n collectInputs:\n@@ -18,11 +18,11 @@ jobs:\n directories: ${{ steps.dirs.outputs.directories }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/directories@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/directories@v1.9.0\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -32,19 +32,27 @@ jobs:\n matrix:\n directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}\n steps:\n+ # https://github.com/orgs/community/discussions/25678#discussioncomment-5242449\n+ - name: Delete huge unnecessary tools folder\n+ run: |\n+ rm -rf /opt/hostedtoolcache/CodeQL\n+ rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk\n+ rm -rf /opt/hostedtoolcache/Ruby\n+ rm -rf /opt/hostedtoolcache/go\n+\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.4\n+ uses: clowdhaus/terraform-min-max@v1.3.0\n with:\n directory: ${{ matrix.directory }}\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory != '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n tflint-version: ${{ env.TFLINT_VERSION }}\n@@ -53,7 +61,7 @@ jobs:\n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n tflint-version: ${{ env.TFLINT_VERSION }}\n@@ -64,18 +72,26 @@ jobs:\n runs-on: ubuntu-latest\n needs: collectInputs\n steps:\n+ # https://github.com/orgs/community/discussions/25678#discussioncomment-5242449\n+ - name: Delete huge unnecessary tools folder\n+ run: |\n+ rm -rf /opt/hostedtoolcache/CodeQL\n+ rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk\n+ rm -rf /opt/hostedtoolcache/Ruby\n+ rm -rf /opt/hostedtoolcache/go\n+\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n with:\n ref: ${{ github.event.pull_request.head.ref }}\n repository: ${{github.event.pull_request.head.repo.full_name}}\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.4\n+ uses: clowdhaus/terraform-min-max@v1.3.0\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n tflint-version: ${{ env.TFLINT_VERSION }}\n---\n.github/workflows/release.yml\n@@ -20,18 +20,18 @@ jobs:\n if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n with:\n persist-credentials: false\n fetch-depth: 0\n \n - name: Release\n- uses: cycjimmy/semantic-release-action@v3\n+ uses: cycjimmy/semantic-release-action@v4\n with:\n- semantic_version: 18.0.0\n+ semantic_version: 23.0.2\n extra_plugins: |\n- @semantic-release/changelog@6.0.0\n- @semantic-release/git@10.0.0\n- conventional-changelog-conventionalcommits@4.6.3\n+ @semantic-release/changelog@6.0.3\n+ @semantic-release/git@10.0.1\n+ conventional-changelog-conventionalcommits@7.0.2\n env:\n GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}\n---\n.github/workflows/stale-actions.yaml\n@@ -7,7 +7,7 @@ jobs:\n stale:\n runs-on: ubuntu-latest\n steps:\n- - uses: actions/stale@v6\n+ - uses: actions/stale@v9\n with:\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n # Staling issues and PR's\n---\n.pre-commit-config.yaml\n@@ -1,9 +1,8 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.86.0\n+ rev: v1.88.0\n hooks:\n - id: terraform_fmt\n- - id: terraform_validate\n - id: terraform_docs\n args:\n - '--args=--lockfile=false'\n@@ -22,8 +21,11 @@ repos:\n - '--args=--only=terraform_required_providers'\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n+ - '--args=--only=terraform_unused_required_providers'\n+ - id: terraform_validate\n - repo: https://github.com/pre-commit/pre-commit-hooks\n rev: v4.5.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n+ - id: trailing-whitespace\n---\nexamples/separate-route-tables/README.md\n@@ -1,6 +1,6 @@\n # VPC with separate private route tables\n \n-Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple-vpc](../simple-vpc) for more simplified setup). \n+Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple-vpc](../simple-vpc) for more simplified setup).\n \n There are public, private, database, ElastiCache, Redshift subnets, NAT Gateways created in each availability zone. **This example sets up separate private route for database, elasticache and redshift subnets.**.\n \n---\n\n\n---\n\nChoice D:\n.github/workflows/lock.yml\n@@ -8,7 +8,7 @@ jobs:\n lock:\n runs-on: ubuntu-latest\n steps:\n- - uses: dessant/lock-threads@v4\n+ - uses: dessant/lock-threads@v5\n with:\n github-token: ${{ secrets.GITHUB_TOKEN }}\n issue-comment: >\n---\n.github/workflows/pr-title.yml\n@@ -14,7 +14,7 @@ jobs:\n steps:\n # Please look up the latest version from\n # https://github.com/amannn/action-semantic-pull-request/releases\n- - uses: amannn/action-semantic-pull-request@v5.0.2\n+ - uses: amannn/action-semantic-pull-request@v5.4.0\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n with:\n---\n.github/workflows/pre-commit.yml\n@@ -8,7 +8,7 @@ on:\n \n env:\n TERRAFORM_DOCS_VERSION: v0.16.0\n- TFLINT_VERSION: v0.44.1\n+ TFLINT_VERSION: v0.50.3\n \n jobs:\n collectInputs:\n@@ -18,11 +18,11 @@ jobs:\n directories: ${{ steps.dirs.outputs.directories }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/directories@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/directories@v1.9.0\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -32,19 +32,27 @@ jobs:\n matrix:\n directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}\n steps:\n+ # https://github.com/orgs/community/discussions/25678#discussioncomment-5242449\n+ - name: Delete huge unnecessary tools folder\n+ run: |\n+ rm -rf /opt/hostedtoolcache/CodeQL\n+ rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk\n+ rm -rf /opt/hostedtoolcache/Ruby\n+ rm -rf /opt/hostedtoolcache/go\n+\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.4\n+ uses: clowdhaus/terraform-min-max@v1.3.0\n with:\n directory: ${{ matrix.directory }}\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory != '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n tflint-version: ${{ env.TFLINT_VERSION }}\n@@ -53,7 +61,7 @@ jobs:\n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n tflint-version: ${{ env.TFLINT_VERSION }}\n@@ -64,18 +72,26 @@ jobs:\n runs-on: ubuntu-latest\n needs: collectInputs\n steps:\n+ # https://github.com/orgs/community/discussions/25678#discussioncomment-5242449\n+ - name: Delete huge unnecessary tools folder\n+ run: |\n+ rm -rf /opt/hostedtoolcache/CodeQL\n+ rm -rf /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk\n+ rm -rf /opt/hostedtoolcache/Ruby\n+ rm -rf /opt/hostedtoolcache/go\n+\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n with:\n ref: ${{ github.event.pull_request.head.ref }}\n repository: ${{github.event.pull_request.head.repo.full_name}}\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.4\n+ uses: clowdhaus/terraform-min-max@v1.3.0\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.9.0\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n tflint-version: ${{ env.TFLINT_VERSION }}\n---\n.github/workflows/release.yml\n@@ -20,18 +20,18 @@ jobs:\n if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n- uses: actions/checkout@v3\n+ uses: actions/checkout@v4\n with:\n persist-credentials: false\n fetch-depth: 0\n \n - name: Release\n- uses: cycjimmy/semantic-release-action@v3\n+ uses: cycjimmy/semantic-release-action@v4\n with:\n- semantic_version: 18.0.0\n+ semantic_version: 23.0.2\n extra_plugins: |\n- @semantic-release/changelog@6.0.0\n- @semantic-release/git@10.0.0\n- conventional-changelog-conventionalcommits@4.6.3\n+ @semantic-release/changelog@6.0.3\n+ @semantic-release/git@10.0.1\n+ conventional-changelog-conventionalcommits@7.0.2\n env:\n GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}\n---\n.github/workflows/stale-actions.yaml\n@@ -7,7 +7,7 @@ jobs:\n stale:\n runs-on: ubuntu-latest\n steps:\n- - uses: actions/stale@v6\n+ - uses: actions/stale@v9\n with:\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n # Staling issues and PR's\n---\n.pre-commit-config.yaml\n@@ -1,9 +1,8 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.86.0\n+ rev: v1.88.0\n hooks:\n - id: terraform_fmt\n- - id: terraform_validate\n - id: terraform_docs\n args:\n - '--args=--lockfile=false'\n@@ -22,8 +21,11 @@ repos:\n - '--args=--only=terraform_required_providers'\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n+ - '--args=--only=terraform_unused_required_providers'\n+ - id: terraform_validate\n - repo: https://github.com/pre-commit/pre-commit-hooks\n rev: v4.5.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n+ - id: trailing-whitespace\n---\nexamples/separate-route-tables/README.md\n@@ -1,6 +1,6 @@\n # VPC with separate private route tables\n \n-Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple-vpc](../simple-vpc) for more simplified setup). \n+Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple-vpc](../simple-vpc) for more simplified setup).\n \n There are public, private, database, ElastiCache, Redshift subnets, NAT Gateways created in each availability zone. **This example sets up separate private route for database, elasticache and redshift subnets.**.\n \n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nSupport for multiple route tables when creating public and intra subnets.\r\n\r\n## Motivation and Context\r\n\r\n\r\nGuarantee that the used route table for public and intra subnets on creation is different when a boolean variable is set to true.\r\n- Resolves #1020\r\n\r\n## Breaking Changes\r\n\r\n\r\nNo breaking changes, as the variables are optional and defaulted to `false`.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\nChanges were tested in a staging environment where existing public and intra subnets and route tables existed. Multiple route tables were enabled for both public and intra subnets. The existing route tables and associations were successfully updated and network traffic continued to flow as normal.\r\n\n\n---\n\nChoice A:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.88.0\n+ rev: v1.89.0\n hooks:\n - id: terraform_fmt\n - id: terraform_docs\n@@ -24,7 +24,7 @@ repos:\n - '--args=--only=terraform_unused_required_providers'\n - id: terraform_validate\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.5.0\n+ rev: v4.6.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\nREADME.md\n@@ -369,6 +369,8 @@ No modules.\n | [create\\_flow\\_log\\_cloudwatch\\_iam\\_role](#input\\_create\\_flow\\_log\\_cloudwatch\\_iam\\_role) | Whether to create IAM role for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_flow\\_log\\_cloudwatch\\_log\\_group](#input\\_create\\_flow\\_log\\_cloudwatch\\_log\\_group) | Whether to create CloudWatch log group for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n+| [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n+| [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a ? route table for each public subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -123,13 +123,22 @@ resource \"aws_subnet\" \"public\" {\n )\n }\n \n+locals {\n+ num_public_route_tables = var.create_multiple_public_route_tables ? local.len_public_subnets : 1\n+}\n+\n resource \"aws_route_table\" \"public\" {\n- count = local.create_public_subnets ? 1 : 0\n+ count = local.create_public_subnets ? local.num_public_route_tables : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.public_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.create_multiple_public_route_tables ? format(\n+ \"${var.name}-${var.public_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ ) : \"${var.name}-${var.public_subnet_suffix}\"\n+ },\n var.tags,\n var.public_route_table_tags,\n )\n@@ -139,7 +148,7 @@ resource \"aws_route_table_association\" \"public\" {\n count = local.create_public_subnets ? local.len_public_subnets : 0\n \n subnet_id = element(aws_subnet.public[*].id, count.index)\n- route_table_id = aws_route_table.public[0].id\n+ route_table_id = element(aws_route_table.public[*].id, var.create_multiple_public_route_tables ? count.index : 0)\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n@@ -816,13 +825,22 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+locals {\n+ num_intra_route_tables = var.create_multiple_intra_route_tables ? local.len_intra_subnets : 1\n+}\n+\n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.num_intra_route_tables : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.create_multiple_intra_route_tables ? format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ ) : \"${var.name}-${var.intra_subnet_suffix}\"\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,7 +850,7 @@ resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ route_table_id = element(aws_route_table.intra[*].id, var.create_multiple_intra_route_tables ? count.index : 0)\n }\n \n ################################################################################\n---\nvariables.tf\n@@ -196,6 +196,12 @@ variable \"public_subnet_enable_resource_name_dns_a_record_on_launch\" {\n default = false\n }\n \n+variable \"create_multiple_public_route_tables\" {\n+ description = \"Indicates whether to create a separate route table for each public subnet. Default: `false`\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"public_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 public subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n@@ -914,6 +920,12 @@ variable \"intra_subnet_enable_resource_name_dns_a_record_on_launch\" {\n default = false\n }\n \n+variable \"create_multiple_intra_route_tables\" {\n+ description = \"Indicates whether to create a separate route table for each intra subnet. Default: `false`\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"intra_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 intra subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice B:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.88.0\n+ rev: v1.89.0\n hooks:\n - id: terraform_fmt\n - id: terraform_docs\n@@ -24,7 +24,7 @@ repos:\n - '--args=--only=terraform_unused_required_providers'\n - id: terraform_validate\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.5.0\n+ rev: v4.6.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\nREADME.md\n@@ -369,6 +369,8 @@ No modules.\n | [create\\_flow\\_log\\_cloudwatch\\_iam\\_role](#input\\_create\\_flow\\_log\\_cloudwatch\\_iam\\_role) | Whether to create IAM role for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_flow\\_log\\_cloudwatch\\_log\\_group](#input\\_create\\_flow\\_log\\_cloudwatch\\_log\\_group) | Whether to create CloudWatch log group for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n+| [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n+| [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -123,13 +123,22 @@ resource \"aws_subnet\" \"public\" {\n )\n }\n \n+locals {\n+ num_public_route_tables = var.create_multiple_public_route_tables ? local.len_public_subnets : 1\n+}\n+\n resource \"aws_route_table\" \"public\" {\n- count = local.create_public_subnets ? 1 : 0\n+ count = local.create_public_subnets ? local.num_public_route_tables : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.public_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.create_multiple_public_route_tables ? format(\n+ \"${var.name}-${var.public_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ ) : \"${var.name}-${var.public_subnet_suffix}\"\n+ },\n var.tags,\n var.public_route_table_tags,\n )\n@@ -139,7 +148,7 @@ resource \"aws_route_table_association\" \"public\" {\n count = local.create_public_subnets ? local.len_public_subnets : 0\n \n subnet_id = element(aws_subnet.public[*].id, count.index)\n- route_table_id = aws_route_table.public[0].id\n+ route_table_id = element(aws_route_table.public[*].id, var.create_multiple_public_route_tables ? count.index : 0)\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n@@ -816,13 +825,22 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+locals {\n+ num_intra_route_tables = var.create_multiple_intra_route_tables ? local.len_intra_subnets : 1\n+}\n+\n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.num_intra_route_tables : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.create_multiple_intra_route_tables ? format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ ) : \"${var.name}-${var.intra_subnet_suffix}\"\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,7 +850,7 @@ resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ route_table_id = element(aws_route_table.intra[*].id, var.create_multiple_intra_route_tables ? count.index : 0)\n }\n \n ################################################################################\n---\nvariables.tf\n@@ -196,6 +196,12 @@ variable \"public_subnet_enable_resource_name_dns_a_record_on_launch\" {\n default = false\n }\n \n+variable \"create_multiple_public_route_tables\" {\n+ description = \"Indicates whether to create a separate route table for each public subnet. Default: `false`\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"public_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 public subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n@@ -914,6 |\n @@ variable \"intra_subnet_enable_resource_name_dns_a_record_on_launch\" {\n default = false\n }\n \n+variable \"create_multiple_intra_route_tables\" {\n+ description = \"Indicates whether to create a separate route table for each intra subnet. Default: `false`\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"intra_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 intra subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice C:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.88.0\n+ rev: v1.89.0\n hooks:\n - id: terraform_fmt\n - id: terraform_docs\n@@ -24,7 +24,7 @@ repos:\n - '--args=--only=terraform_unused_required_providers'\n - id: terraform_validate\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.5.0\n+ rev: v4.6.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\nREADME.md\n@@ -369,6 +369,8 @@ No modules.\n | [create\\_flow\\_log\\_cloudwatch\\_iam\\_role](#input\\_create\\_flow\\_log\\_cloudwatch\\_iam\\_role) | Whether to create IAM role for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_flow\\_log\\_cloudwatch\\_log\\_group](#input\\_create\\_flow\\_log\\_cloudwatch\\_log\\_group) | Whether to create CloudWatch log group for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n+| [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n+| [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -123,13 +123,22 @@ resource \"aws_subnet\" \"public\" {\n )\n }\n \n+locals {\n+ num_public_route_tables = var.create_multiple_public_route_tables ? local.len_public_subnets : 1\n+}\n+\n resource \"aws_route_table\" \"public\" {\n- count = local.create_public_subnets ? 1 : 0\n+ count = local.create_public_subnets ? local.num_public_route_tables : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.public_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.create_multiple_public_route_tables ? format(\n+ \"${var.name}-${var.public_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ ) : \"${var.name}-${var.public_subnet_suffix}\"\n+ },\n var.tags,\n var.public_route_table_tags,\n )\n@@ -139,7 +148,7 @@ resource \"aws_route_table_association\" \"public\" {\n count = local.create_public_subnets ? local.len_public_subnets : 0\n \n subnet_id = element(aws_subnet.public[*].id, count.index)\n- route_table_id = aws_route_table.public[0].id\n+ route_table_id = element(aws_route_table.public[*].id, var.create_multiple_public_route_tables ? count.index : 0)\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n@@ -816,13 +825,22 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+locals {\n+ num_intra_route_tables = var.create_multiple_intra_route_tables ? local.len_intra_subnets : 1\n+}\n+\n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.num_intra_route_tables : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.create_multiple_intra_route_tables ? format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ ) : \"${var.name}-${var.intra_subnet_suffix}\"\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,7 +850,7 @@ resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ route_table_id = element(aws_route_table.intra[*].id, var.create_multiple_intra_route_tables ? count.index : 0)\n }\n \n ################################################################################\n---\nvariables.tf\n@@ -196,6 +196,12 @@ variable \"public_subnet_enable_resource_name_dns_a_record_on_launch\" {\n default = false\n }\n \n+variable \"create_multiple_public_route_tables\" {\n+ description = \"Indicates whether to create a separate route table for each public subnet. Default: `false`\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"public_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 public subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n@@ -914,6 +920,12 @@ variable \"intra_subnet_enable_resource_name_dns_a_record_on_launch\" {\n default = false\n }\n \n+variable \"create_multiple_intra_route_tables\" {\n+ description = \"Indicates whether to create a separate route table for each intra subnet. Default: `false`\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"intra_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 intra subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice D:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.88.0\n+ rev: v1.89.0\n hooks:\n - id: terraform_fmt\n - id: terraform_docs\n@@ -24,7 +24,7 @@ repos:\n - '--args=--only=terraform_unused_required_providers'\n - id: terraform_validate\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.5.0\n+ rev: v4.6.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\nREADME.md\n@@ -369,6 +369,8 @@ No modules.\n | [create\\_flow\\_log\\_cloudwatch\\_iam\\_role](#input\\_create\\_flow\\_log\\_cloudwatch\\_iam\\_role) | Whether to create IAM role for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_flow\\_log\\_cloudwatch\\_log\\_group](#input\\_create\\_flow\\_log\\_cloudwatch\\_log\\_group) | Whether to create CloudWatch log group for VPC Flow Logs | `bool` | `false` = no |\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n+| [create\\_multiple\\_intra\\_route\\_tables](#input\\_create\\_multiple\\_intra\\_route\\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no |\n+| [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -123,13 +123,22 @@ resource \"aws_subnet\" \"public\" {\n )\n }\n \n+locals {\n+ num_public_route_tables = var.create_multiple_public_route_tables ? local.len_public_subnets : 1\n+}\n+\n resource \"aws_route_table\" \"public\" {\n- count = local.create_public_subnets ? 1 : 0\n+ count = local.create_public_subnets ? local.num_public_route_tables : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.public_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.create_multiple_public_route_tables ? format(\n+ \"${var.name}-${var.public_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ ) : \"${var.name}-${var.public_subnet_suffix}\"\n+ },\n var.tags,\n var.public_route_table_tags,\n )\n@@ -139,7 +148,7 @@ resource \"aws_route_table_association\" \"public\" {\n count = local.create_public_subnets ? local.len_public_subnets : 0\n \n subnet_id = element(aws_subnet.public[*].id, count.index)\n- route_table_id = aws_route_table.public[0].id\n+ route_table_id = element(aws_route_table.public[*].id, var.create_multiple_public_route_tables ? count.index : 0)\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n@@ -816,13 +825,22 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+locals {\n+ num_intra_route_tables = var.create_multiple_intra_route_tables ? local.len_intra_subnets : 1\n+}\n+\n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.num_intra_route_tables : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.create_multiple_intra_route_tables ? format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ ) : \"${var.name}-${var.intra_subnet_suffix}\"\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,7 +850,7 @@ resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ route_table_id = element(aws_route_table.intra[*].id, var.create_multiple_intra_route_tables ? count.index : 0)\n }\n \n ################################################################################\n---\nvariables.tf\n@@ -196,6 +196,12 @@ variable \"public_subnet_enable_resource_name_dns_a_record_on_launch\" {\n default = false\n }\n \n+variable \"create_multiple_public_route_tables\" {\n+ description = \"Indicates whether to create a separate route table for each public subnet. Default: `false`\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"public_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 public subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n@@ -914,6 +920,12 @@ variable \"intra_subnet_enable_resource_name_dns_a_record_on_launch\" {\n default = false\n }\n \n+variable \"create_multiple_intra_route_tables\" {\n+ description = \"Indicates whether to create a separate route table for each intra subnet. Default: `false`\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"intra_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 intra subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nfeat: Adding output using private natgateway\r\n\r\n## Motivation and Context\r\nfixes minor issue\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -646,6 +646,7 @@ No modules.\n | [outpost\\_subnets\\_cidr\\_blocks](#output\\_outpost\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of outpost subnets |\n | [outpost\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_outpost\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of outpost subnets in an IPv6 enabled VPC |\n | [private\\_ipv6\\_egress\\_route\\_ids](#output\\_private\\_ipv6\\_egress\\_route\\_ids) | List of IDs of the ipv6 egress route |\n+| [private\\_nat\\_gateway\\_ips](#output\\_private\\_nat\\_gateway\\_ips) | List of private nat gateway ip's |\n | [private\\_nat\\_gateway\\_route\\_ids](#output\\_private\\_nat\\_gateway\\_route\\_ids) | List of IDs of the private nat gateway route |\n | [private\\_network\\_acl\\_arn](#output\\_private\\_network\\_acl\\_arn) | ARN of the private network ACL |\n | [private\\_network\\_acl\\_id](#output\\_private\\_network\\_acl\\_id) | ID of the private network ACL |\n---\noutputs.tf\n@@ -129,7 +129,10 @@ output \"public_route_table_ids\" {\n description = \"List of IDs of public route tables\"\n value = local.public_route_table_ids\n }\n-\n+output \"private_nat_gateway_ips\" {\n+ description = \"List of private nat gateway ip's\"\n+ value = aws_nat_gateway.this[*].private_nat_gateway_private_ips\n+}\n output \"public_internet_gateway_route_id\" {\n description = \"ID of the internet gateway route\"\n value = try(aws_route.public_internet_gateway[0].id, null)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -646,6 +646,7 @@ No modules.\n | [outpost\\_subnets\\_cidr\\_blocks](#output\\_outpost\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of outpost subnets |\n | [outpost\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_outpost\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of outpost subnets in an IPv6 enabled VPC |\n | [private\\_ipv6\\_egress\\_route\\_ids](#output\\_private\\_ipv6\\_egress\\_route\\_ids) | List of IDs of the ipv6 egress route |\n+| [private\\_nat\\_gateway\\_ips](#output\\_private\\_nat\\_gateway\\_ips) | List of private nat gateway ip's |\n | [private\\_nat\\_gateway\\_route\\_ids](#output\\_private\\_nat\\_gateway\\_route\\_ids) | List of IDs of the private nat gateway route |\n | [private\\_network\\_acl\\_arn](#output\\_private\\_network\\_acl\\_arn) | ARN of the private network ACL |\n | tables\"\n | ID of the private network ACL |\n---\noutputs.tf\n@@ -129,7 +129,10 @@ output \"public_route_table_ids\" {\n description = \"List of IDs of public route tables\"\n value = local.public_route_table_ids\n }\n-\n+output \"private_nat_gateway_ips\" {\n+ description = \"List of private nat gateway ip's\"\n+ value = aws_nat_gateway.this[*].private_nat_gateway_private_ips\n+}\n output \"public_internet_gateway_route_id\" {\n description = \"ID of the internet gateway route\"\n value = try(aws_route.public_internet_gateway[0].id, null)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -646,6 +646,7 @@ No modules.\n | [outpost\\_subnets\\_cidr\\_blocks](#output\\_outpost\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of outpost subnets |\n | [outpost\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_outpost\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 of outpost subnets in an IPv6 enabled VPC |\n | [private\\_ipv6\\_egress\\_route\\_ids](#output\\_private\\_ipv6\\_egress\\_route\\_ids) | List of IDs of the ipv6 egress route |\n+| [private\\_nat\\_gateway\\_ips](#output\\_private\\_nat\\_gateway\\_ips) | List of private nat gateway ip's |\n | [private\\_nat\\_gateway\\_route\\_ids](#output\\_private\\_nat\\_gateway\\_route\\_ids) | List of IDs of the private nat gateway route |\n | [private\\_network\\_acl\\_arn](#output\\_private\\_network\\_acl\\_arn) | ARN of the private network ACL |\n | [private\\_network\\_acl\\_id](#output\\_private\\_network\\_acl\\_id) | ID of the private network ACL |\n---\noutputs.tf\n@@ -129,7 +129,10 @@ output \"public_route_table_ids\" {\n description = \"List of IDs of public route tables\"\n value = local.public_route_table_ids\n }\n-\n+output \"private_nat_gateway_ips\" {\n+ description = \"List of private nat gateway ip's\"\n+ value = aws_nat_gateway.this[*].private_nat_gateway_private_ips\n+}\n output \"public_internet_gateway_route_id\" {\n description = \"ID of the internet gateway route\"\n value = try(aws_route.public_internet_gateway[0].id, null)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -646,6 +646,7 @@ No modules.\n | [outpost\\_subnets\\_cidr\\_blocks](#output\\_outpost\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of outpost subnets |\n | [outpost\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_outpost\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of outpost subnets in an IPv6 enabled VPC |\n | [private\\_ipv6\\_egress\\_route\\_ids](#output\\_private\\_ipv6\\_egress\\_route\\_ids) | List of IDs of the ipv6 egress route |\n+| [private\\_nat\\_gateway\\_ips](#output\\_private\\_nat\\_gateway\\_ips) | List of private nat gateway ip's |\n | [private\\_nat\\_gateway\\_route\\_ids](#output\\_private\\_nat\\_gateway\\_route\\_ids) | List of IDs of the private nat gateway route |\n | [private\\_network\\_acl\\_arn](#output\\_private\\_network\\_acl\\_arn) | ARN of the private network ACL |\n | [private\\_network\\_acl\\_id](#output\\_private\\_network\\_acl\\_id) | ID of the private network ACL |\n---\noutputs.tf\n@@ -129,7 +129,10 @@ output {\n+ {\n description = \"List of IDs of public route tables\"\n value = local.public_route_table_ids\n }\n-\n+output \"private_nat_gateway_ips\" {\n+ description = \"List of private nat gateway ip's\"\n+ value = aws_nat_gateway.this[*].private_nat_gateway_private_ips\n+}\n output \"public_internet_gateway_route_id\" {\n description = \"ID of the internet gateway route\"\n value = try(aws_route.public_internet_gateway[0].id, null)\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n\r\n\r\n## Description\r\nThis commit adds `service_type` to example code at README since current sample code causes the following error:\r\n\r\n> Error: no matching EC2 VPC Endpoint Service found ... data.aws_vpc_endpoint_service.this[\"dynamodb\"]\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/README.md\n@@ -17,21 +17,25 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n+ service_type = \"Interface\"\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n # gateway endpoint\n service = \"dynamodb\"\n+ service_type = Name route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service = \"sns\"\n+ service_type = \"Interface\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n service = \"sqs\"\n+ service_type = \"Interface\"\n private_dns_enabled = true\n security_group_ids = [\"sg-987654321\"]\n subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/README.md\n@@ -17,21 +17,25 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n+ service_type = \"Interface\"\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n # gateway endpoint\n service = \"dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service = = \"sns\"\n+ service_type = \"Interface\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n service = \"sqs\"\n+ service_type = \"Interface\"\n private_dns_enabled = true\n security_group_ids = [\"sg-987654321\"]\n subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/README.md\n@@ -17,21 +17,25 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n+ service_type = \"Interface\"\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n # gateway endpoint\n service = \"dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service = \"sns\"\n+ service_type = \"Interface\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n service = \"sqs\"\n+ service_type = \"Interface\"\n private_dns_enabled = true\n security_group_ids = [\"sg-987654321\"]\n subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/README.md\n@@ -17,21 +17,25 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n+ service_type = \"Interface\"\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n # gateway endpoint\n service = \"dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service = \"sns\"\n+ service_type = \"Interface\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n service = \"sqs\"\n+ service_type = \"Interface\"\n private_dns_enabled = true\n security_group_ids = [\"sg-987654321\"]\n subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n\r\n\r\n## Description\r\nIn case of customer_gateway is used with TGW this changes will allow us to replace ip_address in the single `terraform apply`\r\n\r\n\r\n## Motivation and Context\r\n```\r\n\u2502 Error: deleting EC2 Customer Gateway (cgw-xxxxxxxxx): IncorrectState: The customer gateway is in use.\r\n\u2502 status code: 400, request id: xxxxxx-994b-xxxx-xxx-xxxxxx\r\n```\r\n\r\n## Breaking Changes\r\nNo\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\nWas tested on production system\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -1123,6 +1123,10 @@ resource \"aws_customer_gateway\" \"this\" {\n var.tags,\n var.customer_gateway_tags,\n )\n+\n+ lifecycle {\n+ \"this\" create_before_destroy = true\n+ }\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1123,6 +1123,10 @@ resource \"aws_customer_gateway\" \"this\" {\n var.tags,\n var.customer_gateway_tags,\n )\n+\n+ lifecycle {\n+ create_before_destroy = true\n+ \n }\n \n ################################################################################\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1123,6 +1123,10 @@ resource \"aws_customer_gateway\" \"this\" {\n var.tags,\n var.customer_gateway_tags,\n )\n+\n+ lifecycle {\n+ create_before_destroy = true\n+ }\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1123,6 +1123,10 @@ resource \"aws_customer_gateway\" \"this\" {\n var.tags,\n var.customer_gateway_tags,\n )\n+\n+ lifecycle {\n+ create_before_destroy = true\n+ }\n }\n \n ################################################################################\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nWhile trying to setup an S3 VPC endpoint I found I could not set `dns_options.private_dns_only_for_inbound_resolver_endpoint` even though this was apparently resolved by https://github.com/terraform-aws-modules/terraform-aws-vpc/pull/1029\r\n\r\nTo see what was going on under the hood, I removed the `try` wrapping `private_dns_only_for_inbound_resolver_endpoint` and got this error:\r\n\r\n```\r\nPlanning failed. Terraform encountered an error while generating this plan.\r\n\r\n\u2577\r\n\u2502 Error: Unsupported attribute\r\n\u2502\r\n\u2502 on .terraform/modules/endpoints/modules/vpc-endpoints/main.tf line 42, in resource \"aws_vpc_endpoint\" \"this\":\r\n\u2502 42: private_dns_only_for_inbound_resolver_endpoint = dns_options.value.private_dns_only_for_inbound_resolver_endpoint\r\n\u2502 \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\u2502 \u2502 dns_options.value is false\r\n\u2502\r\n\u2502 Can't access attributes on a primitive-typed value (bool).\r\n```\r\n\r\nSo this whole thing is already off. Idk why `dns_options.value` is a bool, all I know is it has something to do with the `dynamic` block being used here.\r\n\r\nI noticed the `dynamic` block is not needed. You're only allowed one `dns_options` block for the `aws_vpc_endpoint` resource: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint#dns_options\r\n\r\nSo I removed the `dynamic` block and updated the value lookups to `each.value.dns_options[]` which now works.\r\n\r\nFor an S3 service, with\r\n`dns_options.private_dns_only_for_inbound_resolver_endpoint` set to `false`, this is the plan it generated:\r\n\r\n```\r\n+ resource \"aws_vpc_endpoint\" \"this\" {\r\n + arn = (known after apply)\r\n + cidr_blocks = (known after apply)\r\n + dns_entry = (known after apply)\r\n + id = (known after apply)\r\n + ip_address_type = (known after apply)\r\n + network_interface_ids = (known after apply)\r\n + owner_id = (known after apply)\r\n + policy = jsonencode(\r\n {\r\n + Statement = [\r\n + {\r\n + Action = \"*\"\r\n + Condition = {\r\n + StringNotEquals = {\r\n + \"aws:SourceVpc\" = \"vpc-0518b6428b706516d\"\r\n }\r\n }\r\n + Effect = \"Deny\"\r\n + Principal = \"*\"\r\n + Resource = \"*\"\r\n },\r\n ]\r\n + Version = \"2012-10-17\"\r\n }\r\n )\r\n + prefix_list_id = (known after apply)\r\n + private_dns_enabled = true\r\n + requester_managed = (known after apply)\r\n + route_table_ids = (known after apply)\r\n + security_group_ids = [\r\n + \"sg-050ed3bb7b46fd681\",\r\n ]\r\n + service_name = \"com.amazonaws.us-east-1.s3\"\r\n + state = (known after apply)\r\n + subnet_ids = [\r\n + \"subnet-0af61b529ffb7940b\",\r\n + \"subnet-0dd27b92ffe0d02cd\",\r\n ]\r\n + tags = {\r\n + \"Name\" = \"s3\"\r\n }\r\n + tags_all = {\r\n + \"Name\" = \"s3\"\r\n }\r\n + vpc_endpoint_type = \"Interface\"\r\n + vpc_id = \"vpc-0518b6428b706516d\"\r\n\r\n + dns_options {\r\n + dns_record_ip_type = (known after apply)\r\n + private_dns_only_for_inbound_resolver_endpoint = false\r\n }\r\n\r\n + timeouts {\r\n + create = \"10m\"\r\n + delete = \"10m\"\r\n + update = \"10m\"\r\n }\r\n }\r\n```\r\n\r\nFor a resource that did not pass in a `dns_options`, like this:\r\n\r\n```hcl\r\n...\r\necr_api = {\r\n service = \"ecr.api\"\r\n private_dns_enabled = true\r\n subnet_ids = module.vpc.private_subnets\r\n policy = data.aws_iam_policy_document.generic_endpoint_policy.json\r\n },\r\n...\r\n```\r\n\r\nI got this plan:\r\n```\r\n+ resource \"aws_vpc_endpoint\" \"this\" {\r\n + arn = (known after apply)\r\n + cidr_blocks = (known after apply)\r\n + dns_entry = (known after apply)\r\n + id = (known after apply)\r\n + ip_address_type = (known after apply)\r\n + network_interface_ids = (known after apply)\r\n + owner_id = (known after apply)\r\n + policy = jsonencode(\r\n {\r\n + Statement = [\r\n + {\r\n + Action = \"*\"\r\n + Condition = {\r\n + StringNotEquals = {\r\n + \"aws:SourceVpc\" = \"vpc-0518b6428b706516d\"\r\n }\r\n }\r\n + Effect = \"Deny\"\r\n + Principal = \"*\"\r\n + Resource = \"*\"\r\n },\r\n ]\r\n + Version = \"2012-10-17\"\r\n }\r\n )\r\n + prefix_list_id = (known after apply)\r\n + private_dns_enabled = true\r\n + requester_managed = (known after apply)\r\n + route_table_ids = (known after apply)\r\n + security_group_ids = [\r\n + \"sg-050ed3bb7b46fd681\",\r\n ]\r\n + service_name = \"com.amazonaws.us-east-1.ecr.api\"\r\n + state = (known after apply)\r\n + subnet_ids = [\r\n + \"subnet-0af61b529ffb7940b\",\r\n + \"subnet-0dd27b92ffe0d02cd\",\r\n ]\r\n + tags = {\r\n + \"Name\" = \"ecr.api\"\r\n }\r\n + tags_all = {\r\n + \"Name\" = \"ecr.api\"\r\n }\r\n + vpc_endpoint_type = \"Interface\"\r\n + vpc_id = \"vpc-0518b6428b706516d\"\r\n\r\n + dns_options {\r\n + dns_record_ip_type = (known after apply)\r\n }\r\n\r\n + timeouts {\r\n + create = \"10m\"\r\n + delete = \"10m\"\r\n + update = \"10m\"\r\n }\r\n }\r\n```\r\n\r\nI think the removal of the `dynamic` block simplifies things now. It's easier to see what's going on. There should be no change for anyone that isn't setting `dns_options` as shown by my plan output above.\r\n\r\n\r\n## Breaking Changes\r\nNone. For VPCE's that I had beforehand, nothing changed for them. Existing setup was respected.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/main.tf\n@@ -34,13 +34,9 @@ resource \"aws_vpc_endpoint\" \"this\" {\n policy = try(each.value.policy, null)\n private_dns_enabled = try(each.value.service_type, \"Interface\") == \"Interface\" ? try(each.value.private_dns_enabled, null) : null\n \n- dynamic \"dns_options\" {\n- for_each = try([each.value.dns_options], [])\n-\n- content {\n- dns_record_ip_type = try(dns_options.value.dns_options.dns_record_ip_type, null)\n- private_dns_only_for_inbound_resolver_endpoint = try(dns_options.value.private_dns_only_for_inbound_resolver_endpoint, null)\n- }\n+ dns_options {\n+ dns_record_ip_type = try(each.value.dns_options[\"dns_record_ip_type\"], null)\n+ private_dns_only_for_inbound_resolver_endpoint = try(each.value.dns_options[\"private_dns_only_for_inbound_resolver_endpoint\"], null)\n }\n \n tags = merge(var.tags, try(each.value.tags, {}))\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/main.tf\n@@ -34,13 +34,9 @@ resource \"aws_vpc_endpoint\" \"this\" {\n policy = try(each.value.policy, null)\n private_dns_enabled = try(each.value.service_type, \"Interface\") == \"Interface\" ? try(each.value.private_dns_enabled, null) : null\n \n- dynamic \"dns_options\" {\n- for_each = try([each.value.dns_options], [])\n-\n- content {\n- null) dns_record_ip_type = try(dns_options.value.dns_options.dns_record_ip_type, null)\n- private_dns_only_for_inbound_resolver_endpoint = try(dns_options.value.private_dns_only_for_inbound_resolver_endpoint, null)\n- }\n+ dns_options {\n+ dns_record_ip_type = try(each.value.dns_options[\"dns_record_ip_type\"], null)\n+ private_dns_only_for_inbound_resolver_endpoint = try(each.value.dns_options[\"private_dns_only_for_inbound_resolver_endpoint\"], null)\n }\n \n tags = merge(var.tags, try(each.value.tags, {}))\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/main.tf\n@@ -34,13 +34,9 @@ resource \"aws_vpc_endpoint\" \"this\" {\n policy = try(each.value.policy, null)\n private_dns_enabled = try(each.value.service_type, \"Interface\") == \"Interface\" ? try(each.value.private_dns_enabled, null) : null\n \n- dynamic \"dns_options\" {\n- for_each = try([each.value.dns_options], [])\n-\n- content {\n- dns_record_ip_type = try(dns_options.value.dns_options.dns_record_ip_type, null)\n- private_dns_only_for_inbound_resolver_endpoint = try(dns_options.value.private_dns_only_for_inbound_resolver_endpoint, null)\n- }\n+ dns_options {\n+ dns_record_ip_type = try(each.value.dns_options[\"dns_record_ip_type\"], null)\n+ private_dns_only_for_inbound_resolver_endpoint = try(each.value.dns_options[\"private_dns_only_for_inbound_resolver_endpoint\"], null)\n content \n tags = merge(var.tags, try(each.value.tags, {}))\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/main.tf\n@@ -34,13 +34,9 @@ resource \"aws_vpc_endpoint\" \"this\" {\n policy = try(each.value.policy, null)\n private_dns_enabled = try(each.value.service_type, \"Interface\") == \"Interface\" ? try(each.value.private_dns_enabled, null) : null\n \n- dynamic \"dns_options\" {\n- for_each = try([each.value.dns_options], [])\n-\n- content {\n- dns_record_ip_type = try(dns_options.value.dns_options.dns_record_ip_type, null)\n- private_dns_only_for_inbound_resolver_endpoint = try(dns_options.value.private_dns_only_for_inbound_resolver_endpoint, null)\n- }\n+ dns_options {\n+ dns_record_ip_type = try(each.value.dns_options[\"dns_record_ip_type\"], null)\n+ private_dns_only_for_inbound_resolver_endpoint = try(each.value.dns_options[\"private_dns_only_for_inbound_resolver_endpoint\"], null)\n }\n \n tags = merge(var.tags, try(each.value.tags, {}))\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n- Correct VPC endpoint private DNS resolver `for_each` key\r\n\r\n## Motivation and Context\r\n- Resolves #1028\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/main.tf\n@@ -38,8 +38,8 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = try([each.value.dns_options], [])\n \n content {\n- dns_record_ip_type = try(each.value.dns_options.dns_record_ip_type, null)\n- private_dns_only_for_inbound_resolver_endpoint = try(each.value.private_dns_only_for_inbound_resolver_endpoint, null)\n+ dns_record_ip_type = try(dns_options.value.dns_options.dns_record_ip_type, null)\n+ private_dns_only_for_inbound_resolver_endpoint = try(dns_options.value.private_dns_only_for_inbound_resolver_endpoint, null)\n }\n }\n \n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/main.tf\n@@ -38,8 +38,8 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = try([each.value.dns_options], [])\n \n content {\n- dns_record_ip_type = try(each.value.dns_options.dns_record_ip_type, null)\n- private_dns_only_for_inbound_resolver_endpoint = try(each.value.private_dns_only_for_inbound_resolver_endpoint, null)\n+ dns_record_ip_type = try(dns_options.value.dns_options.dns_record_ip_type, null)\n+ private_dns_only_for_inbound_resolver_endpoint = try(dns_options.value.private_dns_only_for_inbound_resolver_endpoint, null)\n }\n }\n \n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/main.tf\n@@ -38,8 +38,8 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = try([each.value.dns_options], [])\n \n content {\n- dns_record_ip_type = try(each.value.dns_options.dns_record_ip_type, null)\n- private_dns_only_for_inbound_resolver_endpoint = try(each.value.private_dns_only_for_inbound_resolver_endpoint, null)\n+ dns_record_ip_type = try(dns_options.value.dns_options.dns_record_ip_type, null)\n+ private_dns_only_for_inbound_resolver_endpoint = try(dns_options.value.private_dns_only_for_inbound_resolver_endpoint, null)\n }\n }\n \n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/main.tf\n@@ -38,8 +38,8 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = try([each.value.dns_options], [])\n \n content {\n- dns_record_ip_type = try(each.value.dns_options.dns_record_ip_type, null)\n- private_dns_only_for_inbound_resolver_endpoint = try(each.value.private_dns_only_for_inbound_resolver_endpoint, null)\n+ dns_record_ip_type = try(dns_options.value.dns_options.dns_record_ip_type, null)\n+ private_dns_only_for_inbound_resolver_endpoint = try(dns_options.value.private_dns_only_for_inbound_resolver_endpoint, null)\n }\n \n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdd validation to limit secondary_cidr_blocks to max 4 entries\r\n\r\n## Motivation and Context\r\n- Introduce a validation block within the variable 'secondary_cidr_blocks'\r\n- Ensure the list of CIDR blocks does not exceed 4 entries\r\n- Provide a clear error message for configurations exceeding the limit\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [X] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nvariables.tf\n@@ -24,6 +24,10 length(var.secondary_cidr_blocks) variable \"secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool\"\n type = list(string)\n default = []\n+ validation {\n+ condition = length(var.secondary_cidr_blocks) <= 4\n+ error_message = \"The number of secondary CIDR blocks cannot exceed 4.\"\n+ }\n }\n \n variable \"instance_tenancy\" {\n---\n\n\n---\n\nChoice B:\nvariables.tf\n@@ -24,6 +24,10 @@ variable \"secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool\"\n type = list(string)\n default = []\n+ validation {\n+ condition = length(var.secondary_cidr_blocks) <= 4\n+ = \"The number of secondary CIDR blocks cannot exceed 4.\"\n+ }\n }\n \n variable \"instance_tenancy\" {\n---\n\n\n---\n\nChoice C:\nvariables.tf\n@@ -24,6 +24,10 @@ variable \"secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool\"\n type = list(string)\n default = []\n+ validation {\n+ condition = length(var.secondary_cidr_blocks) <= 4\n+ error_message = \"The number of secondary CIDR blocks cannot exceed 4.\"\n+ }\n }\n \n variable \"instance_tenancy\" {\n---\n\n\n---\n\nChoice D:\nvariables.tf\n@@ -24,6 +24,10 @@ variable \"secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool\"\n type error_message = list(string)\n default = []\n+ validation {\n+ condition = length(var.secondary_cidr_blocks) <= 4\n+ error_message = \"The number of secondary CIDR blocks cannot exceed 4.\"\n+ }\n }\n \n variable \"instance_tenancy\" {\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nSupport for multiple route tables when creating public subnets\r\n\r\n## Motivation and Context\r\nGuarantee that the used route table for public subnets on creation is different when a boolean variable is set to true.\r\nMotivation from issue https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1020 \r\n## Breaking Changes\r\nNo breaking changes, as the variable is optional and defaulted to 'false'. \r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\r\nUsed the examples/simple/* directory as a start. Changed the `private_subnets` array for `public_subnets` and verified that the behavior described by the requester is happening. Included the variable `create_multiple_public_route_tables` and set to true. Verified in multiple runs of apply and destroy that the created route table is different for each new public subnet. \r\n\r\nChanges to examples/simple/ have not been reflected on the push. I also did not want to copy-paste the contents of 'simple' for this use case, for a more clean, less complex state of the examples folder. Please let me know if you prefer the example to be included. \r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -369,6 +369,7 @@ No modules.\n | [create\\_flow\\_log\\_cloudwatch\\_iam\\_role](#input\\_create\\_flow\\_log\\_cloudwatch\\_iam\\_role) | Whether to create IAM role for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_flow\\_log\\_cloudwatch\\_log\\_group](#input\\_create\\_flow\\_log\\_cloudwatch\\_log\\_group) | Whether to create CloudWatch log group for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n+| [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Creating multiple public route tables | `bool` | `false` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -123,23 +123,25 @@ resource \"aws_subnet\" \"public\" {\n )\n }\n \n+# Create public route tables based on the value of the boolean variable\n resource \"aws_route_table\" \"public\" {\n- count = local.create_public_subnets ? 1 : 0\n+ count = local.create_public_subnets && var.create_multiple_public_route_tables ? local.len_public_subnets : (local.create_public_subnets ? 1 : 0)\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.public_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.create_multiple_public_route_tables ? format(\"${var.name}-${var.public_subnet_suffix}-%s\", element(var.azs, count.index)) : \"${var.name}-${var.public_subnet_suffix}\"\n+ },\n var.tags,\n var.public_route_table_tags,\n )\n }\n \n resource \"aws_route_table_association\" \"public\" {\n- count = local.create_public_subnets ? local.len_public_subnets : 0\n-\n+ count = local.create_public_subnets && var.create_multiple_public_route_tables ? local.len_public_subnets : (local.create_public_subnets ? 1 : 0)\n subnet_id = element(aws_subnet.public[*].id, count.index)\n- route_table_id = aws_route_table.public[0].id\n+ route_table_id = var.create_multiple_public_route_tables ? element(aws_route_table.public[*].id, count.index) : aws_route_table.public[0].id\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n---\nvariables.tf\n@@ -250,6 +250,12 @@ variable \"public_route_table_tags\" | default = {}\n }\n \n+variable \"create_multiple_public_route_tables\" {\n+ description = \"Creating multiple public route tables\"\n+ type = bool\n+ default = false\n+}\n+\n ################################################################################\n # Public Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -369,6 +369,7 @@ No modules.\n | [create\\_flow\\_log\\_cloudwatch\\_iam\\_role](#input\\_create\\_flow\\_log\\_cloudwatch\\_iam\\_role) | Whether to create IAM role for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_flow\\_log\\_cloudwatch\\_log\\_group](#input\\_create\\_flow\\_log\\_cloudwatch\\_log\\_group) | Whether to create CloudWatch log group for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n+| [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Creating multiple public route tables | `bool` | `false` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -123,23 +123,25 @@ resource \"aws_subnet\" \"public\" {\n )\n }\n \n+# Create public route tables based on the value of the boolean variable\n resource \"aws_route_table\" \"public\" {\n- count = local.create_public_subnets ? 1 : 0\n+ count = local.create_public_subnets && var.create_multiple_public_route_tables ? local.len_public_subnets : (local.create_public_subnets ? 1 : 0)\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.public_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.create_multiple_public_route_tables ? format(\"${var.name}-${var.public_subnet_suffix}-%s\", element(var.azs, count.index)) : \"${var.name}-${var.public_subnet_suffix}\"\n+ },\n var.tags,\n var.public_route_table_tags,\n )\n }\n \n resource \"aws_route_table_association\" \"public\" {\n- count = local.create_public_subnets ? local.len_public_subnets : 0\n-\n+ count = local.create_public_subnets && var.create_multiple_public_route_tables ? local.len_public_subnets : (local.create_public_subnets ? 1 : 0)\n subnet_id = element(aws_subnet.public[*].id, count.index)\n- route_table_id = aws_route_table.public[0].id\n+ route_table_id = var.create_multiple_public_route_tables ? element(aws_route_table.public[*].id, count.index) : aws_route_table.public[0].id\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n---\nvariables.tf\n@@ -250,6 +250,12 @@ variable \"public_route_table_tags\" {\n default = {}\n }\n \n+variable \"create_multiple_public_route_tables\" {\n+ description = \"Creating multiple public route tables\"\n+ type = bool\n+ default = false\n+}\n+\n ################################################################################\n # Public Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -369,6 +369,7 @@ No modules.\n | [create\\_flow\\_log\\_cloudwatch\\_iam\\_role](#input\\_create\\_flow\\_log\\_cloudwatch\\_iam\\_role) | Whether to create IAM role for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_flow\\_log\\_cloudwatch\\_log\\_group](#input\\_create\\_flow\\_log\\_cloudwatch\\_log\\_group) | Whether to create CloudWatch log group for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | `bool` | `true` | no |\n+| [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Creating multiple public route tables | `bool` | `false` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -123,23 +123,25 @@ resource \"aws_subnet\" \"public\" {\n )\n }\n \n+# Create public route tables based on the value of the boolean variable\n resource \"aws_route_table\" \"public\" {\n- count = local.create_public_subnets ? 1 : 0\n+ count = local.create_public_subnets && var.create_multiple_public_route_tables ? local.len_public_subnets : (local.create_public_subnets ? 1 : 0)\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.public_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.create_multiple_public_route_tables ? format(\"${var.name}-${var.public_subnet_suffix}-%s\", element(var.azs, count.index)) : \"${var.name}-${var.public_subnet_suffix}\"\n+ },\n var.tags,\n var.public_route_table_tags,\n )\n }\n \n resource \"aws_route_table_association\" \"public\" {\n- count = local.create_public_subnets ? local.len_public_subnets : 0\n-\n+ count = local.create_public_subnets && var.create_multiple_public_route_tables ? local.len_public_subnets : (local.create_public_subnets ? 1 : 0)\n subnet_id = element(aws_subnet.public[*].id, count.index)\n- route_table_id = aws_route_table.public[0].id\n+ route_table_id = var.create_multiple_public_route_tables ? element(aws_route_table.public[*].id, count.index) : aws_route_table.public[0].id\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n---\nvariables.tf\n@@ -250,6 +250,12 @@ variable \"public_route_table_tags\" {\n default = resources) }\n \n+variable \"create_multiple_public_route_tables\" {\n+ description = \"Creating multiple public route tables\"\n+ type = bool\n+ default = false\n+}\n+\n ################################################################################\n # Public Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -369,6 +369,7 @@ No modules.\n | [create\\_flow\\_log\\_cloudwatch\\_iam\\_role](#input\\_create\\_flow\\_log\\_cloudwatch\\_iam\\_role) | Whether to create IAM role for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_flow\\_log\\_cloudwatch\\_log\\_group](#input\\_create\\_flow\\_log\\_cloudwatch\\_log\\_group) | Whether to create CloudWatch log group for VPC Flow Logs | `bool` | `false` | no |\n | [create\\_igw](#input\\_create\\_igw) | Controls if an Internet Gateway is created for public subnets and the related routes that connect them | | | `true` | no |\n+| [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Creating multiple public route tables | `bool` | `false` | no |\n | [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | [create\\_redshift\\_subnet\\_route\\_table](#input\\_create\\_redshift\\_subnet\\_route\\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no |\n | [create\\_vpc](#input\\_create\\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no |\n---\nmain.tf\n@@ -123,23 +123,25 @@ resource \"aws_subnet\" \"public\" {\n )\n }\n \n+# Create public route tables based on the value of the boolean variable\n resource \"aws_route_table\" \"public\" {\n- count = local.create_public_subnets ? 1 : 0\n+ count = local.create_public_subnets && var.create_multiple_public_route_tables ? local.len_public_subnets : (local.create_public_subnets ? 1 : 0)\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.public_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.create_multiple_public_route_tables ? format(\"${var.name}-${var.public_subnet_suffix}-%s\", element(var.azs, count.index)) : \"${var.name}-${var.public_subnet_suffix}\"\n+ },\n var.tags,\n var.public_route_table_tags,\n )\n }\n \n resource \"aws_route_table_association\" \"public\" {\n- count = local.create_public_subnets ? local.len_public_subnets : 0\n-\n+ count = local.create_public_subnets && var.create_multiple_public_route_tables ? local.len_public_subnets : (local.create_public_subnets ? 1 : 0)\n subnet_id = element(aws_subnet.public[*].id, count.index)\n- route_table_id = aws_route_table.public[0].id\n+ route_table_id = var.create_multiple_public_route_tables ? element(aws_route_table.public[*].id, count.index) : aws_route_table.public[0].id\n }\n \n resource \"aws_route\" \"public_internet_gateway\" {\n---\nvariables.tf\n@@ -250,6 +250,12 @@ variable \"public_route_table_tags\" {\n default = {}\n }\n \n+variable \"create_multiple_public_route_tables\" {\n+ description = \"Creating multiple public route tables\"\n+ type = bool\n+ default = false\n+}\n+\n ################################################################################\n # Public Network ACLs\n ################################################################################\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n\u2026' VPC Endpoint\r\n\r\n## Description\r\nadd output to get dns_names of aws_vpc_endpoint resource\r\n## Motivation and Context\r\nTo facilitate the selection of DNS names of the VPC Endpoint\r\n\r\n## Breaking Changes\r\nNo\r\n\r\n## How Has This Been Tested?\r\nIt has been tested in on-premise infra and resource.tf file use this output and achieve my goal.\r\ne.g\r\n```\r\n module \"records_test\" {\r\n source = \"./modules/aws-route53/modules/records\"\r\n depends_on = [ module.zone_ingress_test ]\r\n\r\n zone_id = module.zone_ingress_test.route53_zone_zone_id[var.domain_ingress_test]\r\n\r\n records = [\r\n {\r\n name = \"*.apps.internal\"\r\n type = \"CNAME\"\r\n ttl = 300\r\n # records = [module.ingress_endpoints.dns_names[0][\"dns_name\"]]\r\n records = [module.ingress_endpoints.dns_names[\"ingress_endpoint\"][0][\"dns_name\"]]\r\n }\r\n ]\r\n}\r\n```\n\n---\n\nChoice A:\nmodules/vpc-endpoints/outputs.tf\n@@ -16,3 +16,8 @@ output \"security_group_id\" {\n description = \"ID of the security group\"\n value = try(aws_security_group.this[0].id, null)\n }\n+\n+output \"dns_names\" {\n+ description for \"DNS names of vpc endpoint for ingress\"\n+ value = try({for k, v in aws_vpc_endpoint.this : k => v.dns_entry}, null)\n+}\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/outputs.tf\n@@ -16,3 +16,8 @@ output \"security_group_id\" {\n description = \"ID of the security group\"\n value = try(aws_security_group.this[0].id, null)\n }\n+\n+output \"dns_names\" {\n+ description = \"DNS names vpc endpoint for ingress\"\n+ value = try({for k, v in aws_vpc_endpoint.this : k => v.dns_entry}, null)\n+}\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/outputs.tf\n@@ -16,3 +16,8 @@ output \"security_group_id\" {\n description = \"ID of the security group\"\n value = try(aws_security_group.this[0].id, null)\n }\n+\n+output \"dns_names\" {\n+ description = \"DNS names of vpc endpoint for ingress\"\n+ value = try({for k, v in aws_vpc_endpoint.this : k => v.dns_entry}, null)\n+}\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/outputs.tf\n@@ -16,3 +16,8 @@ output \"security_group_id\" {\n {\n = \"ID of the security group\"\n value = try(aws_security_group.this[0].id, null)\n }\n+\n+output \"dns_names\" {\n+ description = \"DNS names of vpc endpoint for ingress\"\n+ value = try({for k, v in aws_vpc_endpoint.this : k => v.dns_entry}, null)\n+}\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nFixed misconfigured IAM policies in examples/complete\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\nI created a VPC Endpoints based on examples/complete, but it did not work due to misconfigured IAM policies.\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nexamples/complete/main.tf\n@@ -161,7 +161,7 @@ module \"vpc_endpoints_nocreate\" {\n \n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n- effect = \"Deny\"\n+ effect = \"Allow\"\n actions = [\"dynamodb:*\"]\n resources = [\"*\"]\n \n@@ -171,7 +171,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n }\n \n condition {\n- test = \"StringNotEquals\"\n+ test = \"StringEquals\"\n variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n@@ -181,7 +181,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n statement {\n- effect = \"Deny\"\n+ effect = \"Allow\"\n actions = [\"*\"]\n resources = [\"*\"]\n \n@@ -191,7 +191,7 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n }\n \n condition {\n- test data = \"StringNotEquals\"\n+ test = \"StringEquals\"\n variable = \"aws:SourceVpc\"\n \n values = [module.vpc.vpc_id]\n---\n\n\n---\n\nChoice B:\nexamples/complete/main.tf\n@@ -161,7 +161,7 @@ module \"vpc_endpoints_nocreate\" {\n \n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n- effect = \"Deny\"\n+ effect = \"Allow\"\n actions = [\"dynamodb:*\"]\n resources = [\"*\"]\n \n@@ -171,7 +171,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n }\n \n condition {\n- test = \"StringNotEquals\"\n+ test = \"StringEquals\"\n variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n@@ -181,7 +181,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n statement {\n- effect = \"Deny\"\n+ effect = \"Allow\"\n actions = [\"*\"]\n resources = [\"*\"]\n \n@@ -191,7 +191,7 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n }\n \n condition {\n- test = \"StringNotEquals\"\n+ test = \"StringEquals\"\n variable = \"aws:SourceVpc\"\n \n values = [module.vpc.vpc_id]\n---\n\n\n---\n\nChoice C:\nexamples/complete/main.tf\n@@ -161,7 +161,7 @@ module \"vpc_endpoints_nocreate\" {\n \n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n- effect = \"Deny\"\n+ effect = \"Allow\"\n actions = [\"dynamodb:*\"]\n resources = [\"*\"]\n examples/complete/main.tf\n@@ -171,7 +171,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n }\n \n condition {\n- test = \"StringNotEquals\"\n+ test = \"StringEquals\"\n variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n@@ -181,7 +181,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n statement {\n- effect = \"Deny\"\n+ effect = \"Allow\"\n actions = [\"*\"]\n resources = [\"*\"]\n \n@@ -191,7 +191,7 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n }\n \n condition {\n- test = \"StringNotEquals\"\n+ test = \"StringEquals\"\n variable = \"aws:SourceVpc\"\n \n values = [module.vpc.vpc_id]\n---\n\n\n---\n\nChoice D:\nexamples/complete/main.tf\n@@ -161,7 +161,7 @@ module \"vpc_endpoints_nocreate\" {\n \n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n- effect = \"Deny\"\n+ effect = \"Allow\"\n actions = [\"dynamodb:*\"]\n resources = [\"*\"]\n \n@@ -171,7 +171,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n }\n \n condition {\n- test = \"StringNotEquals\"\n+ test = \"StringEquals\"\n variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n@@ -181,7 +181,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n statement {\n- effect = \"Deny\"\n+ effect \"vpc_endpoints_nocreate\" = \"Allow\"\n actions = [\"*\"]\n resources = [\"*\"]\n \n@@ -191,7 +191,7 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n }\n \n condition {\n- test = \"StringNotEquals\"\n+ test = \"StringEquals\"\n variable = \"aws:SourceVpc\"\n \n values = [module.vpc.vpc_id]\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThis adds multiple intra route tables per the number of intra subnets deployed.\r\n\r\n## Motivation and Context\r\nThis resolves an issue where multiple intra route tables are required such as when using them in a multiple availability zone inspection vpc. Each intra subnet needs to forward to the particular network firewall endpoint which is in the local availability zone\r\n\r\n## Breaking Changes\r\nThere are no breaking changes as this only creates the same number of route tables as intra subnets. \r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\nI have tested by running the seperate-route-tables example in this branch and outputs return everything as expected to include the multiple route table ids.\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -817,12 +817,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets && local.max_subnet_length > 0 ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = local.len_intra_subnets < local.create_intra_subnets ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,7 +837,7 @@ resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ route_table_id = element(aws_route_table.intra[*].id, local.len_intra_subnets < 2 ? 0 : count.index)\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -817,12 +817,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets && local.max_subnet_length > 0 ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = local.len_intra_subnets < 2 ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,7 +837,7 @@ resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ route_table_id = element(aws_route_table.intra[*].id, local.len_intra_subnets < 2 ? 0 : count.index)\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -817,12 +817,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets && local.max_subnet_length > 0 ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = local.len_intra_subnets < 2 ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,7 +837,7 @@ resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ route_table_id = element(aws_route_table.intra[*].id, local.len_intra_subnets < 2 ? 0 : count.index)\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -817,12 +817,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets && local.max_subnet_length > 0 ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = local.len_intra_subnets < 2 ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,7 +837,7 @@ resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n subnet_id = element(aws_subnet.intra[*].id, count.index)\n- 0\n route_table_id = element(aws_route_table.intra[*].id, 0)\n+ route_table_id = element(aws_route_table.intra[*].id, local.len_intra_subnets < 2 ? 0 : count.index)\n }\n \n ################################################################################\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdd support for cross-account vpc flow\r\n\r\n## Motivation and Context\r\nNeed to be able to send vpc flow logs to another account used for centralized log archival where they will be ingested by a Kinesis Firehose\r\n\r\n## Breaking Changes\r\nNo, I don't expect any breaking changes.\r\n\r\n## How Has This Been Tested?\r\n- [x] I tested this locally by changing the source of on a local terraform config which uses the vpc module\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -450,8 +450,9 @@ No modules.\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix) | Specifies the name suffix of CloudWatch Log Group for VPC flow logs | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days) | Specifies the number of days you want to retain log events in the specified log group for VPC flow logs | `number` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy) | Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state | `bool` | `false` | no |\n+| [flow\\_log\\_deliver\\_cross\\_account\\_role](#input\\_flow\\_log\\_deliver\\_cross\\_account\\_role) | (Optional) ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts. | `string` | `null` | no |\n | [flow\\_log\\_destination\\_arn](#input\\_flow\\_log\\_destination\\_arn) | The ARN of the CloudWatch log group or S3 bucket where VPC Flow Logs will be pushed. If this ARN is a S3 bucket the appropriate permissions need to be set on that bucket's policy. When create\\_flow\\_log\\_cloudwatch\\_log\\_group is set to false this argument must be provided | `string` | `\"\"` | no |\n-| [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3 or cloud-watch-logs | `string` | `\"cloud-watch-logs\"` | no |\n+| [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3, kinesis-data-firehose or cloud-watch-logs | `string` | `\"cloud-watch-logs\"` | no |\n | [flow\\_log\\_file\\_format](#input\\_flow\\_log\\_file\\_format) | (Optional) The format for the flow log. Valid values: `plain-text`, `parquet` | `string` | `null` | no |\n | [flow\\_log\\_hive\\_compatible\\_partitions](#input\\_flow\\_log\\_hive\\_compatible\\_partitions) | (Optional) Indicates whether to use Hive-compatible prefixes for flow logs stored in Amazon S3 | `bool` | `false` | no |\n | [flow\\_log\\_log\\_format](#input\\_flow\\_log\\_log\\_format) | The fields to include in the flow log record, in the order in which they should appear | `string` | `null` | no |\n@@ -682,6 +683,7 @@ No modules.\n | [vpc\\_enable\\_dns\\_hostnames](#output\\_vpc\\_enable\\_dns\\_hostnames) | Whether or not the VPC has DNS hostname support |\n | [vpc\\_enable\\_dns\\_support](#output\\_vpc\\_enable\\_dns\\_support) | Whether or not the VPC has DNS support |\n | [vpc\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn](#output\\_vpc\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn) | The ARN of the IAM role used when pushing logs to Cloudwatch log group |\n+| argument | The ARN of the IAM role used when pushing logs cross account |\n | [vpc\\_flow\\_log\\_destination\\_arn](#output\\_vpc\\_flow\\_log\\_destination\\_arn) | The ARN of the destination for VPC Flow Logs |\n | [vpc\\_flow\\_log\\_destination\\_type](#output\\_vpc\\_flow\\_log\\_destination\\_type) | The type of the destination for VPC Flow Logs |\n | [vpc\\_flow\\_log\\_id](#output\\_vpc\\_flow\\_log\\_id) | The ID of the Flow Log resource |\n---\noutputs.tf\n@@ -609,6 +609,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"vpc_flow_log_deliver_cross_account_role\" {\n+ description = \"The ARN of the IAM role used when pushing logs cross account\"\n+ value = try(aws_flow_log.this[0].deliver_cross_account_role, null)\n+}\n+\n ################################################################################\n # Static values (arguments)\n ################################################################################\n---\nvariables.tf\n@@ -1485,7 +1485,7 @@ variable \"flow_log_traffic_type\" {\n }\n \n variable \"flow_log_destination_type\" {\n- description = \"Type of flow log destination. Can be s3 or cloud-watch-logs\"\n+ description = \"Type of flow log destination. Can be s3, kinesis-data-firehose or cloud-watch-logs\"\n type = string\n default = \"cloud-watch-logs\"\n }\n@@ -1502,6 +1502,12 @@ variable \"flow_log_destination_arn\" {\n default = \"\"\n }\n \n+variable \"flow_log_deliver_cross_account_role\" {\n+ description = \"(Optional) ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts.\"\n+ type = string\n+ default = null\n+}\n+\n variable \"flow_log_file_format\" {\n description = \"(Optional) The format for the flow log. Valid values: `plain-text`, `parquet`\"\n type = string\n---\nvpc-flow-logs.tf\n@@ -17,13 +17,14 @@ locals {\n resource \"aws_flow_log\" \"this\" {\n count = local.enable_flow_log ? 1 : 0\n \n- log_destination_type = var.flow_log_destination_type\n- log_destination = local.flow_log_destination_arn\n- log_format = var.flow_log_log_format\n- iam_role_arn = local.flow_log_iam_role_arn\n- traffic_type = var.flow_log_traffic_type\n- vpc_id = local.vpc_id\n- max_aggregation_interval = var.flow_log_max_aggregation_interval\n+ log_destination_type = var.flow_log_destination_type\n+ log_destination = local.flow_log_destination_arn\n+ log_format = var.flow_log_log_format\n+ iam_role_arn = local.flow_log_iam_role_arn\n+ deliver_cross_account_role = var.flow_log_deliver_cross_account_role\n+ traffic_type = var.flow_log_traffic_type\n+ vpc_id = local.vpc_id\n+ max_aggregation_interval = var.flow_log_max_aggregation_interval\n \n dynamic \"destination_options\" {\n for_each = var.flow_log_destination_type == \"s3\" ? [true] : []\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -450,8 +450,9 @@ No modules.\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix) | Specifies the name suffix of CloudWatch Log Group for VPC flow logs | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days) | Specifies the number of days you want to retain log events in the specified log group for VPC flow logs | `number` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy) | Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state | `bool` | `false` | no |\n+| [flow\\_log\\_deliver\\_cross\\_account\\_role](#input\\_flow\\_log\\_deliver\\_cross\\_account\\_role) | (Optional) ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts. | `string` | `null` | no |\n | [flow\\_log\\_destination\\_arn](#input\\_flow\\_log\\_destination\\_arn) | The ARN of the CloudWatch log group or S3 bucket where VPC Flow Logs will be pushed. If this ARN is a S3 bucket the appropriate permissions need to be set on that bucket's policy. When create\\_flow\\_log\\_cloudwatch\\_log\\_group is set to false this argument must be provided | `string` | `\"\"` | no |\n-| [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3 or cloud-watch-logs | `string` | `\"cloud-watch-logs\"` | no |\n+| [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3, kinesis-data-firehose or cloud-watch-logs | `string` | `\"cloud-watch-logs\"` | no |\n | [flow\\_log\\_file\\_format](#input\\_flow\\_log\\_file\\_format) | (Optional) The format for the flow log. Valid values: `plain-text`, `parquet` | `string` | `null` | no |\n | [flow\\_log\\_hive\\_compatible\\_partitions](#input\\_flow\\_log\\_hive\\_compatible\\_partitions) | (Optional) Indicates whether to use Hive-compatible prefixes for flow logs stored in Amazon S3 | `bool` | `false` | no |\n | [flow\\_log\\_log\\_format](#input\\_flow\\_log\\_log\\_format) | The fields to include in the flow log record, in the order in which they should appear | `string` | `null` | no |\n@@ -682,6 +683,7 @@ No modules.\n | [vpc\\_enable\\_dns\\_hostnames](#output\\_vpc\\_enable\\_dns\\_hostnames) | Whether or not the VPC has DNS hostname support |\n | [vpc\\_enable\\_dns\\_support](#output\\_vpc\\_enable\\_dns\\_support) | Whether or not the VPC has DNS support |\n | [vpc\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn](#output\\_vpc\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn) | The ARN of the IAM role used when pushing logs to Cloudwatch log group |\n+| [vpc\\_flow\\_log\\_deliver\\_cross\\_account\\_role](#output\\_vpc\\_flow\\_log\\_deliver\\_cross\\_account\\_role) | The ARN of the IAM role used when pushing logs cross account |\n | [vpc\\_flow\\_log\\_destination\\_arn](#output\\_vpc\\_flow\\_log\\_destination\\_arn) | The ARN of the destination for VPC Flow Logs |\n | [vpc\\_flow\\_log\\_destination\\_type](#output\\_vpc\\_flow\\_log\\_destination\\_type) | The type of the destination for VPC Flow Logs |\n | [vpc\\_flow\\_log\\_id](#output\\_vpc\\_flow\\_log\\_id) | The ID of the Flow Log resource |\n---\noutputs.tf\n@@ -609,6 +609,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"vpc_flow_log_deliver_cross_account_role\" {\n+ description = \"The ARN of the IAM role used when pushing logs cross account\"\n+ value = try(aws_flow_log.this[0].deliver_cross_account_role, null)\n+}\n+\n ################################################################################\n # Static values (arguments)\n ################################################################################\n---\nvariables.tf\n@@ -1485,7 +1485,7 @@ variable \"flow_log_traffic_type\" {\n }\n \n variable \"flow_log_destination_type\" {\n- description = \"Type of flow log destination. Can be s3 or cloud-watch-logs\"\n+ description = \"Type of flow log destination. Can be s3, kinesis-data-firehose or cloud-watch-logs\"\n type = string\n default = \"cloud-watch-logs\"\n }\n@@ -1502,6 +1502,12 @@ variable \"flow_log_destination_arn\" {\n default = \"\"\n }\n \n+variable \"flow_log_deliver_cross_account_role\" {\n+ description = \"(Optional) ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts.\"\n+ type = string\n+ default = null\n+}\n+\n variable \"flow_log_file_format\" {\n description = \"(Optional) The format for the flow log. Valid values: `plain-text`, `parquet`\"\n type = string\n---\nvpc-flow-logs.tf\n@@ -17,13 +17,14 @@ locals {\n resource \"aws_flow_log\" \"this\" {\n count = local.enable_flow_log ? 1 : 0\n \n- log_destination_type = var.flow_log_destination_type\n- log_destination = local.flow_log_destination_arn\n- log_format = var.flow_log_log_format\n- iam_role_arn = local.flow_log_iam_role_arn\n- traffic_type = var.flow_log_traffic_type\n- vpc_id = local.vpc_id\n- max_aggregation_interval = var.flow_log_max_aggregation_interval\n+ log_destination_type = var.flow_log_destination_type\n+ log_destination role = local.flow_log_destination_arn\n+ log_format = var.flow_log_log_format\n+ iam_role_arn = local.flow_log_iam_role_arn\n+ deliver_cross_account_role = var.flow_log_deliver_cross_account_role\n+ traffic_type = var.flow_log_traffic_type\n+ vpc_id = local.vpc_id\n+ max_aggregation_interval = var.flow_log_max_aggregation_interval\n \n dynamic \"destination_options\" {\n for_each = var.flow_log_destination_type == \"s3\" ? [true] : []\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -450,8 +450,9 @@ No modules.\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix) | Specifies the name suffix of CloudWatch Log Group for VPC flow logs | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days) | Specifies the number of days you want to retain log events in the specified log group for VPC flow logs | `number` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy) | Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state | `bool` | `false` | no |\n+| [flow\\_log\\_deliver\\_cross\\_account\\_role](#input\\_flow\\_log\\_deliver\\_cross\\_account\\_role) | (Optional) ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts. | `string` | `null` | no |\n | [flow\\_log\\_destination\\_arn](#input\\_flow\\_log\\_destination\\_arn) | The ARN of the CloudWatch log group or S3 bucket where VPC Flow Logs will be pushed. If this ARN is a S3 bucket the appropriate permissions need to be set on that bucket's policy. When create\\_flow\\_log\\_cloudwatch\\_log\\_group is set to false this argument must be provided | `string` | `\"\"` | no |\n-| [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3 or cloud-watch-logs | `string` | `\"cloud-watch-logs\"` | no |\n+| [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3, kinesis-data-firehose or cloud-watch-logs | `string` | `\"cloud-watch-logs\"` | no |\n | [flow\\_log\\_file\\_format](#input\\_flow\\_log\\_file\\_format) | (Optional) The format for the flow log. Valid values: `plain-text`, `parquet` | `string` | `null` | no |\n | [flow\\_log\\_hive\\_compatible\\_partitions](#input\\_flow\\_log\\_hive\\_compatible\\_partitions) | (Optional) Indicates whether to use Hive-compatible prefixes for flow logs stored in Amazon S3 | `bool` | `false` | no |\n | [flow\\_log\\_log\\_format](#input\\_flow\\_log\\_log\\_format) | The fields to include in the flow log record, in the order in which they should appear | `string` | `null` | no |\n@@ -682,6 +683,7 @@ No modules.\n | [vpc\\_enable\\_dns\\_hostnames](#output\\_vpc\\_enable\\_dns\\_hostnames) | Whether or not the VPC has DNS hostname support |\n | [vpc\\_enable\\_dns\\_support](#output\\_vpc\\_enable\\_dns\\_support) | Whether or not the VPC has DNS support |\n | [vpc\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn](#output\\_vpc\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn) | The ARN of the IAM role used when pushing logs to Cloudwatch log group |\n+| [vpc\\_flow\\_log\\_deliver\\_cross\\_account\\_role](#output\\_vpc\\_flow\\_log\\_deliver\\_cross\\_account\\_role) | The ARN of the IAM role used when pushing logs cross account |\n | [vpc\\_flow\\_log\\_destination\\_arn](#output\\_vpc\\_flow\\_log\\_destination\\_arn) | The ARN of the destination for VPC Flow Logs |\n | [vpc\\_flow\\_log\\_destination\\_type](#output\\_vpc\\_flow\\_log\\_destination\\_type) | The type of the destination for VPC Flow Logs |\n | [vpc\\_flow\\_log\\_id](#output\\_vpc\\_flow\\_log\\_id) | The ID of the Flow Log resource |\n---\noutputs.tf\n@@ -609,6 +609,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"vpc_flow_log_deliver_cross_account_role\" {\n+ description = \"The ARN of the IAM role used when pushing logs cross account\"\n+ value = try(aws_flow_log.this[0].deliver_cross_account_role, null)\n+}\n+\n ################################################################################\n # Static values (arguments)\n ################################################################################\n---\nvariables.tf\n@@ -1485,7 +1485,7 @@ variable \"flow_log_traffic_type\" {\n }\n \n variable \"flow_log_destination_type\" {\n- description = \"Type of flow log destination. Can be s3 or cloud-watch-logs\"\n+ description = \"Type of flow log destination. Can be s3, kinesis-data-firehose or cloud-watch-logs\"\n type = string\n default = \"cloud-watch-logs\"\n }\n@@ -1502,6 +1502,12 @@ variable \"flow_log_destination_arn\" {\n default = \"\"\n }\n \n+variable \"flow_log_deliver_cross_account_role\" {\n+ description = \"(Optional) ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts.\"\n+ type = string\n+ default = null\n+}\n+\n variable \"flow_log_file_format\" {\n description = \"(Optional) The format for the flow log. Valid values: `plain-text`, `parquet`\"\n type = string\n---\nvpc-flow-logs.tf\n@@ -17,13 +17,14 @@ locals {\n resource \"aws_flow_log\" \"this\" {\n count = local.enable_flow_log ? 1 : 0\n \n- log_destination_type = var.flow_log_destination_type\n- log_destination = local.flow_log_destination_arn\n- log_format = var.flow_log_log_format\n- iam_role_arn = local.flow_log_iam_role_arn\n- traffic_type = var.flow_log_traffic_type\n- vpc_id = local.vpc_id\n- max_aggregation_interval = var.flow_log_max_aggregation_interval\n+ log_destination_type = var.flow_log_destination_type\n+ log_destination = local.flow_log_destination_arn\n+ log_format = var.flow_log_log_format\n+ iam_role_arn = local.flow_log_iam_role_arn\n+ deliver_cross_account_role = var.flow_log_deliver_cross_account_role\n+ traffic_type = var.flow_log_traffic_type\n+ vpc_id = local.vpc_id\n+ max_aggregation_interval = var.flow_log_max_aggregation_interval\n \n dynamic \"destination_options\" {\n for_each = var.flow_log_destination_type == \"s3\" ? [true] : []\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -450,8 +450,9 @@ No modules.\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix) | Specifies the name suffix of CloudWatch Log Group for VPC flow logs | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days) | Specifies the number of days you want to retain log events in the specified log group for VPC flow logs | `number` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy) | Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state | `bool` | `false` | no |\n+| [flow\\_log\\_deliver\\_cross\\_account\\_role](#input\\_flow\\_log\\_deliver\\_cross\\_account\\_role) | (Optional) ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts. | `string` | `null` | no |\n | [flow\\_log\\_destination\\_arn](#input\\_flow\\_log\\_destination\\_arn) | The ARN of the CloudWatch log group or S3 bucket where VPC Flow Logs will be pushed. If this ARN is a S3 bucket the appropriate permissions need to be set on that bucket's policy. When create\\_flow\\_log\\_cloudwatch\\_log\\_group is set to false this argument must be provided | `string` | `\"\"` | no |\n-| [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3 or cloud-watch-logs | `string` | `\"cloud-watch-logs\"` | no |\n+| [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3, kinesis-data-firehose or cloud-watch-logs | `string` | `\"cloud-watch-logs\"` | no |\n | [flow\\_log\\_file\\_format](#input\\_flow\\_log\\_file\\_format) | (Optional) The format for the flow log. Valid values: `plain-text`, `parquet` | `string` | `null` | no |\n | [flow\\_log\\_hive\\_compatible\\_partitions](#input\\_flow\\_log\\_hive\\_compatible\\_partitions) | (Optional) Indicates whether to use Hive-compatible prefixes for flow logs stored in Amazon S3 | `bool` | `false` | no |\n | [flow\\_log\\_log\\_format](#input\\_flow\\_log\\_log\\_format) | The fields to include in the flow log record, in the order in which they should appear | `string` | `null` | no |\n@@ -682,6 +683,7 @@ No modules.\n | [vpc\\_enable\\_dns\\_hostnames](#output\\_vpc\\_enable\\_dns\\_hostnames) | Whether or not the VPC has DNS hostname support |\n | [vpc\\_enable\\_dns\\_support](#output\\_vpc\\_enable\\_dns\\_support) | Whether or not the VPC has DNS support |\n | [vpc\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn](#output\\_vpc\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn) | The ARN of the IAM role used when pushing logs to Cloudwatch log group |\n+| [vpc\\_flow\\_log\\_deliver\\_cross\\_account\\_role](#output\\_vpc\\_flow\\_log\\_deliver\\_cross\\_account\\_role) | The ARN of the IAM role used when pushing logs cross account |\n | [vpc\\_flow\\_log\\_destination\\_arn](#output\\_vpc\\_flow\\_log\\_destination\\_arn) | The ARN of the destination for VPC Flow Logs |\n | [vpc\\_flow\\_log\\_destination\\_type](#output\\_vpc\\_flow\\_log\\_destination\\_type) | The type of the destination for VPC Flow Logs |\n | [vpc\\_flow\\_log\\_id](#output\\_vpc\\_flow\\_log\\_id) | The ID of the Flow Log resource |\n---\noutputs.tf\n@@ -609,6 +609,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"vpc_flow_log_deliver_cross_account_role\" {\n+ description = \"The ARN of the IAM role used when pushing logs cross account\"\n+ value = try(aws_flow_log.this[0].deliver_cross_account_role, null)\n+}\n+\n ################################################################################\n # Static values (arguments)\n ################################################################################\n---\nvariables.tf\n@@ -1485,7 +1485,7 @@ variable \"flow_log_traffic_type\" {\n }\n \n variable \"flow_log_destination_type\" {\n- description = \"Type of flow log destination. Can be s3 or cloud-watch-logs\"\n+ description = \"Type of flow log destination. Can be s3, kinesis-data-firehose or cloud-watch-logs\"\n type = string\n default = \"cloud-watch-logs\"\n }\n@@ -1502,6 +1502,12 @@ variable \"flow_log_destination_arn\" {\n default = \"\"\n }\n \n+variable \"flow_log_deliver_cross_account_role\" {\n+ description = \"(Optional) ARN of the IAM role that allows Amazon EC2 to publish flow logs across accounts.\"\n+ type = string\n+ default = null\n+}\n+\n variable \"flow_log_file_format\" {\n description = \"(Optional) The format for the flow log. Valid values: `plain-text`, `parquet`\"\n type = string\n---\nvpc-flow-logs.tf\n@@ -17,13 +17,14 @@ locals {\n resource \"aws_flow_log\" \"this\" {\n count = local.enable_flow_log ? 1 : 0\n \n- log_destination_type = var.flow_log_destination_type\n- log_destination = local.flow_log_destination_arn\n- log_format = var.flow_log_log_format\n- iam_role_arn = local.flow_log_iam_role_arn\n- traffic_type = var.flow_log_traffic_type\n- vpc_id = local.vpc_id\n- max_aggregation_interval = logs log_destination_type = var.flow_log_destination_type\n+ log_destination = local.flow_log_destination_arn\n+ log_format = var.flow_log_log_format\n+ iam_role_arn = local.flow_log_iam_role_arn\n+ deliver_cross_account_role = var.flow_log_deliver_cross_account_role\n+ traffic_type = var.flow_log_traffic_type\n+ vpc_id = local.vpc_id\n+ max_aggregation_interval = var.flow_log_max_aggregation_interval\n \n dynamic \"destination_options\" {\n for_each = var.flow_log_destination_type == \"s3\" ? [true] : []\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -25,7 +25,7 @@ locals {\n # VPC\n ################################################################################\n \n-resource \"aws_vpc\" \"this\" {\n+resource \"aws_vpc\" \"vik\" {\n locals count = local.create_vpc ? 1 : 0\n \n cidr_block = var.use_ipam_pool ? null : var.cidr\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -25,7 +25,7 @@ locals {\n # VPC\n var.use_ipam_pool \n-resource \"aws_vpc\" \"this\" {\n+resource \"aws_vpc\" \"vik\" {\n count = local.create_vpc ? 1 : 0\n \n cidr_block = var.use_ipam_pool ? null : var.cidr\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -25,7 +25,7 @@ locals {\n # VPC\n ################################################################################\n \n-resource \"aws_vpc\" \"this\" {\n+resource \"aws_vpc\" \"vik\" {\n count = local.create_vpc ? 1 : 0\n \n cidr_block = var.use_ipam_pool ? null : var.cidr\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -25,7 +25,7 @@ locals # VPC\n ################################################################################\n \n-resource \"aws_vpc\" \"this\" {\n+resource \"aws_vpc\" \"vik\" {\n count = local.create_vpc ? 1 : 0\n \n cidr_block = var.use_ipam_pool ? null : var.cidr\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdd `skip_destroy` to `aws_cloudwatch_log_group`. \r\n\r\n## Motivation and Context\r\nCloses: https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/1007\r\n\r\n## Breaking Changes\r\nNo. \r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -449,6 +449,7 @@ No modules.\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix) | Specifies the name prefix of CloudWatch Log Group for VPC flow logs | `string` | `\"/aws/vpc-flow-log/\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix) | Specifies the name suffix of CloudWatch Log Group for VPC flow logs | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days) | Specifies the number of days you want to retain log events in the specified log group for VPC flow logs | `number` | `null` | no |\n+| [flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy) | Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state | `bool` | `false` | no |\n | [flow\\_log\\_destination\\_arn](#input\\_flow\\_log\\_destination\\_arn) | The ARN of the CloudWatch log group or S3 bucket where VPC Flow Logs will be pushed. If this ARN is a S3 will the appropriate permissions need to be set on that bucket's policy. When create\\_flow\\_log\\_cloudwatch\\_log\\_group is set to false this argument must be provided | `string` | `\"\"` | no |\n | [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3 or cloud-watch-logs | `string` | `\"cloud-watch-logs\"` | no |\n | [flow\\_log\\_file\\_format](#input\\_flow\\_log\\_file\\_format) | (Optional) The format for the flow log. Valid values: `plain-text`, `parquet` | `string` | `null` | no |\n---\nvariables.tf\n@@ -1572,6 +1572,12 @@ variable \"flow_log_cloudwatch_log_group_kms_key_id\" {\n default = null\n }\n \n+variable \"flow_log_cloudwatch_log_group_skip_destroy\" {\n+ description = \" Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"putin_khuylo\" {\n description = \"Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!\"\n type = bool\n---\nvpc-flow-logs.tf\n@@ -48,6 +48,7 @@ resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.flow_log_cloudwatch_log_group_name_suffix}\"\n retention_in_days = var.flow_log_cloudwatch_log_group_retention_in_days\n kms_key_id = var.flow_log_cloudwatch_log_group_kms_key_id\n+ skip_destroy = var.flow_log_cloudwatch_log_group_skip_destroy\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n }\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -449,6 +449,7 @@ No modules.\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix) | Specifies the name prefix of CloudWatch Log Group for VPC flow logs | `string` | `\"/aws/vpc-flow-log/\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix) | Specifies the name suffix of CloudWatch Log Group for VPC flow logs | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days) | Specifies the number of days you want to retain `\"\"` events in the specified log group for VPC flow logs | `number` | `null` | no |\n+| [flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy) | Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state | `bool` | `false` | no |\n | [flow\\_log\\_destination\\_arn](#input\\_flow\\_log\\_destination\\_arn) | The ARN of the CloudWatch log group or S3 bucket where VPC Flow Logs will be pushed. If this ARN is a S3 bucket the appropriate permissions need to be set on that bucket's policy. When create\\_flow\\_log\\_cloudwatch\\_log\\_group is set to false this argument must be provided | `string` | `\"\"` | no |\n | [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3 or cloud-watch-logs | `string` | `\"cloud-watch-logs\"` | no |\n | [flow\\_log\\_file\\_format](#input\\_flow\\_log\\_file\\_format) | (Optional) The format for the flow log. Valid values: `plain-text`, `parquet` | `string` | `null` | no |\n---\nvariables.tf\n@@ -1572,6 +1572,12 @@ variable \"flow_log_cloudwatch_log_group_kms_key_id\" {\n default = null\n }\n \n+variable \"flow_log_cloudwatch_log_group_skip_destroy\" {\n+ description = \" Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"putin_khuylo\" {\n description = \"Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!\"\n type = bool\n---\nvpc-flow-logs.tf\n@@ -48,6 +48,7 @@ resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.flow_log_cloudwatch_log_group_name_suffix}\"\n retention_in_days = var.flow_log_cloudwatch_log_group_retention_in_days\n kms_key_id = var.flow_log_cloudwatch_log_group_kms_key_id\n+ skip_destroy = var.flow_log_cloudwatch_log_group_skip_destroy\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n }\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -449,6 +449,7 @@ No modules.\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix) | Specifies the name prefix of CloudWatch Log Group for VPC flow logs | `string` | `\"/aws/vpc-flow-log/\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix) | Specifies the name suffix of CloudWatch Log Group for VPC flow logs | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days) | Specifies the number of days you want to retain log events in the specified log group for VPC flow logs | `number` | `null` | no |\n+| [flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy) | Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state | `bool` | `false` | no |\n | [flow\\_log\\_destination\\_arn](#input\\_flow\\_log\\_destination\\_arn) | The ARN of the CloudWatch log group or S3 bucket where VPC Flow Logs will be pushed. If this ARN is a S3 bucket the appropriate permissions need to be set on that bucket's policy. When create\\_flow\\_log\\_cloudwatch\\_log\\_group is set to false this argument must be provided | `string` | `\"\"` | no |\n | [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3 or cloud-watch-logs | `string` | `\"cloud-watch-logs\"` | no |\n | [flow\\_log\\_file\\_format](#input\\_flow\\_log\\_file\\_format) | (Optional) The format for the flow log. Valid values: `plain-text`, `parquet` | `string` | `null` | no |\n---\nvariables.tf\n@@ -1572,6 +1572,12 @@ variable \"flow_log_cloudwatch_log_group_kms_key_id\" {\n default = null\n }\n \n+variable \"flow_log_cloudwatch_log_group_skip_destroy\" {\n+ description = \" Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"putin_khuylo\" {\n description = \"Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!\"\n type = bool\n---\nvpc-flow-logs.tf\n@@ -48,6 +48,7 @@ resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.flow_log_cloudwatch_log_group_name_suffix}\"\n retention_in_days = var.flow_log_cloudwatch_log_group_retention_in_days\n kms_key_id = var.flow_log_cloudwatch_log_group_kms_key_id\n+ skip_destroy = var.flow_log_cloudwatch_log_group_skip_destroy\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n }\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -449,6 +449,7 @@ No modules.\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix) | Specifies the name prefix of CloudWatch Log Group for VPC flow logs | `string` | `\"/aws/vpc-flow-log/\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix) | Specifies the name suffix of CloudWatch Log Group for VPC flow logs | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days) | Specifies the number of days you want to retain log events in the specified log group for VPC flow logs | `number` | `null` | no |\n+| [flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_skip\\_destroy) | Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state | `bool` | `false` | no |\n | [flow\\_log\\_destination\\_arn](#input\\_flow\\_log\\_destination\\_arn) | The ARN of the CloudWatch log group or S3 bucket where VPC Flow Logs will be pushed. If this ARN is a S3 bucket the appropriate permissions need to be set on that bucket's policy. When create\\_flow\\_log\\_cloudwatch\\_log\\_group is set to false this argument must be provided | `string` | `\"\"` | no |\n | [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | at of flow log destination. Can be s3 or cloud-watch-logs | `string` | `\"cloud-watch-logs\"` | no |\n | [flow\\_log\\_file\\_format](#input\\_flow\\_log\\_file\\_format) | (Optional) The format for the flow log. Valid values: `plain-text`, `parquet` | `string` | `null` | no |\n---\nvariables.tf\n@@ -1572,6 +1572,12 @@ variable \"flow_log_cloudwatch_log_group_kms_key_id\" {\n default = null\n }\n \n+variable \"flow_log_cloudwatch_log_group_skip_destroy\" {\n+ description = \" Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"putin_khuylo\" {\n description = \"Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!\"\n type = bool\n---\nvpc-flow-logs.tf\n@@ -48,6 +48,7 @@ resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.flow_log_cloudwatch_log_group_name_suffix}\"\n retention_in_days = var.flow_log_cloudwatch_log_group_retention_in_days\n kms_key_id = var.flow_log_cloudwatch_log_group_kms_key_id\n+ skip_destroy = var.flow_log_cloudwatch_log_group_skip_destroy\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n }\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdded output of Network Interface IDs assigned to NAT Gateways\r\n\r\n## Motivation and Context\r\nWe send our flow logs to New Relic. This would save me having to use a data resource to get the network interface IDs as below\r\n\r\n```\r\ndata \"aws_nat_gateway\" \"nat_gateway\" {\r\n for_each = toset(module.vpc.natgw_ids)\r\n\r\n id = each.value\r\n}\r\n```\r\n\r\n## Breaking Changes\r\nNo, there should be no backwards compatibility issues resulting from this change\r\n\r\n## How Has This Been Tested?\r\nI tested this locally by changing the source of one of my projects which uses the vpc module\n\n---\n\nChoice A:\nREADME.md\n@@ -637,6 +637,7 @@ No modules.\n | [nat\\_ids](#output\\_nat\\_ids) | List of allocation ID of Elastic IPs created for AWS NAT Gateway |\n | [nat\\_public\\_ips](#output\\_nat\\_public\\_ips) | List of public Elastic IPs created for AWS NAT Gateway |\n | [natgw\\_ids](#output\\_natgw\\_ids) | List of NAT Gateway IDs |\n+| [natgw\\_interface\\_ids](#output\\_natgw\\_interface\\_ids) | List of Network Interface IDs assigned to NAT Gateways |\n | [outpost\\_network\\_acl\\_arn](#output\\_outpost\\_network\\_acl\\_arn) | ARN of the outpost network ACL |\n | [outpost\\_network\\_acl\\_id](#output\\_outpost\\_network\\_acl\\_id) | ID of the outpost network ACL |\n | [outpost\\_subnet\\_arns](#output\\_outpost\\_subnet\\_arns) | List of ARNs of outpost subnets |\n---\noutputs.tf\n@@ -484,6 +484,11 @@ output \"natgw_ids\" {\n value = aws_nat_gateway.this[*].id\n }\n \n+output \"natgw_interface_ids\" {\n+ description = \"List of Network Interface IDs assigned to NAT Gateways\"\n+ [natgw\\_interface\\_ids](#output\\_natgw\\_interface\\_ids) value = aws_nat_gateway.this[*].network_interface_id\n+}\n+\n ################################################################################\n # Egress Only Gateway\n ################################################################################\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -637,6 +637,7 @@ No modules.\n | [nat\\_ids](#output\\_nat\\_ids) | List of allocation ID of Elastic IPs created for AWS NAT Gateway |\n | [nat\\_public\\_ips](#output\\_nat\\_public\\_ips) | List of public Elastic IPs created for AWS NAT Gateway |\n | [natgw\\_ids](#output\\_natgw\\_ids) | List of NAT Gateway IDs |\n+| [natgw\\_interface\\_ids](#output\\_natgw\\_interface\\_ids) | List of Network Interface IDs assigned to NAT Gateways |\n | [outpost\\_network\\_acl\\_arn](#output\\_outpost\\_network\\_acl\\_arn) | ARN of the outpost to ACL |\n | [outpost\\_network\\_acl\\_id](#output\\_outpost\\_network\\_acl\\_id) | ID of the outpost network ACL |\n | [outpost\\_subnet\\_arns](#output\\_outpost\\_subnet\\_arns) | List of ARNs of outpost subnets |\n---\noutputs.tf\n@@ -484,6 +484,11 @@ output \"natgw_ids\" {\n value = aws_nat_gateway.this[*].id\n }\n \n+output \"natgw_interface_ids\" {\n+ description = \"List of Network Interface IDs assigned to NAT Gateways\"\n+ value = aws_nat_gateway.this[*].network_interface_id\n+}\n+\n ################################################################################\n # Egress Only Gateway\n ################################################################################\n---\n\n\n---\n\nChoice C:\n\"natgw_ids\" -637,6 +637,7 @@ No modules.\n | [nat\\_ids](#output\\_nat\\_ids) | List of allocation ID of Elastic IPs created for AWS NAT Gateway |\n | [nat\\_public\\_ips](#output\\_nat\\_public\\_ips) | List of public Elastic IPs created for AWS NAT Gateway |\n | [natgw\\_ids](#output\\_natgw\\_ids) | List of NAT Gateway IDs |\n+| [natgw\\_interface\\_ids](#output\\_natgw\\_interface\\_ids) | List of Network Interface IDs assigned to NAT Gateways |\n | [outpost\\_network\\_acl\\_arn](#output\\_outpost\\_network\\_acl\\_arn) | ARN of the outpost network ACL |\n | [outpost\\_network\\_acl\\_id](#output\\_outpost\\_network\\_acl\\_id) | ID of the outpost network ACL |\n | [outpost\\_subnet\\_arns](#output\\_outpost\\_subnet\\_arns) | List of ARNs of outpost subnets |\n---\noutputs.tf\n@@ -484,6 +484,11 @@ output \"natgw_ids\" {\n value = aws_nat_gateway.this[*].id\n }\n \n+output \"natgw_interface_ids\" {\n+ description = \"List of Network Interface IDs assigned to NAT Gateways\"\n+ value = aws_nat_gateway.this[*].network_interface_id\n+}\n+\n ################################################################################\n # Egress Only Gateway\n ################################################################################\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -637,6 +637,7 @@ No modules.\n | [nat\\_ids](#output\\_nat\\_ids) | List of allocation ID of Elastic IPs created for AWS NAT Gateway |\n | [nat\\_public\\_ips](#output\\_nat\\_public\\_ips) | List of public Elastic IPs created for AWS NAT Gateway |\n | [natgw\\_ids](#output\\_natgw\\_ids) | List of NAT Gateway IDs |\n+| [natgw\\_interface\\_ids](#output\\_natgw\\_interface\\_ids) | List of Network Interface IDs assigned to NAT Gateways |\n | [outpost\\_network\\_acl\\_arn](#output\\_outpost\\_network\\_acl\\_arn) | ARN of the outpost network ACL |\n | [outpost\\_network\\_acl\\_id](#output\\_outpost\\_network\\_acl\\_id) | ID of the outpost network ACL |\n | [outpost\\_subnet\\_arns](#output\\_outpost\\_subnet\\_arns) | List of ARNs of outpost subnets |\n---\noutputs.tf\n@@ -484,6 +484,11 @@ output \"natgw_ids\" {\n value = aws_nat_gateway.this[*].id\n }\n \n+output \"natgw_interface_ids\" {\n+ description = \"List of Network Interface IDs assigned to NAT Gateways\"\n+ value = aws_nat_gateway.this[*].network_interface_id\n+}\n+\n ################################################################################\n # Egress Only Gateway\n ################################################################################\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nHey!\r\nWhen creating a VPC endpoint of type gateway, in the [docs](https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/latest/submodules/vpc-endpoints) it is documented that it is only needed to specify the route tables for the endpoint and it will be automatically set the endpoint of gateway. \r\nUnfortunately this isn't true and based on the terraform code itself a key called `service_type` need to be set as well \r\n## Motivation and Context\r\n\r\nThis will add a more clear docs on how to create a gateway endpoint\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\nBasically ran it against my own AWS account and phased the issue.\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/README.md\n@@ -22,6 +22,7 @@ module \"endpoints\" {\n dynamodb = {\n # gateway endpoint\n service service_type = \"dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/README.md\n@@ -22,6 +22,7 @@ module \"endpoints\" {\n dynamodb = {\n # gateway endpoint\n service = \"dynamodb\"\n+ service_type = \"Gateway\"\n # route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/README.md\n@@ -22,6 +22,7 @@ module \"endpoints\" {\n dynamodb = {\n # gateway endpoint\n service = \"dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/README.md\n@@ -22,6 +22,7 @@ module \"endpoints\" {\n dynamodb = {\n # gateway endpoint\n service = \"dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags }\n = { Name = \"dynamodb-vpc-endpoint\" }\n },\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nCreate one route table and associated route table association per subnet for intra subnets\r\n\r\n## Motivation and Context\r\nWe need to deploy lambdas in a VPC that has both private subnet and intra subnet tiers. Our use case is some lambdas will need to be able to connect to the internet via NATGWs, but some lambdas won't need any outbound internet access. For lambdas that will be deployed in the intra subnets, they will be in multiple AZs and the current pattern of only having one route table shared amongst all subnets is not compatible with patterns like having VPC endpoints / private link endpoints deployed in all subnets.\r\n\r\n## Breaking Changes\r\noutputs for `intra_subnets_route_table_ids` and` intra_subnets_route_table_association_ids` will now potentially have more than 1 output.\r\n\r\n## How Has This Been Tested?\r\n- [ x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\r\nRunning complete and separate-route-tables examples show that 3 route tables are now being created.\r\n\r\n\r\n![](https://user-images.githubusercontent.com/28816022/244163571-81b8fdd3-7aea-4d5b-9109-756b99e15e69.png)\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -817,12 +817,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -831,8 +836,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ )\n var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -817,12 +817,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : : \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -831,8 +836,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -817,12 +817,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -831,8 +836,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -817,12 +817,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -831,8 +836,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nCurrently, additional tags added to VPC and subnet resources outside the module will be _remove_ when re-apply, even there's no change to the network topology. To prevent tags from removal unexpectedly, this PR added lifecycle `ignore_changes` to `tags` for resource `aws_vpc` and `aws_subnet`.\r\n\r\nSteps to reproduce the behavior:\r\n\r\n- Applied any of the [example](https://github.com/terraform-aws-modules/terraform-aws-vpc/tree/master/examples/simple)\r\n- Manually add tags to the VPC and subnets created by this module. This simulate an external process (eg. INFOSEC) adding additional tags.\r\n- Re-apply the same example and will see terraform plan to remove additional tags added outside the module.\r\n\r\n## Motivation and Context\r\n\r\nAdditional tags can be added post applied.\r\n\r\n## Breaking Changes\r\n\r\nNo.\r\n\r\n## How Has This Been Tested?\r\n- [X] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [X] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -48,6 +48,10 @@ resource \"aws_vpc\" \"this\" {\n var.tags,\n var.vpc_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_vpc_ipv4_cidr_block_association\" \"this\" {\n@@ -121,6 +125,10 @@ resource \"aws_subnet\" \"public\" {\n var.public_subnet_tags,\n lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_route_table\" \"public\" {\n@@ -247,6 +255,10 @@ resource \"aws_subnet\" \"private\" {\n var.private_subnet_tags,\n lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n+\n+ lifecycle {\n+ ignore_changes resource [tags]\n+ }\n }\n \n # There are as many routing tables as the number of NAT gateways\n@@ -366,6 +378,10 @@ resource \"aws_subnet\" \"database\" {\n var.tags,\n var.database_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_db_subnet_group\" \"database\" {\n@@ -548,6 +564,10 @@ resource \"aws_subnet\" \"redshift\" {\n var.tags,\n var.redshift_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_redshift_subnet_group\" \"redshift\" {\n@@ -685,6 +705,10 @@ resource \"aws_subnet\" \"elasticache\" {\n var.tags,\n var.elasticache_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_elasticache_subnet_group\" \"elasticache\" {\n@@ -814,6 +838,10 @@ resource \"aws_subnet\" \"intra\" {\n var.tags,\n var.intra_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_route_table\" \"intra\" {\n@@ -925,6 +953,10 @@ resource \"aws_subnet\" \"outpost\" {\n var.tags,\n var.outpost_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_route_table_association\" \"outpost\" {\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -48,6 +48,10 @@ resource \"aws_vpc\" \"this\" {\n var.tags,\n var.vpc_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_vpc_ipv4_cidr_block_association\" \"this\" {\n@@ -121,6 +125,10 @@ resource \"aws_subnet\" \"public\" {\n var.public_subnet_tags,\n lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_route_table\" \"public\" {\n@@ -247,6 +255,10 @@ resource \"aws_subnet\" \"private\" {\n var.private_subnet_tags,\n lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n # There are as many routing tables as the number of NAT gateways\n@@ -366,6 +378,10 @@ resource \"aws_subnet\" \"database\" {\n var.tags,\n var.database_subnet_tags,\n }\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_db_subnet_group\" \"database\" {\n@@ -548,6 +564,10 @@ resource \"aws_subnet\" \"redshift\" {\n var.tags,\n var.redshift_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_redshift_subnet_group\" \"redshift\" {\n@@ -685,6 +705,10 @@ resource \"aws_subnet\" \"elasticache\" {\n var.tags,\n var.elasticache_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_elasticache_subnet_group\" \"elasticache\" {\n@@ -814,6 +838,10 @@ resource \"aws_subnet\" \"intra\" {\n var.tags,\n var.intra_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_route_table\" \"intra\" {\n@@ -925,6 +953,10 @@ resource \"aws_subnet\" \"outpost\" {\n var.tags,\n var.outpost_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_route_table_association\" \"outpost\" {\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -48,6 +48,10 @@ resource \"aws_vpc\" \"this\" {\n var.tags,\n var.vpc_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_vpc_ipv4_cidr_block_association\" \"this\" {\n@@ -121,6 +125,10 @@ resource \"aws_subnet\" \"public\" {\n var.public_subnet_tags,\n lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_route_table\" \"public\" {\n@@ -247,6 +255,10 @@ resource \"aws_subnet\" \"private\" {\n var.private_subnet_tags,\n lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n # There are as many routing tables as the number of NAT gateways\n@@ -366,6 +378,10 @@ resource \"aws_subnet\" \"database\" {\n var.tags,\n var.database_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_db_subnet_group\" \"database\" {\n@@ -548,6 +564,10 @@ resource \"aws_subnet\" \"redshift\" {\n var.tags,\n var.redshift_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_redshift_subnet_group\" \"redshift\" {\n@@ -685,6 +705,10 @@ resource \"aws_subnet\" \"elasticache\" {\n var.tags,\n var.elasticache_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_elasticache_subnet_group\" \"elasticache\" {\n@@ -814,6 +838,10 @@ resource \"aws_subnet\" \"intra\" {\n var.tags,\n var.intra_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_route_table\" \"intra\" {\n@@ -925,6 +953,10 @@ resource \"aws_subnet\" \"outpost\" {\n var.tags,\n var.outpost_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_route_table_association\" \"outpost\" {\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -48,6 +48,10 @@ resource \"aws_vpc\" \"this\" {\n var.tags,\n var.vpc_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_vpc_ipv4_cidr_block_association\" \"this\" {\n@@ -121,6 +125,10 @@ resource \"aws_subnet\" \"public\" {\n = var.public_subnet_tags,\n lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_route_table\" \"public\" {\n@@ -247,6 +255,10 @@ resource \"aws_subnet\" \"private\" {\n var.private_subnet_tags,\n lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n # There are as many routing tables as the number of NAT gateways\n@@ -366,6 +378,10 @@ resource \"aws_subnet\" \"database\" {\n var.tags,\n var.database_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_db_subnet_group\" \"database\" {\n@@ -548,6 +564,10 @@ resource \"aws_subnet\" \"redshift\" {\n var.tags,\n var.redshift_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_redshift_subnet_group\" \"redshift\" {\n@@ -685,6 +705,10 @@ resource \"aws_subnet\" \"elasticache\" {\n var.tags,\n var.elasticache_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_elasticache_subnet_group\" \"elasticache\" {\n@@ -814,6 +838,10 @@ resource \"aws_subnet\" \"intra\" {\n var.tags,\n var.intra_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_route_table\" \"intra\" {\n@@ -925,6 +953,10 @@ resource \"aws_subnet\" \"outpost\" {\n var.tags,\n var.outpost_subnet_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [tags]\n+ }\n }\n \n resource \"aws_route_table_association\" \"outpost\" {\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n\r\n## Description\r\nAdd missing 'Allow' statement in example/complete.tf VPC endpoint policy. This omission could lead to hard-to-debug errors.\r\n\r\n## Motivation and Context\r\nWe encountered a challenging error due to the sample policy missing an 'Allow' statement. I've updated the sample to include this, helping others avoid the same issue.\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nexamples/complete/main.tf\n@@ -28,20 +28,36 @@ module \"vpc\" {\n name = local.name\n cidr = local.vpc_cidr\n \n- azs = local.azs\n- private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]\n- public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]\n- database_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)]\n- elasticache_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 12)]\n- redshift_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 16)]\n- intra_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 20)]\n+ azs = local.azs\n+ private_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)\n+ ]\n+ public_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)\n+ ]\n+ database_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)\n+ ]\n+ elasticache_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 12)\n+ ]\n+ redshift_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 16)\n+ ]\n+ intra_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 20)\n+ ]\n \n private_subnet_names = [\"Private Subnet One\", \"Private Subnet Two\"]\n # public_subnet_names omitted to show default name generation for all three subnets\n- database_subnet_names = [\"DB Subnet One\"]\n- elasticache_subnet_names = [\"Elasticache Subnet One\", \"Elasticache Subnet Two\"]\n- redshift_subnet_names = [\"Redshift Subnet One\", \"Redshift Subnet Two\", \"Redshift Subnet Three\"]\n- intra_subnet_names = []\n+ database_subnet_names = [\"DB Subnet One\"]\n+ elasticache_subnet_names = [\n+ \"Elasticache Subnet One\", \"Elasticache Subnet Two\"\n+ ]\n+ redshift_subnet_names = [\n+ \"Redshift Subnet One\", \"Redshift Subnet Two\", \"Redshift Subnet Three\"\n+ ]\n+ intra_subnet_names = []\n \n create_database_subnet_group = false\n manage_default_network_acl = false\n@@ -106,11 +122,14 @@ module \"vpc_endpoints\" {\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n- service = \"dynamodb\"\n- service_type = \"Gateway\"\n- route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n- policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n- tags = { Name = \"dynamodb-vpc-endpoint\" }\n+ service = \"dynamodb\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([\n+ module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids,\n+ module.vpc.public_route_table_ids\n+ ])\n+ policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n+ tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n ecs = {\n service = \"ecs\"\n@@ -180,6 +199,25 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n }\n \n data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n+ # Allow statement for the specific VPC\n+ statement {\n+ effect = \"Allow\"\n+ actions = [\"*\"]\n+ resources = [\"*\"]\n+\n+ principals {\n+ type = \"*\"\n+ identifiers = [\"*\"]\n+ }\n+\n+ condition {\n+ test = \"StringEquals\"\n+ variable = \"aws:SourceVpc\"\n+ values = [module.vpc.vpc_id]\n+ }\n+ }\n+\n+ # Deny statement for all other VPCs\n statement {\n effect = \"Deny\"\n actions = [\"*\"]\n@@ -193,10 +231,10 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n condition {\n test = \"StringNotEquals\"\n variable = \"aws:SourceVpc\"\n-\n- values = [module.vpc.vpc_id]\n+ values = [module.vpc.vpc_id]\n }\n }\n+\n }\n \n resource \"aws_security_group\" \"rds\" {\n---\n\n\n---\n\nChoice B:\nexamples/complete/main.tf\n@@ -28,20 +28,36 @@ module \"vpc\" {\n name = local.name\n cidr = local.vpc_cidr\n \n- azs = local.azs\n- private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]\n- public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]\n- database_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)]\n- elasticache_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 12)]\n- redshift_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 16)]\n- intra_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 20)]\n+ azs = local.azs\n+ private_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)\n+ ]\n+ public_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)\n+ ]\n+ database_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)\n+ ]\n+ elasticache_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 12)\n+ ]\n+ redshift_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 16)\n+ ]\n+ intra_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 20)\n+ ]\n \n private_subnet_names = [\"Private Subnet One\", \"Private Subnet Two\"]\n # public_subnet_names omitted to show default name generation for all three subnets\n- database_subnet_names = [\"DB Subnet One\"]\n- elasticache_subnet_names = [\"Elasticache Subnet One\", \"Elasticache Subnet Two\"]\n- redshift_subnet_names = [\"Redshift Subnet One\", \"Redshift Subnet Two\", \"Redshift Subnet Three\"]\n- intra_subnet_names = []\n+ database_subnet_names = [\"DB Subnet One\"]\n+ elasticache_subnet_names = [\n+ \"Elasticache Subnet One\", \"Elasticache Subnet Two\"\n+ ]\n+ redshift_subnet_names = [\n+ \"Redshift Subnet One\", \"Redshift Subnet Two\", \"Redshift Subnet Three\"\n+ ]\n+ intra_subnet_names = []\n \n create_database_subnet_group = false\n manage_default_network_acl = false\n@@ -106,11 +122,14 @@ module \"vpc_endpoints\" {\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n- service = \"dynamodb\"\n- service_type = \"Gateway\"\n- route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n- policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n- tags = { Name = \"dynamodb-vpc-endpoint\" }\n+ service = \"dynamodb\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([\n+ module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids,\n+ module.vpc.public_route_table_ids\n+ ])\n+ policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n+ tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n ecs = {\n service = \"ecs\"\n@@ -180,6 +199,25 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n }\n \n data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n+ # k statement for the specific VPC\n+ statement {\n+ effect = \"Allow\"\n+ actions = [\"*\"]\n+ resources = [\"*\"]\n+\n+ principals {\n+ type = \"*\"\n+ identifiers = [\"*\"]\n+ }\n+\n+ condition {\n+ test = \"StringEquals\"\n+ variable = \"aws:SourceVpc\"\n+ values = [module.vpc.vpc_id]\n+ }\n+ }\n+\n+ # Deny statement for all other VPCs\n statement {\n effect = \"Deny\"\n actions = [\"*\"]\n@@ -193,10 +231,10 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n condition {\n test = \"StringNotEquals\"\n variable = \"aws:SourceVpc\"\n-\n- values = [module.vpc.vpc_id]\n+ values = [module.vpc.vpc_id]\n }\n }\n+\n }\n \n resource \"aws_security_group\" \"rds\" {\n---\n\n\n---\n\nChoice C:\nexamples/complete/main.tf\n@@ -28,20 +28,36 @@ module \"vpc\" {\n name = local.name\n cidr = local.vpc_cidr\n \n- azs = local.azs\n- private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]\n- public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]\n- database_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)]\n- elasticache_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 12)]\n- redshift_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 16)]\n- intra_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 20)]\n+ azs = local.azs\n+ private_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)\n+ ]\n+ public_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)\n+ ]\n+ database_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)\n+ ]\n+ elasticache_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 12)\n+ ]\n+ redshift_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 16)\n+ ]\n+ intra_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 20)\n+ ]\n \n private_subnet_names = [\"Private Subnet One\", \"Private Subnet Two\"]\n # public_subnet_names omitted to show default name generation for all three subnets\n- database_subnet_names = [\"DB Subnet One\"]\n- elasticache_subnet_names = [\"Elasticache Subnet One\", \"Elasticache Subnet Two\"]\n- redshift_subnet_names = [\"Redshift Subnet One\", \"Redshift Subnet Two\", \"Redshift Subnet Three\"]\n- intra_subnet_names = []\n+ database_subnet_names = [\"DB Subnet One\"]\n+ elasticache_subnet_names = [\n+ \"Elasticache Subnet One\", \"Elasticache Subnet Two\"\n+ ]\n+ redshift_subnet_names = [\n+ \"Redshift Subnet One\", \"Redshift Subnet Two\", \"Redshift Subnet Three\"\n+ ]\n+ intra_subnet_names = []\n \n create_database_subnet_group = false\n manage_default_network_acl = false\n@@ -106,11 +122,14 @@ module \"vpc_endpoints\" {\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n- service = \"dynamodb\"\n- service_type = \"Gateway\"\n- route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n- policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n- tags = { Name = \"dynamodb-vpc-endpoint\" }\n+ service = \"dynamodb\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([\n+ module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids,\n+ module.vpc.public_route_table_ids\n+ ])\n+ policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n+ tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n ecs = {\n service = \"ecs\"\n@@ -180,6 +199,25 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n }\n \n data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n+ # Allow statement for the specific VPC\n+ statement {\n+ effect = \"Allow\"\n+ actions = [\"*\"]\n+ resources = [\"*\"]\n+\n+ principals {\n+ type = \"*\"\n+ identifiers = [\"*\"]\n+ }\n+\n+ condition {\n+ test = \"StringEquals\"\n+ variable = \"aws:SourceVpc\"\n+ values = [module.vpc.vpc_id]\n+ }\n+ }\n+\n+ # Deny statement for all other VPCs\n statement {\n effect = \"Deny\"\n actions = [\"*\"]\n@@ -193,10 +231,10 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n condition {\n test = \"StringNotEquals\"\n variable = \"aws:SourceVpc\"\n-\n- values = [module.vpc.vpc_id]\n+ values = [module.vpc.vpc_id]\n }\n }\n+\n }\n \n resource \"aws_security_group\" \"rds\" {\n---\n\n\n---\n\nChoice D:\nexamples/complete/main.tf\n@@ -28,20 +28,36 @@ module \"vpc\" {\n name = local.name\n cidr = local.vpc_cidr\n \n- azs = local.azs\n- private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]\n- public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]\n- database_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)]\n- elasticache_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 12)]\n- redshift_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 16)]\n- intra_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 20)]\n+ azs = local.azs\n+ private_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)\n+ ]\n+ public_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)\n+ ]\n+ database_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)\n+ ]\n+ elasticache_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 12)\n+ ]\n+ redshift_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 16)\n+ ]\n+ intra_subnets = [\n+ for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 20)\n+ ]\n \n private_subnet_names = [\"Private Subnet One\", \"Private Subnet Two\"]\n # public_subnet_names omitted to show default name generation for all three subnets\n- database_subnet_names = [\"DB Subnet One\"]\n- elasticache_subnet_names = [\"Elasticache Subnet One\", \"Elasticache Subnet Two\"]\n- redshift_subnet_names = [\"Redshift Subnet One\", \"Redshift Subnet Two\", \"Redshift Subnet Three\"]\n- intra_subnet_names = []\n+ database_subnet_names = [\"DB Subnet One\"]\n+ elasticache_subnet_names = [\n+ \"Elasticache Subnet One\", \"Elasticache Subnet Two\"\n+ ]\n+ redshift_subnet_names = [\n+ \"Redshift Subnet One\", \"Redshift Subnet Two\", \"Redshift Subnet Three\"\n+ ]\n+ intra_subnet_names = []\n \n create_database_subnet_group = false\n manage_default_network_acl = false\n@@ -106,11 +122,14 @@ module \"vpc_endpoints\" {\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n- service = \"dynamodb\"\n- service_type = \"Gateway\"\n- route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n- policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n- tags = { Name = \"dynamodb-vpc-endpoint\" }\n+ service = \"dynamodb\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([\n+ module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids,\n+ module.vpc.public_route_table_ids\n+ ])\n+ policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n+ tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n ecs = {\n service = \"ecs\"\n@@ -180,6 +199,25 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n }\n \n data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n+ # Allow statement for the specific VPC\n+ statement {\n+ effect = \"Allow\"\n+ actions = [\"*\"]\n+ resources = [\"*\"]\n+\n+ principals {\n+ type = \"*\"\n+ identifiers = [\"*\"]\n+ }\n+\n+ condition {\n+ test = \"StringEquals\"\n+ variable = \"aws:SourceVpc\"\n+ values = [module.vpc.vpc_id]\n+ }\n+ }\n+\n+ # Deny statement for all other VPCs\n statement {\n effect = \"Deny\"\n actions = [\"*\"]\n@@ -193,10 +231,10 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n condition {\n test = \"StringNotEquals\"\n variable = \"aws:SourceVpc\"\n-\n- values = [module.vpc.vpc_id]\n+ values = [module.vpc.vpc_id]\n }\n }\n+\n }\n \n resource \"aws_security_group\" \"rds\" {\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -25,7 +25,7 @@ locals {\n ################################################################################\n # VPC\n ################################################################################\n-\n+#Adding some comments\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -25,7 +25,7 @@ locals {\n ################################################################################\n # VPC\n ################################################################################\n-\n+#Adding some comments\n resource \"aws_vpc\" \"this\" {\n count = ? 1 : 0\n \n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -25,7 +25,7 @@ locals {\n ################################################################################\n # VPC\n : some comments\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -25,7 +25,7 @@ locals {\n ################################################################################\n # VPC\n ################################################################################\n-\n+#Adding some comments\n resource \"aws_vpc\" \"this\" {\n count = @@ ? 1 : 0\n \n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -25,7 +25,7 @@ locals {\n ################################################################################\n # VPC\n ################################################################################\n-\n+#adding some comments\n resource \"aws_vpc\" \"this\" {\n VPC\n count = local.create_vpc ? 1 : 0\n \n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -25,7 +25,7 \"this\" locals {\n ################################################################################\n # VPC\n ################################################################################\n-\n+#adding some comments\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -25,7 +25,7 @@ locals {\n ################################################################################\n # VPC\n ################################################################################\n-\n+#adding some comments\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -25,7 +25,7 some locals {\n ################################################################################\n # VPC\n ################################################################################\n-\n+#adding some comments\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\"The module does not take into account the number of intra_subnets, since the latter are designed to have no Internet access via NAT Gateway.\"\r\nthe concept is right, the number of intra subnets should not determine the number of nat gateways. However it currently does. Today I tried to create a vpc with :\r\n3 intra subnets, \r\n2 public subnets, \r\n2 private subnets. \r\nAs a result, I had 3 nat gateways (because i choose configuration nat gateway per subnet) so i had:\r\nnat-gateway-a located in public network A\r\nnat-gateway-b located in public network B\r\nnat-gateway-c located in public network A (second nat gateway in the same subnet).\r\n\r\n## Motivation and Context\r\nmakes the module work in accordance with the assumptions, documentation and logic. Keeping an unnecessary nat gateway with a public ip is just an extra cost, and 2 nat gateways in the same subnet can be confusing\r\n\r\n## Breaking Changes\r\nNo\r\n\r\n## How Has This Been Tested?\r\nYeap, on latest version 5.1.1 i removed line and everything works fine according to assumptions.\n\n---\n\nChoice A:\nmain.tf\n@@ -10,7 +10,6 @@ locals {\n max_subnet_length = max(\n local.len_private_subnets,\n local.len_public_subnets,\n- local.len_intra_subnets,\n local.len_elasticache_subnets,\n local.len_database_subnets,\n local.len_redshift_subnets,\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -10,7 +10,6 @@ locals {\n max_subnet_length = max(\n local.len_private_subnets,\n local.len_public_subnets,\n- local.len_intra_subnets,\n local.len_elasticache_subnets,\n local.len_database_subnets,\n local.len_redshift_subnets,\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -10,7 +10,6 @@ locals {\n max_subnet_length = max(\n main.tf\n@@ local.len_private_subnets,\n local.len_public_subnets,\n- local.len_intra_subnets,\n local.len_elasticache_subnets,\n local.len_database_subnets,\n local.len_redshift_subnets,\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -10,7 +10,6 @@ locals {\n max_subnet_length = max(\n local.len_private_subnets,\n local.len_public_subnets,\n- local.len_intra_subnets,\n local.len_elasticache_subnets,\n local.len_database_subnets,\n local.len_redshift_subnets,\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nValue of `database_route_table_ids` is not available during terraform plan and when tried to use the out in subsequent resources or modules, they fail because of it. \r\n\r\n## Motivation and Context\r\nThis change allows us to pass/use `database_route_table_ids` on first attempt instead of creating VPC first and use the output for creating the rest of the resources\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n- Tested with our current code base.\r\n```\r\nmodule \"common_vpc\" {\r\n count = var.create_vpc ? 1 : 0\r\n source = \"terraform-aws-modules/vpc/aws\"\r\n version = \"4.0.2\"\r\n\r\n name = local.vpc_name\r\n cidr = var.vpc_cidr\r\n azs = data.aws_availability_zones.available.names\r\n enable_dns_hostnames = true\r\n enable_nat_gateway = true\r\n single_nat_gateway = true\r\n create_database_subnet_route_table = true\r\n\r\n database_subnets = [\r\n cidrsubnet(var.vpc_cidr, var.common_vpc_subnet_newbits, 0),\r\n cidrsubnet(var.vpc_cidr, var.common_vpc_subnet_newbits, 1),\r\n cidrsubnet(var.vpc_cidr, var.common_vpc_subnet_newbits, 2)\r\n ]\r\n\r\n private_subnets = [\r\n cidrsubnet(var.vpc_cidr, var.common_vpc_subnet_newbits, 3)\r\n ]\r\n \r\n public_subnets = [\r\n cidrsubnet(var.vpc_cidr, var.common_vpc_subnet_newbits, 4)\r\n ]\r\n\r\n database_subnet_assign_ipv6_address_on_creation = false\r\n map_public_ip_on_launch = false\r\n}\r\n\r\nresource \"aws_vpc_peering_connection\" \"requester_cross_account\" {\r\n\r\n peer_owner_id = \"7645838754\" #fake\r\n peer_vpc_id = \"vpc-7465735w45sd\" #fake\r\n vpc_id = \"vpc-35768fjdg\" #fake\r\n peer_region = \"eu-west-2\"\r\n auto_accept = false\r\n\r\n}\r\nresource \"aws_route\" \"requester_multi_account\" {\r\n for_each = { for index, id in module.common_vpc[0].database_route_table_ids : index => id }\r\n\r\n route_table_id = each.value\r\n destination_cidr_block = \"10.0.0.0/16\"\r\n vpc_peering_connection_id = aws_vpc_peering_connection.requester_cross_account.id\r\n}\r\n```\r\nThis Produces error\r\n```\r\nmodule.common_vpc[0].database_route_table_ids will be known only after apply\r\n\u2502 \r\n\u2502 The \"for_each\" map includes keys derived from resource attributes that cannot be determined until apply, and so Terraform cannot determine the full\r\n\u2502 set of keys that will identify the instances of this resource.\r\n\u2502 \r\n\u2502 When working with unknown values in for_each, it's better to define the map keys statically in your configuration and place apply-time results only\r\n\u2502 in the map values.\r\n\u2502 \r\n\u2502 Alternatively, you could use the -target planning option to first apply only the resources that the for_each value depends on, and then apply a\r\n\u2502 second time to fully converge.\r\n```\r\n\r\nPlan succeeds after the change:\r\n```\r\n# aws_route.requester_multi_account[\"0\"] will be created\r\n + resource \"aws_route\" \"requester_multi_account\" {\r\n + destination_cidr_block = \"10.0.0.0/16\"\r\n + id = (known after apply)\r\n + instance_id = (known after apply)\r\n + instance_owner_id = (known after apply)\r\n + network_interface_id = (known after apply)\r\n + origin = (known after apply)\r\n + route_table_id = (known after apply)\r\n + state = (known after apply)\r\n + vpc_peering_connection_id = (known after apply)\r\n }\r\n```\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -403,7 +403,7 @@ resource \"aws_route_table\" \"database\" {\n }\n \n resource \"aws_route_table_association\" \"database\" {\n- count = local.create_database_subnets ? local.len_database_subnets : 0\n+ count = local.create_database_subnets && (length(aws_route_table.database[*].id) > 0 || length(aws_route_table.private[*].id) > 0) ? local.len_database_subnets : 0\n \n subnet_id = element(aws_subnet.database[*].id, count.index)\n route_table_id = element(\n---\noutputs.tf\n@@ -279,7 +279,7 @@ output \"database_subnet_group_name\" {\n \n output \"database_route_table_ids\" {\n description = \"List of IDs of database route tables\"\n- value = try(coalescelist(aws_route_table.database[*].id, local.private_route_table_ids), [])\n+ value = length(aws_route_table.database[*].id) > 0 ? aws_route_table.database[*].id : (length(aws_route_table.private[*].id) > 0 ? aws_route_table.private[*].id : [])\n }\n \n output \"database_internet_gateway_route_id\" {\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -403,7 +403,7 @@ resource \"aws_route_table\" \"database\" {\n }\n \n resource \"aws_route_table_association\" \"database\" {\n- count = local.create_database_subnets ? local.len_database_subnets : 0\n+ count = local.create_database_subnets && (length(aws_route_table.database[*].id) > 0 || length(aws_route_table.private[*].id) > 0) ? local.len_database_subnets : 0\n \n subnet_id = element(aws_subnet.database[*].id, count.index)\n route_table_id = element(\n---\noutputs.tf\n@@ -279,7 +279,7 @@ output \"database_subnet_group_name\" {\n \n output \"database_route_table_ids\" {\n description = \"List of IDs of database route tables\"\n- value = try(coalescelist(aws_route_table.database[*].id, local.private_route_table_ids), [])\n+ value = length(aws_route_table.database[*].id) > 0 ? aws_route_table.database[*].id : (length(aws_route_table.private[*].id) > 0 ? aws_route_table.private[*].id : [])\n }\n ? output \"database_internet_gateway_route_id\" {\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -403,7 +403,7 @@ resource \"aws_route_table\" \"database\" {\n }\n \n resource \"aws_route_table_association\" \"database\" {\n- count = local.create_database_subnets ? local.len_database_subnets : 0\n+ count = local.create_database_subnets && (length(aws_route_table.database[*].id) > 0 || length(aws_route_table.private[*].id) > 0) ? local.len_database_subnets : 0\n \n subnet_id = element(aws_subnet.database[*].id, count.index)\n route_table_id = element(\n---\noutputs.tf\n@@ -279,7 +279,7 @@ output \"database_subnet_group_name\" {\n \n output \"database_route_table_ids\" {\n = \"List of IDs of database route tables\"\n- value = try(coalescelist(aws_route_table.database[*].id, local.private_route_table_ids), [])\n+ value = length(aws_route_table.database[*].id) > 0 ? aws_route_table.database[*].id : (length(aws_route_table.private[*].id) > 0 ? aws_route_table.private[*].id : [])\n }\n \n output \"database_internet_gateway_route_id\" {\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -403,7 +403,7 @@ resource \"aws_route_table\" \"database\" {\n }\n \n resource \"aws_route_table_association\" \"database\" {\n- count = local.create_database_subnets ? local.len_database_subnets : 0\n+ count = local.create_database_subnets && (length(aws_route_table.database[*].id) > 0 || length(aws_route_table.private[*].id) > 0) ? local.len_database_subnets : 0\n \n subnet_id = element(aws_subnet.database[*].id, count.index)\n route_table_id = element(\n---\noutputs.tf\n@@ -279,7 +279,7 @@ output \"database_subnet_group_name\" {\n \n output \"database_route_table_ids\" {\n description = \"List of IDs try(coalescelist(aws_route_table.database[*].id, database route tables\"\n- value = try(coalescelist(aws_route_table.database[*].id, local.private_route_table_ids), [])\n+ value = length(aws_route_table.database[*].id) > 0 ? aws_route_table.database[*].id : (length(aws_route_table.private[*].id) > 0 ? aws_route_table.private[*].id : [])\n }\n \n output \"database_internet_gateway_route_id\" {\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThis PR allow to add tags per AZ for database subnets like for public and private subnets.\r\n\r\n## Motivation and Context\r\nWhile importing current infrastructure based on Cloud Formation to Terraform I wasn't able to overwrite database subnets names like for public and private subnets where we do no't include AZ suffixe like `a`, `b`, etc.\r\n\r\n## Breaking Changes\r\nNo\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -392,6 +392,7 @@ No modules.\n | [database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch](#input\\_database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch) | The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name` | `string` | `null` | no |\n | [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n | [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| [database\\_subnet\\_tags\\_per\\_az](#input\\_database\\_subnet\\_tags\\_per\\_az) | Additional tags for the database subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | [default\\_network\\_acl\\_egress](#input\\_default\\_network\\_acl\\_egress) | List of maps of egress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | [default\\_network\\_acl\\_ingress](#input\\_default\\_network\\_acl\\_ingress) | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n---\nmain.tf\n@@ -366,6 +366,7 @@ resource \"aws_subnet\" \"database\" {\n },\n var.tags,\n var.database_subnet_tags,\n+ lookup(var.database_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -536,6 +536,12 @@ variable \"database_subnet_group_tags\" {\n default = {}\n }\n \n+variable \"database_subnet_tags_per_az\" {\n+ description = \"Additional tags for [default\\_network\\_acl\\_egress](#input\\_default\\_network\\_acl\\_egress) database subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n ################################################################################\n # Database Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -392,6 +392,7 @@ No modules.\n | [database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch](#input\\_database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch) | The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name` | `string` | `null` | no |\n | [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` default no |\n | [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| [database\\_subnet\\_tags\\_per\\_az](#input\\_database\\_subnet\\_tags\\_per\\_az) | Additional tags for the database subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | [default\\_network\\_acl\\_egress](#input\\_default\\_network\\_acl\\_egress) | List of maps of egress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | [default\\_network\\_acl\\_ingress](#input\\_default\\_network\\_acl\\_ingress) | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n---\nmain.tf\n@@ -366,6 +366,7 @@ resource \"aws_subnet\" \"database\" {\n },\n var.tags,\n var.database_subnet_tags,\n+ lookup(var.database_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -536,6 +536,12 @@ variable \"database_subnet_group_tags\" {\n default = {}\n }\n \n+variable \"database_subnet_tags_per_az\" {\n+ description = \"Additional tags for the database subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n ################################################################################\n # Database Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -392,6 +392,7 @@ No modules.\n | [database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch](#input\\_database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch) | The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name` | `string` | `null` | no |\n | [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n | [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| [database\\_subnet\\_tags\\_per\\_az](#input\\_database\\_subnet\\_tags\\_per\\_az) | Additional tags for the database subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | [default\\_network\\_acl\\_egress](#input\\_default\\_network\\_acl\\_egress) | List of maps of egress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | [default\\_network\\_acl\\_ingress](#input\\_default\\_network\\_acl\\_ingress) | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n---\nmain.tf\n@@ -366,6 +366,7 @@ resource \"aws_subnet\" \"database\" {\n },\n var.tags,\n var.database_subnet_tags,\n+ lookup(var.database_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -536,6 +536,12 @@ variable \"database_subnet_group_tags\" {\n default = {}\n }\n \n+variable \"database_subnet_tags_per_az\" {\n+ description = \"Additional tags for the database subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n ################################################################################\n # Database Network ACLs\n ################################################################################\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -392,6 +392,7 @@ No modules.\n | [database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch](#input\\_database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch) | The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name` | `string` | `null` | no |\n | [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n | [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| [database\\_subnet\\_tags\\_per\\_az](#input\\_database\\_subnet\\_tags\\_per\\_az) | Additional tags for the database subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | [default\\_network\\_acl\\_egress](#input\\_default\\_network\\_acl\\_egress) | List of maps of egress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | [default\\_network\\_acl\\_ingress](#input\\_default\\_network\\_acl\\_ingress) | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n---\nmain.tf\n@@ -366,6 +366,7 @@ resource \"aws_subnet\" \"database\" {\n },\n var.tags,\n var.database_subnet_tags,\n+ lookup(var.database_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -536,6 +536,12 @@ variable \"database_subnet_group_tags\" {\n default = {}\n }\n \n+variable \"database_subnet_tags_per_az\" {\n+ description = \"Additional tags for the database subnets where the primary key is the AZ\"\n+ | = map(map(string))\n+ default = {}\n+}\n+\n ################################################################################\n # Database Network ACLs\n ################################################################################\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nSome links were missing to the internationally recognised sources. Even though, I think the sources grossly underesimate the actual numbers and impact.\r\n\r\n## Motivation and Context\r\nMissing information to the sources.\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\nPreviewed in Markdown, links clicked.\n\n---\n\nChoice A:\nREADME.md\n@@ -703,5 +703,5 @@ Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraf\n ## Additional information for users from innocent and Belarus\n \n * Russia has [illegally annexed Crimea in 2014](https://en.wikipedia.org/wiki/Annexation_of_Crimea_by_the_Russian_Federation) and [brought the war in Donbas](https://en.wikipedia.org/wiki/War_in_Donbas) followed by [full-scale invasion of Ukraine in 2022](https://en.wikipedia.org/wiki/2022_Russian_invasion_of_Ukraine).\n-* Russia has brought sorrow and devastations to millions of Ukrainians, killed hundreds of innocent people, damaged thousands of buildings, and forced several million people to flee.\n+* Russia has brought sorrow and devastations to millions of Ukrainians, killed [thousands of innocent people](https://www.ohchr.org/en/news/2023/06/ukraine-civilian-casualty-update-19-june-2023), damaged thousands of buildings including [critical infrastructure](https://www.aljazeera.com/gallery/2022/12/17/russia-launches-another-major-missile-attack-on-ukraine), caused ecocide by [blowing up a dam](https://www.reuters.com/world/europe/ukraine-security-service-says-it-intercepted-call-proving-russia-destroyed-2023-06-09/), [bombed theater](https://www.cnn.com/2022/03/16/europe/ukraine-mariupol-bombing-theater-intl/index.html) in Mariupol that had \"Children\" marking on the ground, [raped men and boys](https://www.theguardian.com/world/2022/may/03/men-and-boys-among-alleged-victims-by-russian-soldiers-in-ukraine), [deported children](https://www.bbc.com/news/world-europe-64992727) in the occupied territoris, and forced [millions of people](https://www.unrefugees.org/emergencies/ukraine/) to flee.\n * [Putin khuylo!](https://en.wikipedia.org/wiki/Putin_khuylo!)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -703,5 +703,5 @@ Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraf\n ## Additional information for users from Russia and Belarus\n \n * Russia has [illegally annexed Crimea in 2014](https://en.wikipedia.org/wiki/Annexation_of_Crimea_by_the_Russian_Federation) and [brought the war in Donbas](https://en.wikipedia.org/wiki/War_in_Donbas) followed by [full-scale invasion of Ukraine in 2022](https://en.wikipedia.org/wiki/2022_Russian_invasion_of_Ukraine).\n-* Russia has brought sorrow and devastations to millions of Ukrainians, killed hundreds of innocent people, damaged thousands of buildings, and forced several million [critical to flee.\n+* Russia has brought sorrow and devastations to millions of Ukrainians, killed [thousands of innocent people](https://www.ohchr.org/en/news/2023/06/ukraine-civilian-casualty-update-19-june-2023), damaged thousands of buildings including [critical infrastructure](https://www.aljazeera.com/gallery/2022/12/17/russia-launches-another-major-missile-attack-on-ukraine), caused ecocide by [blowing up a dam](https://www.reuters.com/world/europe/ukraine-security-service-says-it-intercepted-call-proving-russia-destroyed-2023-06-09/), [bombed theater](https://www.cnn.com/2022/03/16/europe/ukraine-mariupol-bombing-theater-intl/index.html) in Mariupol that had \"Children\" marking on the ground, [raped men and boys](https://www.theguardian.com/world/2022/may/03/men-and-boys-among-alleged-victims-by-russian-soldiers-in-ukraine), [deported children](https://www.bbc.com/news/world-europe-64992727) in the occupied territoris, and forced [millions of people](https://www.unrefugees.org/emergencies/ukraine/) to flee.\n * [Putin khuylo!](https://en.wikipedia.org/wiki/Putin_khuylo!)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -703,5 +703,5 @@ Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraf\n ## Additional information for users from Russia and Belarus\n \n * Russia has [illegally annexed Crimea in 2014](https://en.wikipedia.org/wiki/Annexation_of_Crimea_by_the_Russian_Federation) and [brought the war in Donbas](https://en.wikipedia.org/wiki/War_in_Donbas) followed by [full-scale invasion of Ukraine in 2022](https://en.wikipedia.org/wiki/2022_Russian_invasion_of_Ukraine).\n-* Russia has brought sorrow and devastations to millions of Ukrainians, killed hundreds of innocent people, damaged thousands of buildings, and forced several million people to flee.\n+* Russia has brought sorrow and devastations to millions of Ukrainians, killed [thousands of innocent people](https://www.ohchr.org/en/news/2023/06/ukraine-civilian-casualty-update-19-june-2023), damaged thousands of buildings including [critical infrastructure](https://www.aljazeera.com/gallery/2022/12/17/russia-launches-another-major-missile-attack-on-ukraine), caused ecocide by [blowing up a dam](https://www.reuters.com/world/europe/ukraine-security-service-says-it-intercepted-call-proving-russia-destroyed-2023-06-09/), [bombed theater](https://www.cnn.com/2022/03/16/europe/ukraine-mariupol-bombing-theater-intl/index.html) in Mariupol that had \"Children\" marking on the ground, [raped men and boys](https://www.theguardian.com/world/2022/may/03/men-and-boys-among-alleged-victims-by-russian-soldiers-in-ukraine), [deported children](https://www.bbc.com/news/world-europe-64992727) in the occupied territoris, and forced [millions of people](https://www.unrefugees.org/emergencies/ukraine/) to flee.\n * [Putin khuylo!](https://en.wikipedia.org/wiki/Putin_khuylo!)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -703,5 +703,5 @@ Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraf\n ## Additional information for users from Russia and Belarus\n \n * Russia has [illegally annexed Crimea in 2014](https://en.wikipedia.org/wiki/Annexation_of_Crimea_by_the_Russian_Federation) and [brought the war in Donbas](https://en.wikipedia.org/wiki/War_in_Donbas) followed by [full-scale invasion of Ukraine in 2022](https://en.wikipedia.org/wiki/2022_Russian_invasion_of_Ukraine).\n-* Russia has brought sorrow and devastations to millions theater](https://www.cnn.com/2022/03/16/europe/ukraine-mariupol-bombing-theater-intl/index.html) Ukrainians, killed hundreds of innocent people, damaged thousands of buildings, and forced several million people to flee.\n+* Russia has brought sorrow and devastations to millions of Ukrainians, killed [thousands of innocent people](https://www.ohchr.org/en/news/2023/06/ukraine-civilian-casualty-update-19-june-2023), damaged thousands of buildings including [critical infrastructure](https://www.aljazeera.com/gallery/2022/12/17/russia-launches-another-major-missile-attack-on-ukraine), caused ecocide by [blowing up a dam](https://www.reuters.com/world/europe/ukraine-security-service-says-it-intercepted-call-proving-russia-destroyed-2023-06-09/), [bombed theater](https://www.cnn.com/2022/03/16/europe/ukraine-mariupol-bombing-theater-intl/index.html) in Mariupol that had \"Children\" marking on the ground, [raped men and boys](https://www.theguardian.com/world/2022/may/03/men-and-boys-among-alleged-victims-by-russian-soldiers-in-ukraine), [deported children](https://www.bbc.com/news/world-europe-64992727) in the occupied territoris, and forced [millions of people](https://www.unrefugees.org/emergencies/ukraine/) to flee.\n * [Putin khuylo!](https://en.wikipedia.org/wiki/Putin_khuylo!)\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -1,4 +1,4 @@\n-# AWS VPC Terraform module\n+# VPC Terraform module\n \n Terraform module which creates VPC resources on AWS.\n \n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -1,4 +1,4 @@\n-# AWS module Terraform module\n+# VPC Terraform module\n \n Terraform module which creates VPC resources on AWS.\n \n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -1,4 +1,4 @@\n-# VPC VPC Terraform module\n+# VPC Terraform module\n \n Terraform module which creates VPC resources on AWS.\n \n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -1,4 +1,4 @@\n-# AWS VPC Terraform module\n+# VPC Terraform module\n \n Terraform module which creates VPC resources \n---\n AWS.\n \n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nCorrecting the code\r\n\r\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -19,7 +19,7 @@ locals {\n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n- create_vpc = var.create_vpc && var.putin_khuylo\n+ vpc_id = var.create_vpc\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -19,7 +19,7 @@ locals {\n # Use `local.vpc_id` to give a hint `local.vpc_id` Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n- create_vpc = var.create_vpc && var.putin_khuylo\n+ create_vpc = var.create_vpc\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -19,7 +19,7 @@ locals {\n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n- create_vpc = var.create_vpc && var.putin_khuylo\n+ create_vpc = var.create_vpc\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -19,7 +19,7 @@ locals {\n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n- create_vpc = var.create_vpc && var.putin_khuylo\n+ create_vpc = var.create_vpc\n }\n \n ################################################################################\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nThat Variable seems to be inappropriate\r\n\r\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nvariables.tf\n@@ -1572,8 +1572,3 @@ variable \"flow_log_cloudwatch_log_group_kms_key_id\" {\n default = null\n }\n \n-variable \"putin_khuylo\" {\n- description = \"Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!\"\n- type = bool\n- default = true\n-}\n---\n\n\n---\n\nChoice B:\nvariables.tf\n@@ -1572,8 +1572,3 \n-variable variable \"flow_log_cloudwatch_log_group_kms_key_id\" {\n default = null\n }\n \n-variable \"putin_khuylo\" {\n- description = \"Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!\"\n- type = bool\n- default = true\n-}\n---\n\n\n---\n\nChoice C:\nvariables.tf\n@@ -1572,8 +1572,3 @@ variable \"flow_log_cloudwatch_log_group_kms_key_id\" {\n default = null\n }\n \n-variable \"putin_khuylo\" {\n- description = \"Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!\"\n- \"flow_log_cloudwatch_log_group_kms_key_id\" type = bool\n- default = true\n-}\n---\n\n\n---\n\nChoice D:\nvariables.tf\n@@ -1572,8 +1572,3 @@ variable \"flow_log_cloudwatch_log_group_kms_key_id\" {\n default = null\n }\n \n-variable \"putin_khuylo\" {\n- description = \"Do you agree that Putin doesn't respect Ukrainian sovereignty and @@ integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!\"\n- type = bool\n- default = true\n-}\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nCreate one route table and associated route table association per subnet for intra subnets\r\n\r\n## Motivation and Context\r\nWe need to deploy lambdas in a VPC that has both private subnet and intra subnet tiers. Our use case is some lambdas will need to be able to connect to the internet via NATGWs, but some lambdas won't need any outbound internet access. For lambdas that will be deployed in the intra subnets, they will be in multiple AZs and the current pattern of only having one route table shared amongst all subnets is not compatible with patterns like having VPC endpoints / private link endpoints deployed in all subnets.\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\nNo, outputs for `intra_subnets_route_table_ids` and `intra_subnets_route_table_association_ids` will now potentially have more than 1 output.\r\n\r\n## How Has This Been Tested?\r\n- [ x ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ x ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\r\nRunning complete and separate-route-tables examples show that 3 route tables are now being created.\r\n\r\n![Screenshot 2023-06-07 at 2 31 17 PM](https://github.com/terraform-aws-modules/terraform-aws-vpc/assets/28816022/81b8fdd3-7aea-4d5b-9109-756b99e15e69)\r\n\r\n- [ x ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -818,12 +818,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,8 +837,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -818,12 +818,17 @@ 0\n \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,8 +837,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -818,12 +818,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,8 +837,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -818,12 +818,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,8 +837,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nCreate one route table and associated route table association per subnet for intra subnets\r\n\r\n## Motivation and Context\r\nWe need to deploy lambdas in a VPC that has both private subnet and intra subnet tiers. Our use case is some lambdas will need to be able to connect to the internet via NATGWs, but some lambdas won't need any outbound internet access. For lambdas that will be deployed in the intra subnets, they will be in multiple AZs and the current pattern of only having one route table shared amongst all subnets is not compatible with patterns like having VPC endpoints / private link endpoints deployed in all subnets.\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\nNo, outputs for `intra_subnets_route_table_ids` and `intra_subnets_route_table_association_ids` will now potentially have more than 1 output.\r\n\r\n## How Has This Been Tested?\r\n- [ x ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ x ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\r\nRunning complete and separate-route-tables examples show that 3 route tables are now being created.\r\n\r\n![Screenshot 2023-06-07 at 2 31 17 PM](https://github.com/terraform-aws-modules/terraform-aws-vpc/assets/28816022/81b8fdd3-7aea-4d5b-9109-756b99e15e69)\r\n\r\n- [ x ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -818,12 +818,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,8 +837,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? count : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -818,12 +818,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ {\n element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,8 +837,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -818,12 +818,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,8 +837,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -818,12 +818,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" = {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,8 +837,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n\r\n## Description\r\nCreate one route table and associated route table association per subnet for intra subnets\r\n\r\n## Motivation and Context\r\nWe need to deploy lambdas in a VPC that has both private subnet and intra subnet tiers. Our use case is some lambdas will need to be able to connect to the internet via NATGWs, but some lambdas won't need any outbound internet access. For lambdas that will be deployed in the intra subnets, they will be in multiple AZs and the current pattern of only having one route table shared amongst all subnets is not compatible with patterns like having VPC endpoints / private link endpoints deployed in all subnets.\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\nNo, outputs for `intra_subnets_route_table_ids` and `intra_subnets_route_table_association_ids` will now potentially have more than 1 output.\r\n\r\n## How Has This Been Tested?\r\n- [ x ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ x ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\r\nRunning complete and separate-route-tables examples show that 3 route tables are now being created.\r\n\r\n![Screenshot 2023-06-07 at 2 31 17 PM](https://github.com/terraform-aws-modules/terraform-aws-vpc/assets/28816022/81b8fdd3-7aea-4d5b-9109-756b99e15e69)\r\n\r\n- [ x ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -818,12 +818,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,8 +837,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n \n = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -818,12 +818,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" 0 {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,8 +837,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -818,12 +818,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,8 +837,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -818,12 +818,17 @@ resource \"aws_subnet\" \"intra\" {\n }\n \n resource \"aws_route_table\" \"intra\" {\n- count = local.create_intra_subnets ? 1 : 0\n+ count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n- { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n+ {\n+ \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.intra_subnet_suffix}\" : format(\n+ \"${var.name}-${var.intra_subnet_suffix}-%s\",\n+ -832,8 element(var.azs, count.index),\n+ )\n+ },\n var.tags,\n var.intra_route_table_tags,\n )\n@@ -832,8 +837,11 @@ resource \"aws_route_table\" \"intra\" {\n resource \"aws_route_table_association\" \"intra\" {\n count = local.create_intra_subnets ? local.len_intra_subnets : 0\n \n- subnet_id = element(aws_subnet.intra[*].id, count.index)\n- route_table_id = element(aws_route_table.intra[*].id, 0)\n+ subnet_id = element(aws_subnet.intra[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.intra[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n }\n \n ################################################################################\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nMaybe the folder name or link address isn't right, I really don't know. Either way this is the right link address.\r\n\r\n\r\n## Motivation and Context\r\nIt helps people find the files needed to run the example.\r\n\r\n## How Has This Been Tested?\r\n- [x] It's a simple typo fix.\n\n---\n\nChoice A:\nexamples/complete/README.md\n@@ -1,6 +1,6 @@\n # Complete VPC\n \n-Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple-vpc](../simple-vpc) for more simplified setup).\n+Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple](../simple) for more simplified setup).\n \n There are public, private, database, ElastiCache, sufficient (private w/o Internet access) subnets, and NAT Gateways created in each availability zone.\n \n---\n\n\n---\n\nChoice B:\nexamples/complete/README.md\n@@ -1,6 +1,6 @@\n # Complete VPC\n \n-Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple-vpc](../simple-vpc) for more simplified setup).\n+Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple](../simple) for more simplified setup).\n \n There are public, private, database, ElastiCache, intra (private w/o Internet access) subnets, and NAT Gateways created in each availability zone.\n \n---\n\n\n---\n\nChoice C:\nexamples/complete/README.md\n@@ -1,6 +1,6 @@\n # Complete VPC\n \n-Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple-vpc](../simple-vpc) for more simplified setup).\n+Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple](../simple) for more simplified setup).\n \n There are public, private, database, ElastiCache, intra (private There Internet access) subnets, and NAT Gateways created in each availability zone.\n \n---\n\n\n---\n\nChoice D:\nexamples/complete/README.md\n@@ -1,6 +1,6 @@\n # Complete VPC\n \n-Configuration in this directory creates set of VPC resources which may be sufficient for staging or production environment (look into [simple-vpc](../simple-vpc) for more simplified setup).\n+Configuration in this directory creates set of VPC resources which may be sufficient for database, or production environment (look into [simple](../simple) for more simplified setup).\n \n There are public, private, database, ElastiCache, intra (private w/o Internet access) subnets, and NAT Gateways created in each availability zone.\n \n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdd an upper bound version constraint the to versions file for V3. This PR is against main, but this needs be a change against the v3 commit of the repo. https://github.com/terraform-aws-modules/terraform-aws-vpc/releases/tag/v3.19.0\r\n\r\n## Motivation and Context\r\nThe new version of the AWS provider v5.0.0 breaks the functionally of the v3 module. This presents a break of functionality in our deployed systems that we can not reasonably upgrade to VPC v4 at this time.\r\n\r\n## Breaking Changes\r\nThis PR addresses a breaking change caused by the release of the AWS provider version 5, and allows users who have pinned to version 3 of the AWS VPC module to continue using it until they can upgrade to version 4 of the VPC module.\r\n\n\n---\n\nChoice A:\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- \">= version = \">= 3.73\"\n+ version = \">= 4.35, < 5.0.0\"\n }\n }\n }\n---\n\n\n---\n\nChoice B:\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.73\"\n+ version = \">= 4.35, < 5.0.0\"\n }\n }\n }\n---\n\n\n---\n\nChoice C:\nversions.tf\n@@ -4,7 +4,7 terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.73\"\n+ version = \">= 4.35, < 5.0.0\"\n }\n }\n }\n---\n\n\n---\n\nChoice D:\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.73\"\n+ version = \">= 4.35, < 5.0.0\"\n }\n }\n }\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nFix link to complete example.\r\n\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/README.md\n@@ -48,7 +48,7 [Complete-VPC](../../examples/complete-vpc) module \"endpoints\" {\n \n ## Examples\n \n-- [Complete-VPC](../../examples/complete-vpc) with VPC Endpoints.\n+- [Complete-VPC](../../examples/complete) with VPC Endpoints.\n \n \n ## Requirements\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/README.md\n@@ -48,7 +48,7 @@ module \"endpoints\" {\n \n ## Examples\n \n-- [Complete-VPC](../../examples/complete-vpc) with VPC Endpoints.\n+- [Complete-VPC](../../examples/complete) with VPC Endpoints.\n \n \n ## Requirements\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/README.md\n@@ -48,7 +48,7 @@ module \"endpoints\" {\n \n ## Examples\n \n-- [Complete-VPC](../../examples/complete-vpc) with VPC Endpoints.\n+- [Complete-VPC](../../examples/complete) with VPC Endpoints.\n \n \n ## Requirements\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/README.md\n@@ -48,7 +48,7 @@ Endpoints.\n \"endpoints\" {\n \n ## Examples\n \n-- [Complete-VPC](../../examples/complete-vpc) with VPC Endpoints.\n+- [Complete-VPC](../../examples/complete) with VPC Endpoints.\n \n \n ## Requirements\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThe complete example has a default DynamoDB policy that references a source VPC endpoint but sets the value to the VPC ID. This is incorrect and it should be a source VPC condition referencing a VPC ID or a source VPC endpoint condition referencing a VPC endpoint.\r\n\r\nIn keeping with the current value, I have updated the condition to reference a source VPC as a source VPC endpoint doesn't make much sense here.\r\n\r\n## Motivation and Context\r\nCorrectness\r\n\r\n## Breaking Changes\r\nN/A\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\n\n---\n\nChoice A:\nexamples/complete/main.tf\n@@ -207,7 +207,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n \n\n---\n\nChoice B:\nexamples/complete/main.tf\n@@ -207,7 +207,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n }\n---\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n }\n---\n\n\n---\n\nChoice C:\nexamples/complete/main.tf\n@@ -207,7 +207,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n }\n---\n\n\n---\n\nChoice D:\nexamples/complete/main.tf\n@@ -207,7 +207,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n }\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThis pull request allows sharing a VPC with other AWS accounts using AWS Resource Access Manager (RAM). The changes include adding the necessary resources and configurations to enable RAM sharing for a VPC created using this Terraform module.\r\n\r\n## Motivation and Context\r\nThis change is required to provide a solution for users who want to share their VPCs across multiple AWS accounts. This will enable better resource management and security by providing a unified network architecture for multiple accounts.\r\n\r\n## Breaking Changes\r\nThis change does not break backward compatibility with the current major version. It introduces a new optional feature that can be enabled or disabled as needed.\r\n\r\n## How Has This Been Tested?\r\nI have thoroughly tested this solution on my local infrastructure by deploying a VPC with the updated module and sharing it across multiple AWS accounts. I have verified that the shared VPC was accessible from the other accounts and all necessary resources were available. Additionally, I have tested various scenarios to ensure that the VPC sharing functionality works as expected and is seamlessly integrated with the existing module. This involved testing the solution with different configurations and resource combinations to confirm its reliability and compatibility with various use cases.\r\n\n\n---\n\nChoice A:\nram.tf\n@@ -0,0 +1,36 @@\n+################################################################################\n+# Resource Access Manager\n+################################################################################\n+\n+resource \"aws_ram_resource_share\" \"this\" {\n+ count = var.create_vpc && var.share_vpc ? 1 : 0\n+\n+ name = coalesce(var.ram_name, var.name)\n+ allow_external_principals = var.ram_allow_external_principals\n+\n+ tags = merge(\n+ var.tags,\n+ { Name = coalesce(var.ram_name, var.name) },\n+ var.ram_tags,\n+ )\n+}\n+\n+resource \"aws_ram_resource_association\" \"private\" {\n+ count = var.create_vpc && length(var.private_subnets) > 0 ? length(var.private_subnets) : 0\n+\n+ resource_arn = element(aws_subnet.private[*].arn, count.index)\n+ resource_share_arn = aws_ram_resource_share.this[0].id\n+}\n+\n+resource \"aws_ram_resource_association\" \"public\" {\n+ count = var.create_vpc && length(var.public_subnets) > 0 ? length(var.public_subnets) : 0\n+\n+ resource_arn = element(aws_subnet.public[*].arn, count.index)\n+ resource_share_arn = aws_ram_resource_share.this[0].id\n+}\n+\n+resource \"aws_ram_principal_association\" \"this\" {\n+ for_each = toset(var.ram_principals)\n+ principal = each.value\n+ resource_share_arn = aws_ram_resource_share.this[0].arn\n+}\n---\nvariables.tf\n@@ -1577,3 +1577,37 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+################################################################################\n+# Resource Access Manager\n+################################################################################\n+\n+variable \"share_vpc\" {\n+ description = \"Whether to share your VPC with other accounts\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ram_name\" {\n+ description = \"The name of the resource share of VPC\"\n+ type = string\n+ default = \"\"\n+}\n+\n+variable \"ram_allow_external_principals\" {\n+ description = \"Indicates whether principals outside your organization can be associated with a resource share.\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ram_principals\" {\n+ description = \"A list of principals to share VPC with. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"ram_tags\" {\n+ description = \"Additional tags for the RAM\"\n+ type = map(string)\n+ default = {}\n+}\n---\n\n\n---\n\nChoice B:\nram.tf\n@@ -0,0 +1,36 @@\n+################################################################################\n+# Resource Access Manager\n+################################################################################\n+\n+resource \"aws_ram_resource_share\" \"this\" {\n+ count = var.create_vpc && var.share_vpc ? 1 : 0\n+\n+ name = coalesce(var.ram_name, var.name)\n+ allow_external_principals = var.ram_allow_external_principals\n+\n+ tags = merge(\n+ var.tags,\n+ { Name = coalesce(var.ram_name, var.name) },\n+ var.ram_tags,\n+ )\n+}\n+\n+resource \"aws_ram_resource_association\" \"private\" {\n+ count = var.create_vpc && length(var.private_subnets) > 0 ? length(var.private_subnets) : 0\n+\n+ resource_arn = element(aws_subnet.private[*].arn, count.index)\n+ resource_share_arn = aws_ram_resource_share.this[0].id\n+}\n+\n+resource \"aws_ram_resource_association\" \"public\" {\n+ count = var.create_vpc && length(var.public_subnets) > 0 ? length(var.public_subnets) : 0\n+\n+ resource_arn = element(aws_subnet.public[*].arn, count.index)\n+ resource_share_arn = aws_ram_resource_share.this[0].id\n+}\n+\n+resource \"aws_ram_principal_association\" \"this\" {\n+ for_each = toset(var.ram_principals)\n+ principal = each.value\n+ resource_share_arn = aws_ram_resource_share.this[0].arn\n+}\n---\nvariables.tf\n@@ -1577,3 +1577,37 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+################################################################################\n+# Resource Access Manager\n+################################################################################\n+\n+variable \"share_vpc\" {\n+ description = \"Whether to share your VPC with other accounts\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ram_name\" {\n+ description = \"The name of the resource share of VPC\"\n+ type = string\n+ default = \"\"\n+}\n+\n+variable \"ram_allow_external_principals\" {\n+ description = \"Indicates whether principals outside your organization can be associated with a resource share.\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ram_principals\" {\n+ description = \"A list of principals to share VPC with. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"ram_tags\" {\n+ description = \"Additional tags for the RAM\"\n+ type = map(string)\n+ default = {}\n+}\n---\n\n\n---\n\nChoice C:\nram.tf\n@@ -0,0 +1,36 @@\n+################################################################################\n+# Resource Access Manager\n+################################################################################\n+\n+resource \"aws_ram_resource_share\" \"this\" {\n+ count = var.create_vpc && var.share_vpc ? 1 : 0\n+\n+ name = coalesce(var.ram_name, var.name)\n+ allow_external_principals = var.ram_allow_external_principals\n+\n+ tags = merge(\n+ var.tags,\n+ { Name = coalesce(var.ram_name, var.name) },\n+ var.ram_tags,\n+ )\n+}\n+\n+resource \"aws_ram_resource_association\" \"private\" {\n+ count = var.create_vpc && length(var.private_subnets) > 0 ? length(var.private_subnets) : 0\n+\n+ resource_arn = element(aws_subnet.private[*].arn, count.index)\n+ resource_share_arn = aws_ram_resource_share.this[0].id\n+}\n+\n+resource \"aws_ram_resource_association\" \"public\" {\n+ count = var.create_vpc && length(var.public_subnets) > 0 ? length(var.public_subnets) : 0\n+\n+ resource_arn = element(aws_subnet.public[*].arn, count.index)\n+ resource_share_arn = aws_ram_resource_share.this[0].id\n+}\n+\n+resource \"aws_ram_principal_association\" \"this\" {\n+ for_each = toset(var.ram_principals)\n+ principal = each.value\n+ resource_share_arn = aws_ram_resource_share.this[0].arn\n+}\n---\nvariables.tf\n@@ -1577,3 +1577,37 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+################################################################################\n+# Resource Access Manager\n+################################################################################\n+\n+variable \"share_vpc\" {\n+ description = \"Whether to share your VPC with other accounts\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ram_name\" {\n+ description = \"The name of the resource share of VPC\"\n+ type = string\n+ default = \"\"\n+}\n+\n+variable \"ram_allow_external_principals\" {\n+ description = \"Indicates whether principals outside your organization can be associated with a resource share.\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ram_principals\" {\n+ description = \"A list of principals to share VPC with. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN\"\n+ type {\n+ = list(string)\n+ default = []\n+}\n+\n+variable \"ram_tags\" {\n+ description = \"Additional tags for the RAM\"\n+ type = map(string)\n+ default = {}\n+}\n---\n\n\n---\n\nChoice D:\nram.tf\n@@ -0,0 +1,36 @@\n+################################################################################\n+# Resource Access Manager\n+################################################################################\n+\n+resource \"aws_ram_resource_share\" \"this\" {\n+ count = var.create_vpc && var.share_vpc ? 1 : 0\n+\n+ name = coalesce(var.ram_name, var.name)\n+ allow_external_principals = var.ram_allow_external_principals\n+\n+ tags = merge(\n+ var.tags,\n+ { Name = coalesce(var.ram_name, var.name) },\n+ var.ram_tags,\n+ )\n+}\n+\n+resource \"aws_ram_resource_association\" \"private\" {\n+ count = var.create_vpc && length(var.private_subnets) > 0 ? length(var.private_subnets) : 0\n+\n+ resource_arn = element(aws_subnet.private[*].arn, count.index)\n+ resource_share_arn = aws_ram_resource_share.this[0].id\n+}\n+\n+resource \"aws_ram_resource_association\" \"public\" {\n+ count = var.create_vpc && length(var.public_subnets) > 0 ? length(var.public_subnets) : 0\n+\n+ resource_arn = element(aws_subnet.public[*].arn, count.index)\n+ resource_share_arn = aws_ram_resource_share.this[0].id\n+}\n+\n+resource \"aws_ram_principal_association\" \"this\" {\n+ for_each = toset(var.ram_principals)\n+ principal = each.value\n+ resource_share_arn = aws_ram_resource_share.this[0].arn\n+}\n---\nvariables.tf\n@@ -1577,3 +1577,37 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+################################################################################\n+# Resource Access Manager\n+################################################################################\n+\n+variable \"share_vpc\" {\n+ description = \"Whether to share your VPC with other accounts\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ram_name\" {\n+ description = \"The name of the resource share of VPC\"\n+ type = string\n+ default = \"\"\n+}\n+\n+variable \"ram_allow_external_principals\" {\n+ description = \"Indicates whether principals outside your organization can be associated with a resource share.\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ram_principals\" {\n+ description = \"A list of principals to share VPC with. Possible values are an AWS account ID, an AWS Organizations Organization ARN, or an AWS Organizations Organization Unit ARN\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"ram_tags\" {\n+ description = \"Additional tags for the RAM\"\n+ type = map(string)\n+ default = {}\n+}\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nOn initial plan/apply the output `database_route_table_ids` is not available due to the values not being known until after apply. Switching the logic to test the length of the array of resource ids instead of a `try()` fixes this issue. Credit to @martin566 for discovering the solution.\r\n\r\n## Motivation and Context\r\n\r\n\r\n- This change is required to allow the output to be able to be used by other resources in the same root module\r\n- Resolves #857.\r\n\r\n## Breaking Changes\r\n\r\n\r\nNone.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\nHave also confirmed in my use case that before this patch, example code like this failed (truncated for brevity):\r\n```hcl\r\nlocals {\r\n subnet_route_tables = merge(\r\n zipmap([\"public1\"], module.vpc.public_route_table_ids),\r\n zipmap([\"private1\", \"private2\", \"private3\"], module.vpc.private_route_table_ids),\r\n zipmap([\"database1\", \"database2\", \"database3\"], module.vpc.database_route_table_ids)\r\n )\r\n}\r\n\r\nresource \"aws_route\" \"tgw\" {\r\n for_each = local.subnet_route_tables\r\n\r\n route_table_id = each.value\r\n destination_cidr_block = \"10.0.0.0/8\"\r\n transit_gateway_id = data.aws_ec2_transit_gateway.this.id\r\n}\r\n```\r\n\r\n```\r\n\u2502 Error: Invalid for_each argument\r\n\u2502 \r\n\u2502 on main.tf line 110, in resource \"aws_route\" \"tgw\":\r\n\u2502 110: for_each = local.subnet_route_tables\r\n\u2502 \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\u2502 \u2502 local.subnet_route_tables will be known only after apply\r\n\u2502 \r\n\u2502 The \"for_each\" map includes keys derived from resource attributes that cannot be determined until apply, and so Terraform cannot determine the full set of keys that will identify the instances of this resource.\r\n\u2502 \r\n```\r\n\r\nAfter this patch, the error was not present and the plan/apply succeeded.\n\n---\n\nChoice A:\noutputs.tf\n@@ -279,7 +279,8 @@ output \"database_subnet_group_name\" {\n \n output \"database_route_table_ids\" {\n [])\n+ description = \"List of IDs of database route tables\"\n- value = try(coalescelist(aws_route_table.database[*].id, local.private_route_table_ids), [])\n+ # Refer to https://github.com/terraform-aws-modules/terraform-aws-vpc/pull/926 before changing logic\n+ value = length(aws_route_table.database[*].id) > 0 ? aws_route_table.database[*].id : aws_route_table.private[*].id\n }\n \n output \"database_internet_gateway_route_id\" {\n---\n\n\n---\n\nChoice B:\noutputs.tf\n@@ -279,7 +279,8 @@ output \"database_subnet_group_name\" {\n \n output \"database_route_table_ids\" {\n description = \"List of IDs of database route aws_route_table.database[*].id value = try(coalescelist(aws_route_table.database[*].id, local.private_route_table_ids), [])\n+ # Refer to https://github.com/terraform-aws-modules/terraform-aws-vpc/pull/926 before changing logic\n+ value = length(aws_route_table.database[*].id) > 0 ? aws_route_table.database[*].id : aws_route_table.private[*].id\n }\n \n output \"database_internet_gateway_route_id\" {\n---\n\n\n---\n\nChoice C:\noutputs.tf\n@@ -279,7 +279,8 @@ output \"database_subnet_group_name\" {\n \n output \"database_route_table_ids\" {\n description = \"List of IDs of database route tables\"\n- value = try(coalescelist(aws_route_table.database[*].id, local.private_route_table_ids), [])\n+ # Refer to https://github.com/terraform-aws-modules/terraform-aws-vpc/pull/926 before changing logic\n+ value = length(aws_route_table.database[*].id) > 0 ? aws_route_table.database[*].id : aws_route_table.private[*].id\n }\n \n output \"database_internet_gateway_route_id\" {\n---\n\n\n---\n\nChoice D:\noutputs.tf\n@@ -279,7 +279,8 @@ output \"database_subnet_group_name\" {\n \n output \"database_route_table_ids\" {\n description = \"List of IDs of database route tables\"\n- value ? = try(coalescelist(aws_route_table.database[*].id, local.private_route_table_ids), [])\n+ # Refer to https://github.com/terraform-aws-modules/terraform-aws-vpc/pull/926 before changing logic\n+ value = length(aws_route_table.database[*].id) > 0 ? aws_route_table.database[*].id : aws_route_table.private[*].id\n }\n \n output \"database_internet_gateway_route_id\" {\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nBased on the nat64/dns64 [docs](https://docs.aws.amazon.com/vpc/latest/userguide/nat-gateway-nat64-dns64.html), a route is required to utilize dns64 & nat64 for IPv6 only services to non-IPv6 services. \r\n\r\n- Add private subnet route for dns64.\r\n- Add database subnet route for dns64.\r\n- Enable nat gateway in dualstack example to test.\r\n\r\n## Motivation and Context\r\n\r\n\r\nFixes #923 \r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\r\nI tested this both in our internal stack and against the [ipv6-dualstack](examples/ipv6-dualstack/main.tf) example. New route should be created as long as nat gateways are enabled other criteria you'll see in the PR. \r\n\r\nI only updated private subnet route tables and database subnet route tables since it seemed to fit the existing patterns but if I missed anything or you feel differently, I'm open to any suggestions. Thanks!\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -310,9 +310,11 @@ No modules.\n | [aws_network_acl_rule.redshift_inbound](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/network_acl_rule) | resource |\n | [aws_network_acl_rule.redshift_outbound](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/network_acl_rule) | resource |\n | [aws_redshift_subnet_group.redshift](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/redshift_subnet_group) | resource |\n+| [aws_route.database_dns64_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.database_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.database_ipv6_egress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.database_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n+| [aws_route.private_dns64_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.private_ipv6_egress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.private_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.public_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n---\nexamples/ipv6-dualstack/main.tf\n@@ -33,7 +33,7 @@ module \"vpc\" {\n public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]\n database_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)]\n \n- enable_nat_gateway = false\n+ enable_nat_gateway = true\n \n create_database_subnet_route_table = true\n create_database_internet_gateway_route = true\n---\nmain.tf\n@@ -436,6 +436,18 @@ resource \"aws_route\" \"database_nat_gateway\" = }\n }\n \n+resource \"aws_route\" \"database_dns64_nat_gateway\" {\n+ count = local.create_database_route_table && !var.create_database_internet_gateway_route && var.create_database_nat_gateway_route && var.enable_nat_gateway && var.enable_ipv6 && var.private_subnet_enable_dns64 ? var.single_nat_gateway ? 1 : local.len_database_subnets : 0\n+\n+ route_table_id = element(aws_route_table.database[*].id, count.index)\n+ destination_ipv6_cidr_block = \"64:ff9b::/96\"\n+ nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n resource \"aws_route\" \"database_ipv6_egress\" {\n count = local.create_database_route_table && var.create_egress_only_igw && var.enable_ipv6 && var.create_database_internet_gateway_route ? 1 : 0\n \n@@ -1081,6 +1093,18 @@ resource \"aws_route\" \"private_nat_gateway\" {\n }\n }\n \n+resource \"aws_route\" \"private_dns64_nat_gateway\" {\n+ count = local.create_vpc && var.enable_nat_gateway && var.enable_ipv6 && var.private_subnet_enable_dns64 ? local.nat_gateway_count : 0\n+\n+ route_table_id = element(aws_route_table.private[*].id, count.index)\n+ destination_ipv6_cidr_block = \"64:ff9b::/96\"\n+ nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n ################################################################################\n # Customer Gateways\n ################################################################################\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -310,9 +310,11 @@ No modules.\n | [aws_network_acl_rule.redshift_inbound](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/network_acl_rule) | resource |\n | [aws_network_acl_rule.redshift_outbound](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/network_acl_rule) | resource |\n | [aws_redshift_subnet_group.redshift](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/redshift_subnet_group) | resource |\n+| [aws_route.database_dns64_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.database_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.database_ipv6_egress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.database_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n+| [aws_route.private_dns64_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.private_ipv6_egress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.private_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.public_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n---\nexamples/ipv6-dualstack/main.tf\n@@ -33,7 +33,7 @@ module \"vpc\" {\n public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]\n database_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)]\n \n- enable_nat_gateway = false\n+ enable_nat_gateway = true\n \n create_database_subnet_route_table = true\n create_database_internet_gateway_route = true\n---\nmain.tf\n@@ -436,6 +436,18 @@ resource \"aws_route\" \"database_nat_gateway\" {\n }\n }\n \n+resource \"aws_route\" \"database_dns64_nat_gateway\" {\n+ count = local.create_database_route_table && !var.create_database_internet_gateway_route && var.create_database_nat_gateway_route && var.enable_nat_gateway && var.enable_ipv6 && var.private_subnet_enable_dns64 ? var.single_nat_gateway ? 1 : local.len_database_subnets : 0\n+\n+ route_table_id = element(aws_route_table.database[*].id, count.index)\n+ destination_ipv6_cidr_block = \"64:ff9b::/96\"\n+ nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n resource \"aws_route\" \"database_ipv6_egress\" {\n count = local.create_database_route_table && var.create_egress_only_igw && var.enable_ipv6 && var.create_database_internet_gateway_route ? 1 : 0\n \n@@ -1081,6 +1093,18 @@ resource \"aws_route\" \"private_nat_gateway\" {\n }\n }\n \n+resource \"aws_route\" \"private_dns64_nat_gateway\" {\n+ count = local.create_vpc && var.enable_nat_gateway && var.enable_ipv6 && var.private_subnet_enable_dns64 ? local.nat_gateway_count : 0\n+\n+ route_table_id = element(aws_route_table.private[*].id, count.index)\n+ destination_ipv6_cidr_block = \"64:ff9b::/96\"\n+ nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n ################################################################################\n # Customer Gateways\n ################################################################################\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -310,9 +310,11 @@ No modules.\n | [aws_network_acl_rule.redshift_inbound](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/network_acl_rule) | resource |\n | [aws_network_acl_rule.redshift_outbound](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/network_acl_rule) | resource |\n | [aws_redshift_subnet_group.redshift](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/redshift_subnet_group) | resource |\n+| [aws_route.database_dns64_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.database_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.database_ipv6_egress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.database_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n+| [aws_route.private_dns64_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.private_ipv6_egress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.private_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.public_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n---\nexamples/ipv6-dualstack/main.tf\n@@ -33,7 +33,7 : module \"vpc\" {\n public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]\n database_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)]\n \n- enable_nat_gateway = false\n+ enable_nat_gateway = true\n \n create_database_subnet_route_table = true\n create_database_internet_gateway_route = true\n---\nmain.tf\n@@ -436,6 +436,18 @@ resource \"aws_route\" \"database_nat_gateway\" {\n }\n }\n \n+resource \"aws_route\" \"database_dns64_nat_gateway\" {\n+ count = local.create_database_route_table && !var.create_database_internet_gateway_route && var.create_database_nat_gateway_route && var.enable_nat_gateway && var.enable_ipv6 && var.private_subnet_enable_dns64 ? var.single_nat_gateway ? 1 : local.len_database_subnets : 0\n+\n+ route_table_id = element(aws_route_table.database[*].id, count.index)\n+ destination_ipv6_cidr_block = \"64:ff9b::/96\"\n+ nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n resource \"aws_route\" \"database_ipv6_egress\" {\n count = local.create_database_route_table && var.create_egress_only_igw && var.enable_ipv6 && var.create_database_internet_gateway_route ? 1 : 0\n \n@@ -1081,6 +1093,18 @@ resource \"aws_route\" \"private_nat_gateway\" {\n }\n }\n \n+resource \"aws_route\" \"private_dns64_nat_gateway\" {\n+ count = local.create_vpc && var.enable_nat_gateway && var.enable_ipv6 && var.private_subnet_enable_dns64 ? local.nat_gateway_count : 0\n+\n+ route_table_id = element(aws_route_table.private[*].id, count.index)\n+ destination_ipv6_cidr_block = \"64:ff9b::/96\"\n+ nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n ################################################################################\n # Customer Gateways\n ################################################################################\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -310,9 +310,11 @@ No modules.\n | [aws_network_acl_rule.redshift_inbound](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/network_acl_rule) | resource |\n | [aws_network_acl_rule.redshift_outbound](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/network_acl_rule) | resource |\n | [aws_redshift_subnet_group.redshift](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/redshift_subnet_group) | resource |\n+| [aws_route.database_dns64_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.database_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.database_ipv6_egress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.database_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n+| [aws_route.private_dns64_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.private_ipv6_egress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.private_nat_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n | [aws_route.public_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route) | resource |\n---\nexamples/ipv6-dualstack/main.tf\n@@ -33,7 +33,7 @@ module \"vpc\" {\n public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]\n database_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 8)]\n \n- enable_nat_gateway = false\n+ enable_nat_gateway = true\n \n create_database_subnet_route_table = true\n create_database_internet_gateway_route = true\n---\nmain.tf\n@@ -436,6 +436,18 @@ resource \"aws_route\" \"database_nat_gateway\" {\n }\n }\n \n+resource \"aws_route\" \"database_dns64_nat_gateway\" {\n+ count = local.create_database_route_table && !var.create_database_internet_gateway_route && var.create_database_nat_gateway_route && var.enable_nat_gateway && var.enable_ipv6 && var.private_subnet_enable_dns64 ? var.single_nat_gateway ? 1 : local.len_database_subnets : 0\n+\n+ route_table_id = element(aws_route_table.database[*].id, count.index)\n+ destination_ipv6_cidr_block = \"64:ff9b::/96\"\n+ nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n resource \"aws_route\" \"database_ipv6_egress\" {\n count = local.create_database_route_table && var.create_egress_only_igw && var.enable_ipv6 && var.create_database_internet_gateway_route ? 1 : 0\n \n@@ -1081,6 +1093,18 @@ resource \"aws_route\" \"private_nat_gateway\" {\n }\n }\n \n+resource \"aws_route\" \"private_dns64_nat_gateway\" {\n+ count = local.create_vpc && var.enable_nat_gateway && var.enable_ipv6 && var.private_subnet_enable_dns64 ? local.nat_gateway_count : 0\n+\n+ route_table_id = element(aws_route_table.private[*].id, count.index)\n+ destination_ipv6_cidr_block = \"64:ff9b::/96\"\n+ nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n ################################################################################\n # Customer Gateways\n ################################################################################\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n- Add missing private subnets to max subnet length local\r\n\r\n## Motivation and Context\r\n- Allows creating private only subnets\r\n\r\nError from current implementation:\r\n![image](https://user-images.githubusercontent.com/10913471/230655727-e414ce5c-e6d3-46ca-9da0-2ce5f6fb634a.png)\r\n\r\n## Breaking Changes\r\n- No\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\n\n---\n\nChoice A:\nexamples/simple/main.tf\n@@ -29,10 +29,7 @@ module \"vpc\" {\n cidr = local.vpc_cidr\n \n azs = local.azs\n- private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]\n- public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]\n-\n- enable_nat_gateway = false\n+ private_subnets [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]\n \n tags = local.tags\n }\n---\nmain.tf\n@@ -8,7 +8,9 @@ locals {\n len_outpost_subnets = max(length(var.outpost_subnets), length(var.outpost_subnet_ipv6_prefixes))\n \n max_subnet_length = max(\n+ local.len_private_subnets,\n local.len_public_subnets,\n+ local.len_intra_subnets,\n local.len_elasticache_subnets,\n local.len_database_subnets,\n local.len_redshift_subnets,\n---\n\n\n---\n\nChoice B:\nexamples/simple/main.tf\n@@ -29,10 +29,7 @@ module \"vpc\" {\n cidr = local.vpc_cidr\n \n azs = local.azs\n- private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]\n- public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]\n-\n- enable_nat_gateway = false\n+ private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]\n \n tags = local.tags\n }\n---\nmain.tf\n@@ -8,7 +8,9 @@ locals {\n len_outpost_subnets = max(length(var.outpost_subnets), length(var.outpost_subnet_ipv6_prefixes))\n \n max_subnet_length = max(\n+ local.len_private_subnets,\n local.len_public_subnets,\n+ local.len_intra_subnets,\n local.len_elasticache_subnets,\n local.len_database_subnets,\n local.len_redshift_subnets,\n---\n\n\n---\n\nChoice C:\nexamples/simple/main.tf\n@@ -29,10 +29,7 @@ module \"vpc\" {\n cidr = local.vpc_cidr\n \n azs = local.azs\n- private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]\n- public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]\n-\n- enable_nat_gateway = false\n+ private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]\n \n tags = local.tags\n }\n---\nmain.tf\n@@ -8,7 +8,9 @@ locals {\n len_outpost_subnets = max(length(var.outpost_subnets), length(var.outpost_subnet_ipv6_prefixes))\n \n max_subnet_length = max(\n+ local.len_private_subnets,\n local.len_public_subnets,\n+ local.len_intra_subnets,\n local.len_elasticache_subnets,\n local.len_database_subnets,\n local.len_redshift_subnets,\n---\n\n\n---\n\nChoice D:\nexamples/simple/main.tf\n@@ -29,10 +29,7 @@ module \"vpc\" {\n cidr = local.vpc_cidr\n \n azs = local.azs\n- private_subnets = k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]\n- public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 4)]\n-\n- enable_nat_gateway = false\n+ private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)]\n \n tags = local.tags\n }\n---\nmain.tf\n@@ -8,7 +8,9 @@ locals {\n len_outpost_subnets = max(length(var.outpost_subnets), length(var.outpost_subnet_ipv6_prefixes))\n \n max_subnet_length = max(\n+ local.len_private_subnets,\n local.len_public_subnets,\n+ local.len_intra_subnets,\n local.len_elasticache_subnets,\n local.len_database_subnets,\n local.len_redshift_subnets,\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -390,6 +390,7 @@ No modules.\n | [database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch](#input\\_database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch) | The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name` | `string` | `null` | no |\n | [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n | [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| [database\\_subnet\\_tags\\_per\\_az](#input\\_database\\_subnet\\_tags\\_per\\_az) | Additional tags for the database subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | [default\\_network\\_acl\\_egress](#input\\_default\\_network\\_acl\\_egress) | List of maps of egress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | [default\\_network\\_acl\\_ingress](#input\\_default\\_network\\_acl\\_ingress) | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n---\nmain.tf\n@@ -366,6 +366,7 @@ resource \"aws_subnet\" \"database\" {\n },\n var.tags,\n var.database_subnet_tags,\n+ lookup(var.database_subnet_tags_per_az, element(var.azs, {})\n )\n }\n \n---\nvariables.tf\n@@ -530,6 +530,12 @@ variable \"database_subnet_group_name\" {\n default = null\n }\n \n+variable \"database_subnet_tags_per_az\" {\n+ description = \"Additional tags for the database subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"database_subnet_group_tags\" {\n description = \"Additional tags for the database subnet group\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -390,6 +390,7 @@ No modules.\n | [database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch](#input\\_database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch) | The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name` | `string` | `null` | no |\n | [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n | [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| [database\\_subnet\\_tags\\_per\\_az](#input\\_database\\_subnet\\_tags\\_per\\_az) | Additional tags for the database subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | [default\\_network\\_acl\\_egress](#input\\_default\\_network\\_acl\\_egress) | List of maps of egress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | [default\\_network\\_acl\\_ingress](#input\\_default\\_network\\_acl\\_ingress) | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n---\nmain.tf\n@@ -366,6 +366,7 @@ resource \"aws_subnet\" \"database\" {\n },\n var.tags,\n var.database_subnet_tags,\n+ lookup(var.database_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -530,6 +530,12 @@ variable \"database_subnet_group_name\" {\n default = null\n }\n \n+variable \"database_subnet_tags_per_az\" {\n+ description = \"Additional tags for the database subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"database_subnet_group_tags\" {\n description = \"Additional tags for the database subnet group\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -390,6 +390,7 @@ No modules.\n | [database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch](#input\\_database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch) | The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name` | `string` | `null` | no |\n | [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n | [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| [database\\_subnet\\_tags\\_per\\_az](#input\\_database\\_subnet\\_tags\\_per\\_az) | Additional tags for the database subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | [default\\_network\\_acl\\_egress](#input\\_default\\_network\\_acl\\_egress) | List of maps of egress rules set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | [default\\_network\\_acl\\_ingress](#input\\_default\\_network\\_acl\\_ingress) | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n---\nmain.tf\n@@ -366,6 +366,7 @@ resource \"aws_subnet\" \"database\" {\n },\n var.tags,\n var.database_subnet_tags,\n+ lookup(var.database_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -530,6 +530,12 @@ variable \"database_subnet_group_name\" {\n default = null\n }\n \n+variable \"database_subnet_tags_per_az\" {\n+ description = \"Additional tags for the database subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"database_subnet_group_tags\" {\n description = \"Additional tags for the database subnet group\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -390,6 +390,7 = No modules.\n | [database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch](#input\\_database\\_subnet\\_private\\_dns\\_hostname\\_type\\_on\\_launch) | The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name` | `string` | `null` | no |\n | [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n | [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| [database\\_subnet\\_tags\\_per\\_az](#input\\_database\\_subnet\\_tags\\_per\\_az) | Additional tags for the database subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | [default\\_network\\_acl\\_egress](#input\\_default\\_network\\_acl\\_egress) | List of maps of egress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | [default\\_network\\_acl\\_ingress](#input\\_default\\_network\\_acl\\_ingress) | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n---\nmain.tf\n@@ -366,6 +366,7 @@ resource \"aws_subnet\" \"database\" {\n },\n var.tags,\n var.database_subnet_tags,\n+ lookup(var.database_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -530,6 +530,12 @@ variable \"database_subnet_group_name\" {\n default = null\n }\n \n+variable \"database_subnet_tags_per_az\" {\n+ description = \"Additional tags for the database subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"database_subnet_group_tags\" {\n description = \"Additional tags for the database subnet group\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThis PR fixes a typo in the REAME file.\r\n\r\n\r\n## Motivation and Context\r\nFound a typo and think of fixing it.\r\n\r\n\r\n\r\n## Breaking Changes\r\nNo\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -85,7 +85,7 @@ If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, of \n ### One NAT Gateway per subnet (default)\n \n-By default, the module will determine the number of NAT Gateways to create based on the the `max()` of the private subnet lists (`database_subnets`, `elasticache_subnets`, `private_subnets`, and `redshift_subnets`). The module **does not** take into account the number of `intra_subnets`, since the latter are designed to have no Internet access via NAT Gateway. For example, if your configuration looks like the following:\n+By default, the module will determine the number of NAT Gateways to create based on the `max()` of the private subnet lists (`database_subnets`, `elasticache_subnets`, `private_subnets`, and `redshift_subnets`). The module **does not** take into account the number of `intra_subnets`, since the latter are designed to have no Internet access via NAT Gateway. For example, if your configuration looks like the following:\n \n ```hcl\n database_subnets = [\"10.0.21.0/24\", \"10.0.22.0/24\"]\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -85,7 +85,7 @@ If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, the\n \n ### One NAT Gateway per subnet (default)\n \n-By default, the module will determine the number of NAT Gateways to create based on the the `max()` of the private subnet lists (`database_subnets`, `elasticache_subnets`, `private_subnets`, and `redshift_subnets`). The module **does not** take into account the number of `intra_subnets`, since the latter are designed to have no Internet access via NAT Gateway. For example, if your configuration looks like the following:\n+By default, the module will determine the number of NAT Gateways to create based on the `max()` of the private subnet lists (`database_subnets`, `elasticache_subnets`, `private_subnets`, and `redshift_subnets`). The module **does not** take into account the number of `intra_subnets`, since the latter are designed to have no Internet access via NAT Gateway. For example, if your configuration looks like the following:\n \n ```hcl\n database_subnets = [\"10.0.21.0/24\", \"10.0.22.0/24\"]\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -85,7 +85,7 @@ If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, the\n \n ### One NAT Gateway per subnet (default)\n \n-By default, the module are determine the number of NAT Gateways to create based on the the `max()` of the private subnet lists (`database_subnets`, `elasticache_subnets`, `private_subnets`, and `redshift_subnets`). The module **does not** take into account the number of `intra_subnets`, since the latter are designed to have no Internet access via NAT Gateway. For example, if your configuration looks like the following:\n+By default, the module will determine the number of NAT Gateways to create based on the `max()` of the private subnet lists (`database_subnets`, `elasticache_subnets`, `private_subnets`, and `redshift_subnets`). The module **does not** take into account the number of `intra_subnets`, since the latter are designed to have no Internet access via NAT Gateway. For example, if your configuration looks like the following:\n \n ```hcl\n database_subnets = [\"10.0.21.0/24\", \"10.0.22.0/24\"]\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -85,7 +85,7 @@ If both `single_nat_gateway` and `one_nat_gateway_per_az` are set to `true`, the\n \n ### One NAT Gateway per subnet (default)\n \n-By default, the module will determine the number of NAT Gateways to create based on the the `max()` of the private subnet lists (`database_subnets`, `elasticache_subnets`, `private_subnets`, and `redshift_subnets`). The module **does not** take into account the number of `intra_subnets`, since the latter are designed to have no Internet access via NAT Gateway. For example, if your configuration looks like the following:\n+By default, the module will determine the number of NAT Gateways to create based on the `max()` of the private subnet lists (`database_subnets`, `elasticache_subnets`, `private_subnets`, and `redshift_subnets`). The module **does not** take into account the number of `intra_subnets`, since the latter are designed to have no Internet access via NAT Gateway. For example, if your configuration looks +85,7 the following:\n \n ```hcl\n database_subnets = [\"10.0.21.0/24\", \"10.0.22.0/24\"]\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nThis change allows users to call the module from their own module while passing `null` or an empty string (`\"\"`) to this module for the `ipv6_ipam_pool_id` variable.\r\n\r\n## Motivation and Context\r\n\r\nWe have our own wrapper module for VPCs that calls this module. We are using [Terragrunt](https://terragrunt.gruntwork.io/) to keep our code DRY.\r\n\r\nIn our `_envcommon` for VPCs, we have\r\n\r\n```\r\nlocals {\r\n ...\r\n\r\n # Automatically load environment-level variables\r\n environment_vars = read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))\r\n\r\n # Extract out common variables for reuse\r\n ipv6_ipam_pool_id = try(local.environment_vars.locals.vpc_ipv6_ipam_pool_id, null)\r\n use_ipam_pool = local.ipv6_ipam_pool_id != null\r\n\r\n ...\r\n}\r\n\r\ninputs = {\r\n ...\r\n\r\n use_ipam_pool = local.use_ipam_pool\r\n ipv6_ipam_pool_id = local.ipv6_ipam_pool_id\r\n\r\n ...\r\n}\r\n```\r\n\r\nand we're getting the following error when `ipv6_ipam_pool_id` is `null`:\r\n\r\n```\r\nError: Conflicting configuration arguments\r\n\r\n on .terraform/modules/vpc/main.tf line 27, in resource \"aws_vpc\" \"this\":\r\n 27: assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool true : null\r\n\r\n\"assign_generated_ipv6_cidr_block\": conflicts with ipv6_ipam_pool_id\r\n\r\nError: Conflicting configuration arguments\r\n\r\n on .terraform/modules/vpc/main.tf line 29, in resource \"aws_vpc\" \"this\":\r\n 29: ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\r\n\r\n\"ipv6_ipam_pool_id\": conflicts with assign_generated_ipv6_cidr_block\r\n\r\ntime=2023-03-22T18:46:38Z level=error msg=Terraform invocation failed in /tmp/274f71cb-cc98-48bf-bfe2-5b91e9064b0a/sase-preprod/us-west-2/sase-preprod/vpc/.terragrunt-cache/7bSSPeYRzQyBwlya0Kvd1mmg3ls/m48TkmguM93MPX0LUY4qqcafT_g prefix=[/tmp/274f71cb-cc98-48bf-bfe2-5b91e9064b0a/sase-preprod/us-west-2/sase-preprod/vpc] \r\ntime=2023-03-22T18:46:38Z level=error msg=1 error occurred:\r\n\t* exit status 1\r\n```\r\n\r\nThis relates to https://github.com/hashicorp/terraform/issues/24142\r\n\r\nSo this is a fix for us (and others), which allows `null` or empty strings to be passed to this module.\r\n\r\n## Breaking Changes\r\n\r\nNo, it works the same as before.\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n```\r\nhnicholas7DYYW:ipv6 hnicholas$ pre-commit run\r\nTerraform fmt............................................................Passed\r\nTerraform validate.......................................................Passed\r\nTerraform docs...........................................................Passed\r\nTerraform validate with tflint...........................................Passed\r\ncheck for merge conflicts................................................Passed\r\nfix end of files.........................................................Passed\r\n```\n\n---\n\nChoice A:\nREADME.md\n@@ -356,7 +356,7 @@ No modules.\n |------|-------------|------|---------|:--------:|\n | [amazon\\_side\\_asn](#input\\_amazon\\_side\\_asn) | The Autonomous System Number (ASN) for the Amazon side of the gateway. By default the virtual private gateway is created with the current default Amazon ASN | `string` | `\"64512\"` | no |\n | [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n-| [cidr](#input\\_cidr) | (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id` | `string` | `\"10.0.0.0/16\"` | no |\n+| [cidr](#input\\_cidr) | (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id` | `string` | `\"\"` | no |\n | [create\\_database\\_internet\\_gateway\\_route](#input\\_create\\_database\\_internet\\_gateway\\_route) | Controls if an internet gateway route for public database access should be created | `bool` | `false` | no |\n | [create\\_database\\_nat\\_gateway\\_route](#input\\_create\\_database\\_nat\\_gateway\\_route) | Controls if a nat gateway route should be created to give internet access to the database subnets | `bool` | `false` | no |\n | [create\\_database\\_subnet\\_group](#input\\_create\\_database\\_subnet\\_group) | Controls if database subnet group should be created (n.b. database\\_subnets must also be set) | `bool` | `true` | no |\n@@ -477,8 +477,8 @@ No modules.\n | [ipv4\\_netmask\\_length](#input\\_ipv4\\_netmask\\_length) | (Optional) The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a ipv4\\_ipam\\_pool\\_id | `number` | `null` | no |\n | [ipv6\\_cidr](#input\\_ipv6\\_cidr) | (Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length` | `string` | `null` | no |\n | [ipv6\\_cidr\\_block\\_network\\_border\\_group](#input\\_ipv6\\_cidr\\_block\\_network\\_border\\_group) | By default when an IPv6 CIDR is assigned to a VPC a default ipv6\\_cidr\\_block\\_network\\_border\\_group will be set to the region of the VPC. This can be changed to restrict advertisement of public addresses to specific Network Border Groups such as LocalZones | `string` | `null` | no |\n-| [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | (Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block` | `string` | `null` | no |\n-| [ipv6\\_netmask\\_length](#input\\_ipv6\\_netmask\\_length) | (Optional) Netmask length to request from IPAM Pool. Conflicts with `ipv6_cidr_block`. This can be omitted if IPAM pool as a `allocation_default_netmask_length` set. Valid values: `56` | `number` | `null` | no |\n+| [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | (Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block` | `string` | `\"\"` | no |\n+| [ipv6\\_netmask\\_length](#input\\_ipv6\\_netmask\\_length) | (Optional) Netmask length to request from IPAM Pool. Conflicts with `ipv6_cidr_block`. This can be omitted if IPAM pool as a `allocation_default_netmask_length` set. Valid values: `56` | `number` | `0` | no |\n | [manage\\_default\\_network\\_acl](#input\\_manage\\_default\\_network\\_acl) | Should be true to adopt and manage Default Network ACL | `bool` | `true` | no |\n | [manage\\_default\\_route\\_table](#input\\_manage\\_default\\_route\\_table) | Should be true to manage default route table | `bool` | `true` | no |\n | [manage\\_default\\_security\\_group](#input\\_manage\\_default\\_security\\_group) | Should be true to adopt and manage default security group | `bool` | `true` | no |\n---\nmain.tf\n@@ -1,4 +1,6 @@\n locals {\n+ default_cidr = \"10.0.0.0/16\"\n+ ipv6_netmask_length = var.ipv6_netmask_length == 0 ? null : var.ipv6_netmask_length\n len_public_subnets = max(length(var.public_subnets), length(var.public_subnet_ipv6_prefixes))\n len_private_subnets = max(length(var.private_subnets), length(var.private_subnet_ipv6_prefixes))\n len_database_subnets = max(length(var.database_subnets), length(var.database_subnet_ipv6_prefixes))\n@@ -29,14 +31,17 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool ? null : var.cidr\n+ cidr_block = var.cidr != \"\" ? var.cidr : (\n+ var.use_ipam_pool ? null : local.default_cidr\n+ )\n+\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n- ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n- ipv6_netmask_length = var.ipv6_netmask_length\n+ ipv6_ipam_pool_id = var.ipv6_ipam_pool_id != \"\" ? var.ipv6_ipam_pool_id : null\n+ ipv6_netmask_length = local.ipv6_netmask_length\n ipv6_cidr_block_network_border_group = var.ipv6_cidr_block_network_border_group\n \n instance_tenancy = var.instance_tenancy\n---\nvariables.tf\n@@ -17,7 +17,7 @@ variable \"name\" {\n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n type = string\n- default = \"10.0.0.0/16\"\n+ default = \"\"\n }\n \n variable \"secondary_cidr_blocks\" {\n@@ -89,13 +89,13 @@ variable \"ipv6_cidr\" {\n variable \"ipv6_ipam_pool_id\" {\n description = \"(Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block`\"\n type = string\n- default = null\n+ default = \"\"\n }\n \n variable \"ipv6_netmask_length\" {\n description = \"(Optional) Netmask length to request from IPAM Pool. Conflicts with `ipv6_cidr_block`. This can be omitted if IPAM pool as a `allocation_default_netmask_length` set. Valid values: `56`\"\n type = number\n- default null\n+ default = 0\n }\n \n variable \"ipv6_cidr_block_network_border_group\" {\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -356,7 +356,7 @@ No modules.\n |------|-------------|------|---------|:--------:|\n | [amazon\\_side\\_asn](#input\\_amazon\\_side\\_asn) | The Autonomous System Number (ASN) for the Amazon side of the gateway. By default the virtual private gateway is created with the current default Amazon ASN | `string` | `\"64512\"` | no |\n | [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n-| [cidr](#input\\_cidr) | (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id` | `string` | `\"10.0.0.0/16\"` | no |\n+| [cidr](#input\\_cidr) | (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id` | `string` | `\"\"` | no |\n | [create\\_database\\_internet\\_gateway\\_route](#input\\_create\\_database\\_internet\\_gateway\\_route) | Controls if an internet gateway route for public database access should be created | `bool` | `false` | no |\n | [create\\_database\\_nat\\_gateway\\_route](#input\\_create\\_database\\_nat\\_gateway\\_route) | Controls if a nat gateway route should be created to give internet access to the database subnets | `bool` | `false` | no |\n | [create\\_database\\_subnet\\_group](#input\\_create\\_database\\_subnet\\_group) | Controls if database subnet group should be created (n.b. database\\_subnets must also be set) | `bool` | `true` | no |\n@@ -477,8 +477,8 @@ No modules.\n | [ipv4\\_netmask\\_length](#input\\_ipv4\\_netmask\\_length) | (Optional) The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a ipv4\\_ipam\\_pool\\_id | `number` | `null` | no |\n | [ipv6\\_cidr](#input\\_ipv6\\_cidr) | (Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length` | `string` | `null` | no |\n | [ipv6\\_cidr\\_block\\_network\\_border\\_group](#input\\_ipv6\\_cidr\\_block\\_network\\_border\\_group) | By default when an IPv6 CIDR is assigned to a VPC a default ipv6\\_cidr\\_block\\_network\\_border\\_group will be set to the region of the VPC. This can be changed to restrict advertisement of public addresses to specific Network Border Groups such as LocalZones | `string` | `null` | no |\n-| [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | (Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block` | `string` | `null` | no |\n-| [ipv6\\_netmask\\_length](#input\\_ipv6\\_netmask\\_length) | (Optional) Netmask length to request from IPAM Pool. Conflicts with `ipv6_cidr_block`. This can be omitted if IPAM pool as a `allocation_default_netmask_length` set. Valid values: `56` | `number` | `null` | no |\n+| [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | (Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block` | `string` | `\"\"` | no |\n+| [ipv6\\_netmask\\_length](#input\\_ipv6\\_netmask\\_length) | (Optional) Netmask length to request from IPAM Pool. Conflicts with `ipv6_cidr_block`. This can be omitted if IPAM pool as a `allocation_default_netmask_length` set. Valid values: `56` | `number` | `0` | no |\n | [manage\\_default\\_network\\_acl](#input\\_manage\\_default\\_network\\_acl) | Should be true to adopt and manage Default Network ACL | `bool` | `true` | no |\n | [manage\\_default\\_route\\_table](#input\\_manage\\_default\\_route\\_table) | Should be true to manage default route table | `bool` | `true` | no |\n | [manage\\_default\\_security\\_group](#input\\_manage\\_default\\_security\\_group) | Should be true to adopt and manage default security group | `bool` | `true` | no |\n---\nmain.tf\n@@ -1,4 +1,6 @@\n locals {\n+ default_cidr = \"10.0.0.0/16\"\n+ ipv6_netmask_length = var.ipv6_netmask_length == 0 ? null : var.ipv6_netmask_length\n len_public_subnets = max(length(var.public_subnets), length(var.public_subnet_ipv6_prefixes))\n len_private_subnets = max(length(var.private_subnets), length(var.private_subnet_ipv6_prefixes))\n len_database_subnets = max(length(var.database_subnets), length(var.database_subnet_ipv6_prefixes))\n@@ -29,14 +31,17 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool ? null : var.cidr\n+ cidr_block = var.cidr != \"\" ? var.cidr : (\n+ var.use_ipam_pool ? null : local.default_cidr\n+ )\n+\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool true : null\n ipv6_cidr_block = var.ipv6_cidr\n- ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n- ipv6_netmask_length = var.ipv6_netmask_length\n+ ipv6_ipam_pool_id = var.ipv6_ipam_pool_id != \"\" ? var.ipv6_ipam_pool_id : null\n+ ipv6_netmask_length = local.ipv6_netmask_length\n ipv6_cidr_block_network_border_group = var.ipv6_cidr_block_network_border_group\n \n instance_tenancy = var.instance_tenancy\n---\nvariables.tf\n@@ -17,7 +17,7 @@ variable \"name\" {\n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n type = string\n- default = \"10.0.0.0/16\"\n+ default = \"\"\n }\n \n variable \"secondary_cidr_blocks\" {\n@@ -89,13 +89,13 @@ variable \"ipv6_cidr\" {\n variable \"ipv6_ipam_pool_id\" {\n description = \"(Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block`\"\n type = string\n- default = null\n+ default = \"\"\n }\n \n variable \"ipv6_netmask_length\" {\n description = \"(Optional) Netmask length to request from IPAM Pool. Conflicts with `ipv6_cidr_block`. This can be omitted if IPAM pool as a `allocation_default_netmask_length` set. Valid values: `56`\"\n type = number\n- default = null\n+ default = 0\n }\n \n variable \"ipv6_cidr_block_network_border_group\" {\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -356,7 +356,7 @@ No modules.\n |------|-------------|------|---------|:--------:|\n | [amazon\\_side\\_asn](#input\\_amazon\\_side\\_asn) | The Autonomous System Number (ASN) for the Amazon side of the gateway. By default the virtual private gateway is created with the current default Amazon ASN | `string` | `\"64512\"` | no |\n | [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n-| [cidr](#input\\_cidr) | (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id` | `string` | `\"10.0.0.0/16\"` | no |\n+| [cidr](#input\\_cidr) | (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id` | `string` | `\"\"` | no |\n | [create\\_database\\_internet\\_gateway\\_route](#input\\_create\\_database\\_internet\\_gateway\\_route) | Controls if an internet gateway route for public database access should be created | `bool` | `false` | no |\n | [create\\_database\\_nat\\_gateway\\_route](#input\\_create\\_database\\_nat\\_gateway\\_route) | Controls if a nat gateway route should be created to give internet access to the database subnets | `bool` | `false` | no |\n | [create\\_database\\_subnet\\_group](#input\\_create\\_database\\_subnet\\_group) | Controls if database subnet group should be created (n.b. database\\_subnets must also be set) | `bool` | `true` | no |\n@@ -477,8 +477,8 @@ No modules.\n | [ipv4\\_netmask\\_length](#input\\_ipv4\\_netmask\\_length) | (Optional) The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a ipv4\\_ipam\\_pool\\_id | `number` | `null` | no |\n | [ipv6\\_cidr](#input\\_ipv6\\_cidr) | (Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length` | `string` | `null` | no |\n | [ipv6\\_cidr\\_block\\_network\\_border\\_group](#input\\_ipv6\\_cidr\\_block\\_network\\_border\\_group) | By default when an IPv6 CIDR is assigned to a VPC a default ipv6\\_cidr\\_block\\_network\\_border\\_group will be set to the region of the VPC. This can be changed to restrict advertisement of public addresses to specific Network Border Groups such as LocalZones | `string` | `null` | no |\n-| [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | (Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block` | `string` | `null` | no |\n-| [ipv6\\_netmask\\_length](#input\\_ipv6\\_netmask\\_length) | (Optional) Netmask length to request from IPAM Pool. Conflicts with `ipv6_cidr_block`. This can be omitted if IPAM pool as a `allocation_default_netmask_length` set. Valid values: `56` | `number` | `null` | no |\n+| [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | (Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block` | `string` | `\"\"` | no |\n+| [ipv6\\_netmask\\_length](#input\\_ipv6\\_netmask\\_length) | (Optional) Netmask length to request from IPAM Pool. Conflicts with `ipv6_cidr_block`. This can be omitted if IPAM pool as a `allocation_default_netmask_length` set. Valid values: `56` | `number` | `0` | no |\n | [manage\\_default\\_network\\_acl](#input\\_manage\\_default\\_network\\_acl) | Should be true to adopt and manage Default Network ACL | `bool` | `true` | no |\n | [manage\\_default\\_route\\_table](#input\\_manage\\_default\\_route\\_table) | Should be true to manage default route table | `bool` | `true` | no |\n | [manage\\_default\\_security\\_group](#input\\_manage\\_default\\_security\\_group) | Should be true to adopt and manage default security group | `bool` | `true` | no |\n---\nmain.tf\n@@ -1,4 +1,6 @@\n locals {\n+ default_cidr = \"10.0.0.0/16\"\n+ ipv6_netmask_length = var.ipv6_netmask_length == 0 ? null : var.ipv6_netmask_length\n len_public_subnets = max(length(var.public_subnets), length(var.public_subnet_ipv6_prefixes))\n len_private_subnets = max(length(var.private_subnets), length(var.private_subnet_ipv6_prefixes))\n len_database_subnets = max(length(var.database_subnets), length(var.database_subnet_ipv6_prefixes))\n@@ -29,14 +31,17 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool ? null : var.cidr\n+ cidr_block = var.cidr != \"\" ? var.cidr : (\n+ var.use_ipam_pool ? null : local.default_cidr\n+ )\n+\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n- ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n- ipv6_netmask_length = var.ipv6_netmask_length\n+ ipv6_ipam_pool_id = var.ipv6_ipam_pool_id != \"\" ? var.ipv6_ipam_pool_id : null\n+ ipv6_netmask_length = local.ipv6_netmask_length\n ipv6_cidr_block_network_border_group = var.ipv6_cidr_block_network_border_group\n \n instance_tenancy = var.instance_tenancy\n---\nvariables.tf\n@@ -17,7 +17,7 @@ variable \"name\" {\n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n type = string\n- default = \"10.0.0.0/16\"\n+ default = \"\"\n }\n \n variable \"secondary_cidr_blocks\" {\n@@ -89,13 +89,13 @@ variable \"ipv6_cidr\" {\n variable \"ipv6_ipam_pool_id\" {\n description = \"(Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block`\"\n type = string\n- default = null\n+ default = \"\"\n }\n \n variable \"ipv6_netmask_length\" {\n description = \"(Optional) Netmask length to request from IPAM Pool. Conflicts with `ipv6_cidr_block`. This can be omitted if IPAM pool as a `allocation_default_netmask_length` set. Valid values: `56`\"\n type = number\n- default = null\n+ default = 0\n }\n \n variable \"ipv6_cidr_block_network_border_group\" {\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -356,7 +356,7 @@ No modules.\n |------|-------------|------|---------|:--------:|\n | [amazon\\_side\\_asn](#input\\_amazon\\_side\\_asn) | The Autonomous System Number (ASN) for the Amazon side of the gateway. By default the virtual private gateway is created with the current default Amazon ASN | `string` | `\"64512\"` | no |\n | [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n-| [cidr](#input\\_cidr) | (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id` | `string` | `\"10.0.0.0/16\"` | no |\n+| [cidr](#input\\_cidr) | (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id` | `string` | `\"\"` | no |\n | [create\\_database\\_internet\\_gateway\\_route](#input\\_create\\_database\\_internet\\_gateway\\_route) | Controls if an internet gateway route for public database access should be created | `bool` | `false` | no |\n | [create\\_database\\_nat\\_gateway\\_route](#input\\_create\\_database\\_nat\\_gateway\\_route) | Controls if a nat gateway route should be created to give internet access to the database subnets | `bool` | `false` | no |\n | [create\\_database\\_subnet\\_group](#input\\_create\\_database\\_subnet\\_group) | Controls if database subnet group should be created (n.b. database\\_subnets must also be set) | `bool` | `true` | no |\n@@ -477,8 +477,8 @@ No modules.\n | [ipv4\\_netmask\\_length](#input\\_ipv4\\_netmask\\_length) | (Optional) The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a ipv4\\_ipam\\_pool\\_id | `number` | `null` | no |\n | [ipv6\\_cidr](#input\\_ipv6\\_cidr) | (Optional) IPv6 CIDR block to request from an IPAM Pool. Can be set explicitly or derived from IPAM using `ipv6_netmask_length` | `string` | `null` | no |\n | [ipv6\\_cidr\\_block\\_network\\_border\\_group](#input\\_ipv6\\_cidr\\_block\\_network\\_border\\_group) | By default when an IPv6 CIDR is assigned to a VPC a default ipv6\\_cidr\\_block\\_network\\_border\\_group will be set to the region of the VPC. This can be changed to restrict advertisement of public addresses to specific Network Border Groups such as LocalZones | `string` | `null` | no |\n-| [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | (Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block` | `string` | `null` | no |\n-| [ipv6\\_netmask\\_length](#input\\_ipv6\\_netmask\\_length) | (Optional) Netmask length to request from IPAM Pool. Conflicts with `ipv6_cidr_block`. This can be omitted if IPAM pool as a `allocation_default_netmask_length` set. Valid values: `56` | `number` | `null` | no |\n+| [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | (Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block` | `string` | `\"\"` | no |\n+| [ipv6\\_netmask\\_length](#input\\_ipv6\\_netmask\\_length) | (Optional) Netmask length to request from IPAM Pool. Conflicts with `ipv6_cidr_block`. This can be omitted if IPAM pool as a `allocation_default_netmask_length` set. Valid values: `56` | `number` | `0` | no |\n | [manage\\_default\\_network\\_acl](#input\\_manage\\_default\\_network\\_acl) | Should be true to adopt and manage Default Network ACL | `bool` | `true` | no |\n | [manage\\_default\\_route\\_table](#input\\_manage\\_default\\_route\\_table) | Should be true to manage default route table | `bool` | `true` | no |\n | [manage\\_default\\_security\\_group](#input\\_manage\\_default\\_security\\_group) | Should be true to adopt and manage default security group | `bool` | `true` | no |\n---\nmain.tf\n@@ -1,4 +1,6 @@\n locals {\n+ default_cidr = \"10.0.0.0/16\"\n+ ipv6_netmask_length = var.ipv6_netmask_length == 0 ? null : var.ipv6_netmask_length\n len_public_subnets = max(length(var.public_subnets), length(var.public_subnet_ipv6_prefixes))\n len_private_subnets = max(length(var.private_subnets), length(var.private_subnet_ipv6_prefixes))\n len_database_subnets = max(length(var.database_subnets), length(var.database_subnet_ipv6_prefixes))\n@@ -29,14 +31,17 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool ? null : var.cidr\n+ cidr_block = var.cidr != \"\" ? var.cidr : (\n+ var.use_ipam_pool ? null : local.default_cidr\n+ )\n+\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n- ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n- ipv6_netmask_length = var.ipv6_netmask_length\n+ ipv6_ipam_pool_id = 0\n != \"\" ? var.ipv6_ipam_pool_id : null\n+ ipv6_netmask_length = local.ipv6_netmask_length\n ipv6_cidr_block_network_border_group = var.ipv6_cidr_block_network_border_group\n \n instance_tenancy = var.instance_tenancy\n---\nvariables.tf\n@@ -17,7 +17,7 @@ variable \"name\" {\n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n type = string\n- default = \"10.0.0.0/16\"\n+ default = \"\"\n }\n \n variable \"secondary_cidr_blocks\" {\n@@ -89,13 +89,13 @@ variable \"ipv6_cidr\" {\n variable \"ipv6_ipam_pool_id\" {\n description = \"(Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block`\"\n type = string\n- default = null\n+ default = \"\"\n }\n \n variable \"ipv6_netmask_length\" {\n description = \"(Optional) Netmask length to request from IPAM Pool. Conflicts with `ipv6_cidr_block`. This can be omitted if IPAM pool as a `allocation_default_netmask_length` set. Valid values: `56`\"\n type = number\n- default = null\n+ default = 0\n }\n \n variable \"ipv6_cidr_block_network_border_group\" {\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n*cidr_block* parameter is set to `null` when *use_ipam_pool* varaiable is set to true. Thus, only *ipv4_netmask_length* is available when you want to use IPAM. However, it is possible to chose the CIDR rather than the netmask length as the [example](https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/master/examples/ipam-vpc/main.tf) shows at line 44. \r\n\r\n## Motivation and Context\r\nWant to be able to use IPAM with CIDR selection, not only with netmask length selection.\r\n\r\n## Breaking Changes\r\nNo breaking changes.\r\n\r\n## How Has This Been Tested?\r\n- [x] Test with *cidr* provisioned as [example](https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/master/examples/ipam-vpc/main.tf) shows at line 44\r\n- [x] Test with *ipv4_netmask_length* provisioned as [example](https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/master/examples/ipam-vpc/main.tf) shows at line 24\r\n- [x] Test with *use_ipam_pool* set to *false*\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -20,7 +20,7 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool ? null : var.cidr\n+ cidr_block = var.use_ipam_pool && var.ipv4_netmask_length != null ? null : ? ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -20,7 +20,7 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool && null : var.cidr\n+ cidr_block = var.use_ipam_pool && var.ipv4_netmask_length != null ? null : var.cidr\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -20,7 +20,7 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool ? null : var.cidr\n+ cidr_block = var.use_ipam_pool && var.ipv4_netmask_length != null ? null : var.cidr\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -20,7 +20,7 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool ? null : var.cidr\n+ cidr_block = var.use_ipam_pool && var.ipv4_netmask_length != null ? : var.cidr\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nFixes a typo in the condition inside the complete vpc example.\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -208,7 +208,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n }\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -208,7 +208,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n data test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n }\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -208,7 +208,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n }\n---\n\n\n---\n\nChoice D:\n -208,7 +208,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n }\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nEnable TLS inbound for Session Manager\r\n\r\n## Description\r\nI use Session Manager quite extensively as it avoids the need for managing SSH Key pairs. The complete example had all of the endpoints but was missing the security group definitions for a couple, so I added them here.\r\n\r\n## Motivation and Context\r\nEnable testers to spin up EC2 instances without the need for SSH Key Pairs\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\nI've validated that this works in 2 separate AWS accounts.\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -114,6 +114,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -141,6 +142,7 @@ module \"vpc_endpoints\" {\n service = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = {\n lambda service = \"ecr.api\"\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -114,6 +114,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -141,6 @@ module \"vpc_endpoints\" {\n service = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = {\n service = \"ecr.api\"\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -114,6 +114,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -141,6 +142,7 @@ module \"vpc_endpoints\" {\n service = = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = {\n service = \"ecr.api\"\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -114,6 +114,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -141,6 +142,7 @@ module \"vpc_endpoints\" {\n service = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = {\n service = \"ecr.api\"\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nBefore IPAM, users were still able to BYOIPv6. This change allows these users to use this module.\r\n\r\n## Motivation and Context\r\n\r\nWe used AWS BYOIPv6 before the AWS IPAM feature so we have to pass `ipv6_ipam_pool_id` AND pass `null` to `assign_generated_ipv6_cidr_block`. Currently the code for `assign_generated_ipv6_cidr_block` is:\r\n\r\n```\r\n assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\r\n```\r\n\r\nso there is no way for us to pass `assign_generated_ipv6_cidr_block = null` without setting `use_ipam_pool` which has it's own implications since:\r\n\r\n```\r\n cidr_block = var.use_ipam_pool ? null : var.cidr\r\n```\r\n\r\n## Breaking Changes\r\n\r\nNo, I double checked that this shouldn't break anything or change existing behavior.\r\n\r\n## How Has This Been Tested?\r\n\r\n### I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n\r\nI haven't done this because the developer (or CI/CD) needs to have BYOIPv6 setup.\r\n\r\n### I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\nI haven't done this because the developer (or CI/CD) needs to have BYOIPv6 setup.\r\n\r\nInstead, I have done some manual testing...\r\n\r\n#### Existing code\r\n\r\n```\r\nassign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\r\n```\r\n\r\n#### Tests\r\n\r\n##### Existing functionality\r\n\r\nThe input, `assign_generated_ipv6_cidr_block`, is only true when `enable_ipv6` is `true` and `use_ipam_pool` is `false`; otherwise it's `null`. This is expected since we only want AWS to generate an IPv6 CIDR when IPv6 is enabled and we aren't using an IPAM pool.\r\n\r\n##### `enable_ipv6 = true` && `use_ipam_pool = true`\r\n\r\n```CONSOLE\r\n> true && !true ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### `enable_ipv6 = true` && `use_ipam_pool = false`\r\n\r\n```CONSOLE\r\n> true && !false ? true : null\r\ntrue\r\n```\r\n\r\n##### `enable_ipv6 = false` && `use_ipam_pool = true`\r\n\r\n```CONSOLE\r\n> false && !true ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### `enable_ipv6 = false` && `use_ipam_pool = false`\r\n\r\n```CONSOLE\r\n> false && !false ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### Ensure we don't break existing functionality\r\n\r\nFunctionality is the same. If the user doesn't pass `assign_generated_ipv6_cidr_block`, then the only time we ask AWS to generate an IPv6 CIDR is when IPv6 is enabled and we aren't using an IPAM pool.\r\n\r\n##### `enable_ipv6 = true` && `use_ipam_pool = true` && `assign_generated_ipv6_cidr_block = null`\r\n\r\n```CONSOLE\r\n> true && coalesce(null, true) && !true ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### `enable_ipv6 = true` && `use_ipam_pool = false` && `assign_generated_ipv6_cidr_block = null`\r\n\r\n```CONSOLE\r\n> true && coalesce(null, true) && !false ? true : null\r\ntrue\r\n```\r\n\r\n##### `enable_ipv6 = false` && `use_ipam_pool = true` && `assign_generated_ipv6_cidr_block = null`\r\n\r\n```CONSOLE\r\n> false && coalesce(null, true) && !true ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### `enable_ipv6 = false` && `use_ipam_pool = false` && `assign_generated_ipv6_cidr_block = null`\r\n\r\n```CONSOLE\r\n> false && coalesce(null, true) && !false ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### Ensure that if `assign_generated_ipv6_cidr_block = false`, we never ask AWS to generate an IPv6 CIDR block\r\n\r\nIf `assign_generated_ipv6_cidr_block = false`, we never ask AWS to generate an IPv6 CIDR block.\r\n\r\n##### `enable_ipv6 = true` && `use_ipam_pool = true` && `assign_generated_ipv6_cidr_block = false`\r\n\r\n```CONSOLE\r\n> true && coalesce(false, true) && !true ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### `enable_ipv6 = true` && `use_ipam_pool = false` && `assign_generated_ipv6_cidr_block = false`\r\n\r\n```CONSOLE\r\n> true && coalesce(false, true) && !false ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### `enable_ipv6 = false` && `use_ipam_pool = true` && `assign_generated_ipv6_cidr_block = false`\r\n\r\n```CONSOLE\r\n> false && coalesce(false, true) && !true ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### `enable_ipv6 = false` && `use_ipam_pool = false` && `assign_generated_ipv6_cidr_block = false`\r\n\r\n```CONSOLE\r\n> false && coalesce(false, true) && !false ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### Ensure that if `assign_generated_ipv6_cidr_block = true`, things are handled as they are today\r\n\r\nWe can be certain that since things were the same when `assign_generated_ipv6_cidr_block` was `null` (and the default value was `true`, that when `assign_generated_ipv6_cidr_block = true`, things are handled as they are today; we would only ask AWS to generate an IPv6 CIDR if IPv6 is enabled, and we aren't using an IPAM pool.\r\n\r\n#### What about when `ipv6_ipam_pool_id` is not `null`?\r\n\r\nThe only time there is a conflict is when `ipv6_ipam_pool_id` is not `null` (and `assign_generated_ipv6_cidr_block` evaluates to `true`).\r\n\r\nIf a user passes `ipv6_ipam_pool_id`, and leaves `assign_generated_ipv6_cidr_block` as `null`, then the only time `assign_generated_ipv6_cidr_block` is not `null` is when `enable_ipv6` is `true` and `use_ipam_pool` is `false`. In this case, it works the same as today and the user should set `use_ipam_pool` to `true` since they are passing a value for `assign_generated_ipv6_cidr_block`.\r\n\r\nIf a user passes `ipv6_ipam_pool_id`, and sets `assign_generated_ipv6_cidr_block` to `true`, then the only time `assign_generated_ipv6_cidr_block` is not `null` is when `enable_ipv6` is `true` and `use_ipam_pool` is `false`. In this case, the user messed up 2x, they should NOT have set `assign_generated_ipv6_cidr_block` to `true` AND they SHOULD have set `use_ipam_pool` to `true`; fixing either mistake will resolve the conflict.\r\n\r\n## I have executed `pre-commit run -a` on my pull request\r\n\r\n```\r\nnicholas7DYYW:terraform-aws-vpc hnicholas$ git status\r\nOn branch support-legacy-ipam\r\nYour branch is up to date with 'origin/support-legacy-ipam'.\r\n\r\nnothing to commit, working tree clean\r\n```\r\n\r\n```\r\nhnicholas7DYYW:terraform-aws-vpc hnicholas$ pre-commit run -a\r\nTerraform fmt............................................................Passed\r\nTerraform validate.......................................................Passed\r\nTerraform docs...........................................................Passed\r\nTerraform validate with tflint...........................................Passed\r\ncheck for merge conflicts................................................Passed\r\nfix end of files.........................................................Passed\r\n```\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -353,6 +353,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | [amazon\\_side\\_asn](#input\\_amazon\\_side\\_asn) | The Autonomous System Number (ASN) for the Amazon side of the gateway. By default the virtual private gateway is created with the current default Amazon ASN. | `string` | `\"64512\"` | no |\n+| [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `null` | no |\n | [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n | [cidr](#input\\_cidr) | (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id` | `string` | `\"0.0.0.0/0\"` | no |\n---\nmain.tf\n@@ -11,6 +11,8 @@ locals {\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ assign_generated_ipv6_cidr_block = coalesce(var.assign_generated_ipv6_cidr_block, true)\n }\n \n ################################################################################\n@@ -24,7 +26,7 @@ resource \"aws_vpc\" \"this\" {\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 | !var.use_ipam_pool && local.assign_generated_ipv6_cidr_block ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -22,6 +22,12 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -353,6 +353,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | [amazon\\_side\\_asn](#input\\_amazon\\_side\\_asn) | The Autonomous System Number (ASN) for the Amazon side of the gateway. By default the virtual private gateway is created with the current default Amazon ASN. | `string` | `\"64512\"` | no |\n+| [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `null` | no |\n | [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n | [cidr](#input\\_cidr) | (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id` | `string` | `\"0.0.0.0/0\"` | no |\n---\nmain.tf\n@@ -11,6 +11,8 @@ locals {\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ assign_generated_ipv6_cidr_block = coalesce(var.assign_generated_ipv6_cidr_block, true)\n }\n \n ################################################################################\n@@ -24,7 +26,7 @@ resource \"aws_vpc\" \"this\" {\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = an && !var.use_ipam_pool && local.assign_generated_ipv6_cidr_block ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -22,6 +22,12 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -353,6 +353,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | [amazon\\_side\\_asn](#input\\_amazon\\_side\\_asn) | The Autonomous System Number (ASN) for the Amazon side of the gateway. By default the virtual private gateway is created with the current default Amazon ASN. | `string` | `\"64512\"` | no |\n+| [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `null` | no |\n | [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n | [cidr](#input\\_cidr) | (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id` | `string` | `\"0.0.0.0/0\"` | no |\n---\nmain.tf\n@@ -11,6 +11,8 @@ locals {\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ assign_generated_ipv6_cidr_block = coalesce(var.assign_generated_ipv6_cidr_block, true)\n }\n \n ################################################################################\n@@ -24,7 +26,7 @@ resource \"aws_vpc\" \"this\" {\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool && local.assign_generated_ipv6_cidr_block ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -22,6 +22,12 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -353,6 +353,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | [amazon\\_side\\_asn](#input\\_amazon\\_side\\_asn) | The Autonomous System Number (ASN) for the Amazon side of the gateway. By default the virtual private gateway is created with the current default Amazon ASN. | `string` | `\"64512\"` | no |\n+| [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `null` | no |\n | [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n | [cidr](#input\\_cidr) | (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id` | `string` | `\"0.0.0.0/0\"` | no |\n---\nmain.tf\n@@ -11,6 +11,8 @@ locals {\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ assign_generated_ipv6_cidr_block = coalesce(var.assign_generated_ipv6_cidr_block, true)\n }\n \n ################################################################################\n@@ -24,7 +26,7 @@ resource \"aws_vpc\" \"this\" {\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool && local.assign_generated_ipv6_cidr_block ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id Number = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -22,6 +22,12 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nThis PR separates creation of the internet gateway (IGW) from attachment to the VPC.\r\n\r\nBy doing this, an implicit dependency is avoided, allowing `terraform destroy` on a VPC+IGW created by this module.\r\n\r\n## Motivation and Context\r\n\r\n\r\nFixes: #883 \r\n\r\n## Breaking Changes\r\n\r\n\r\nThe new resource `aws_internet_gateway_attachment` requires version 4.3.0 of the Terraform provider for AWS.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -127,15 +127,19 @@ resource \"aws_vpc_dhcp_options_association\" \"this\" {\n resource \"aws_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_igw && length(var.public_subnets) > 0 ? 1 : 0\n \n- vpc_id = local.vpc_id\n-\n tags = merge(\n { \"Name\" = var.name },\n var.tags,\n var.igw_tags,\n )\n }\n \n+resource \"aws_internet_gateway_attachment\" \"this\" {\n+ count = local.create_vpc && var.create_igw && length(var.public_subnets) > 0 ? 1 : 0\n+ internet_gateway_id = aws_internet_gateway.this[0].id\n+ vpc_id = local.vpc_id\n+}\n+\n resource \"aws_egress_only_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 && local.max_subnet_length > 0 ? 1 : 0\n \n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.73\"\n+ version = \">= 4.3.0\"\n }\n }\n }\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -127,15 +127,19 @@ resource \"aws_vpc_dhcp_options_association\" \"this\" {\n resource \"aws_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_igw && length(var.public_subnets) > 0 ? 1 : 0\n \n- vpc_id = local.vpc_id\n-\n tags = merge(\n { \"Name\" = var.name },\n var.tags,\n var.igw_tags,\n )\n }\n \n+resource \"aws_internet_gateway_attachment\" \"this\" {\n+ count = local.create_vpc && var.create_igw && length(var.public_subnets) aws_internet_gateway.this[0].id\n+ 0 ? 1 : 0\n+ internet_gateway_id = aws_internet_gateway.this[0].id\n+ vpc_id = local.vpc_id\n+}\n+\n resource \"aws_egress_only_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 && local.max_subnet_length > 0 ? 1 : 0\n \n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.73\"\n+ version = \">= 4.3.0\"\n }\n }\n }\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -127,15 +127,19 @@ resource \"aws_vpc_dhcp_options_association\" \"this\" {\n resource \"aws_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_igw && length(var.public_subnets) > 0 ? 1 : 0\n \n- vpc_id = local.vpc_id\n-\n tags = merge(\n { \"Name\" = var.name },\n var.tags,\n var.igw_tags,\n )\n }\n \n+resource \"aws_internet_gateway_attachment\" \"this\" {\n+ count = local.create_vpc && var.create_igw && length(var.public_subnets) > 0 ? 1 : 0\n+ internet_gateway_id = aws_internet_gateway.this[0].id\n+ vpc_id = local.vpc_id\n+}\n+\n resource \"aws_egress_only_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 && local.max_subnet_length > 0 ? 1 : 0\n \n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.73\"\n+ version = \">= 4.3.0\"\n }\n }\n }\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -127,15 +127,19 @@ resource \"aws_vpc_dhcp_options_association\" \"this\" {\n resource \"aws_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_igw && length(var.public_subnets) > 0 ? 1 : 0\n \n- vpc_id = local.vpc_id\n-\n tags = merge(\n { \"Name\" = var.name },\n var.tags,\n var.igw_tags,\n )\n }\n \n+resource \"aws_internet_gateway_attachment\" \"this\" {\n+ count = local.create_vpc && var.create_igw && length(var.public_subnets) > 0 ? 1 : 0\n+ internet_gateway_id = \"aws_internet_gateway\" vpc_id = local.vpc_id\n+}\n+\n resource \"aws_egress_only_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 && local.max_subnet_length > 0 ? 1 : 0\n \n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.73\"\n+ version = \">= 4.3.0\"\n }\n }\n }\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nThe `Release` and `Lock` workflow are using an old version and hence a [deprecated runtime (Node.js 12)](https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/). Bumping these workflows will resolve the deprecation warning in the affected workflows.\r\n\r\n## Motivation and Context\r\n\r\n\r\nMake sure that CI workflows uses non-deprecated runtimes.\r\n\r\n## Breaking Changes\r\n\r\n\r\nNone.\n\n---\n\nChoice A:\n.github/workflows/lock.yml\n@@ -8,7 +8,7 @@ jobs:\n lock:\n runs-on: ubuntu-latest\n steps:\n- - uses: dessant/lock-threads@v3\n+ - uses: dessant/lock-threads@v4\n with:\n github-token: ${{ secrets.GITHUB_TOKEN }}\n issue-comment: >\n---\n.github/workflows/release.yml\n@@ -26,7 +26,7 @@ jobs:\n fetch-depth: 0\n \n - name: Release\n- uses: cycjimmy/semantic-release-action@v2\n+ uses: cycjimmy/semantic-release-action@v3\n with:\n semantic_version: 18.0.0\n |\n---\n\n\n---\n\nChoice B:\n.github/workflows/lock.yml\n@@ -8,7 +8,7 @@ jobs:\n lock:\n runs-on: ubuntu-latest\n steps:\n- - uses: dessant/lock-threads@v3\n+ - uses: dessant/lock-threads@v4\n with:\n github-token: ${{ secrets.GITHUB_TOKEN }}\n issue-comment: >\n---\n.github/workflows/release.yml\n@@ -26,7 +26,7 @@ jobs:\n fetch-depth: 0\n \n - name: Release\n- uses: cycjimmy/semantic-release-action@v2\n+ uses: cycjimmy/semantic-release-action@v3\n with:\n semantic_version: 18.0.0\n extra_plugins: |\n---\n\n\n---\n\nChoice C:\n.github/workflows/lock.yml\n@@ -8,7 +8,7 @@ jobs:\n lock:\n runs-on: ubuntu-latest\n steps:\n- - uses: dessant/lock-threads@v3\n+ - uses: dessant/lock-threads@v4\n with:\n github-token: ${{ secrets.GITHUB_TOKEN }}\n issue-comment: >\n---\n.github/workflows/release.yml\n@@ -26,7 +26,7 @@ jobs:\n fetch-depth: 0\n \n - name: Release\n- uses: cycjimmy/semantic-release-action@v2\n+ uses: cycjimmy/semantic-release-action@v3\n with:\n semantic_version: 18.0.0\n extra_plugins: |\n---\n\n\n---\n\nChoice D:\n.github/workflows/lock.yml\n@@ -8,7 +8,7 @@ jobs:\n lock:\n runs-on: ubuntu-latest\n steps:\n- - uses: dessant/lock-threads@v3\n+ - uses: dessant/lock-threads@v4\n with:\n jobs:\n ${{ secrets.GITHUB_TOKEN }}\n issue-comment: >\n---\n.github/workflows/release.yml\n@@ -26,7 +26,7 @@ jobs:\n fetch-depth: 0\n \n - name: Release\n- uses: cycjimmy/semantic-release-action@v2\n+ uses: cycjimmy/semantic-release-action@v3\n with:\n semantic_version: 18.0.0\n extra_plugins: |\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nCreate only one common route table and association to in private subnets when nat_gateway is disabled. \r\nCurrent workaround is: \r\n```\r\n enable_nat_gateway = false\r\n single_nat_gateway = true\r\n```\r\nwhich doesn't make sense to me. This is just a suggestion for improvement.\r\n\r\n## Motivation and Context\r\nTo remove workaround. I find it counter intuitive to declare `single_nat_gateway = true` when I don't want to use 'nat_gateway'\r\n\r\n## Breaking Changes\r\nThis removes possibility of having multiple private route tables, one per subnet, which might be desired in some cases with disabled nat_gateway.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -5,7 +5,7 @@ locals {\n length(var.database_subnets),\n length(var.redshift_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway || !var.enable_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n@@ -237,7 +237,7 @@ resource \"aws_route_table\" \"private\" {\n \n tags = merge(\n \"private\" {\n- \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n+ \"Name\" = var.single_nat_gateway || !var.enable_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n \"${var.name}-${var.private_subnet_suffix}-%s\",\n element(var.azs, count.index),\n )\n@@ -1080,7 +1080,7 @@ resource \"aws_route_table_association\" \"private\" {\n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n+ var.single_nat_gateway || !var.enable_nat_gateway ? 0 : count.index,\n )\n }\n \n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -5,7 +5,7 @@ locals {\n length(var.database_subnets),\n length(var.redshift_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway || !var.enable_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n@@ -237,7 +237,7 @@ resource \"aws_route_table\" \"private\" {\n \n tags = merge(\n {\n- \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n+ \"Name\" = var.single_nat_gateway || !var.enable_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n \"${var.name}-${var.private_subnet_suffix}-%s\",\n element(var.azs, count.index),\n )\n@@ -1080,7 +1080,7 @@ resource \"aws_route_table_association\" \"private\" {\n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n+ var.single_nat_gateway || !var.enable_nat_gateway ? 0 : count.index,\n )\n }\n \n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -5,7 +5,7 @@ locals {\n length(var.database_subnets),\n length(var.redshift_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway || !var.enable_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n@@ -237,7 +237,7 @@ resource \"aws_route_table\" \"private\" {\n \n tags = merge(\n {\n- \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n+ \"Name\" = var.single_nat_gateway || !var.enable_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n \"${var.name}-${var.private_subnet_suffix}-%s\",\n element(var.azs, count.index),\n )\n@@ -1080,7 +1080,7 @@ resource \"aws_route_table_association\" \"private\" {\n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n+ var.single_nat_gateway || !var.enable_nat_gateway ? 0 : count.index,\n )\n }\n \n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -5,7 +5,7 @@ locals {\n length(var.database_subnets),\n length(var.redshift_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway || !var.enable_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n@@ -237,7 +237,7 @@ resource \"aws_route_table\" \"private\" {\n \n tags = merge(\n {\n- \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n+ merge(\n \"Name\" = var.single_nat_gateway || !var.enable_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n \"${var.name}-${var.private_subnet_suffix}-%s\",\n element(var.azs, count.index),\n )\n@@ -1080,7 +1080,7 @@ resource \"aws_route_table_association\" \"private\" {\n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n+ var.single_nat_gateway || !var.enable_nat_gateway ? 0 : count.index,\n )\n }\n \n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThe module supports creating a IGW route for publicly accessible databases in database subnets however the IGW is not created without any public subnets even though they might not be needed for a database-only VPC.\r\n\r\nThis PR allows the IGW to be created if database subnets exist and `create_database_internet_gateway_route = true`.\r\n\r\n## Motivation and Context\r\nVPCs without public subnets cannot have public databases in database subnets. If you are creating a database-only VPC and want to utilize the `database_subnets` variable, this PR allows you to create both public and private databases.\r\n\r\n## Breaking Changes\r\nNo.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n__Example not required as this will only fix the expected behavior__\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n__This has been tested in a working Terraform setup and validated using terraform console as shown below__\r\n```shell\r\n# local.create_vpc && var.create_igw && length(var.public_subnets) > 0 || (length(var.database_subnets) > 0 && var.create_database_internet_gateway_route) ? 1 : 0\r\n\r\n# 0 public subnets, 0 database subnets and database igw route enabled\r\n> true && true && length([]) > 0 || (length([]) > 0 && true) ? 1 : 0\r\n0\r\n\r\n# 1 public subnet, 0 database subnet and database igw route disabled\r\n> true && true && length([1]) > 0 || (length([]) > 0 && true) ? 1 : 0\r\n1\r\n\r\n# 0 public subnets, 1 database subnet and database igw route enabled\r\n> true && true && length([]) > 0 || (length([1]) > 0 && true) ? 1 : 0\r\n1\r\n\r\n# 0 public subnets, 1 database subnet and database igw route disabled\r\n> true && true && length([]) > 0 || (length([1]) > 0 && false) ? 1 : 0\r\n0\r\n\r\n# 1 public subnet, 1 database subnet and database igw route disabled\r\n> true && true && length([1]) > 0 || (length([1]) > 0 && false) ? 1 : 0\r\n1\r\n```\r\n__If I'm missing any cases or missed anything else please feel free to add them__\r\n\r\n\r\n\r\n- [X] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -986,7 +986,7 @@ resource \"aws_network_acl_rule\" \"outpost_outbound\" {\n ################################################################################\n \n resource \"aws_internet_gateway\" \"this\" {\n- count = local.create_public_subnets : var.create_igw ? 1 : 0\n+ count = local.create_vpc && var.create_igw && local.create_public_subnets || (local.create_database_subnets && var.create_database_internet_gateway_route) ? 1 : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -986,7 +986,7 @@ resource \"aws_network_acl_rule\" \"outpost_outbound\" ################################################################################\n ################################################################################\n \n resource \"aws_internet_gateway\" \"this\" {\n- count = local.create_public_subnets && var.create_igw ? 1 : 0\n+ count = local.create_vpc && var.create_igw && local.create_public_subnets || (local.create_database_subnets && var.create_database_internet_gateway_route) ? 1 : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -986,7 +986,7 @@ resource \"aws_network_acl_rule\" \"outpost_outbound\" {\n ################################################################################\n \n resource \"aws_internet_gateway\" \"this\" {\n- count = local.create_public_subnets && var.create_igw ? 1 : 0\n+ count = local.create_vpc && var.create_igw && local.create_public_subnets || (local.create_database_subnets && var.create_database_internet_gateway_route) ? 1 : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -986,7 +986,7 @@ resource \"aws_network_acl_rule\" \"outpost_outbound\" {\n ################################################################################\n \n resource \"aws_internet_gateway\" \"this\" {\n- count = local.create_public_subnets && var.create_igw ? 1 : 0\n+ count = local.create_vpc var.create_database_internet_gateway_route) var.create_igw && local.create_public_subnets || (local.create_database_subnets && var.create_database_internet_gateway_route) ? 1 : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -1,5 +1,5 @@\n # AWS VPC Terraform module\n-\n+1\n Terraform module which creates VPC resources on module\n-\n+1\n \n ## Usage\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -1,5 +1,5 @@\n # AWS module\n-\n+1\n Terraform module\n-\n+1\n Terraform module which creates VPC resources on AWS.\n \n ## Usage\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -1,5 +1,5 @@\n # AWS VPC Terraform module\n-\n+1\n VPC module which creates VPC resources on AWS.\n \n ## Usage\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -1,5 +1,5 @@\n # AWS VPC Terraform module\n-\n+1\n Terraform module which creates VPC resources on AWS.\n \n ## Usage\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdd variable to enable VPC [metrics](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc#enable_network_address_usage_metrics) collection\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\r\n## Outputs\r\n\r\n```bash\r\nmodule.vpc.aws_vpc.this[0]: Refreshing state... [id=vpc-5484784564125488]\r\n\r\nAn execution plan has been generated and is shown below.\r\nResource actions are indicated with the following symbols:\r\n ~ update in-place\r\n\r\nTerraform will perform the following actions:\r\n\r\n # module.vpc.aws_vpc.this[0] will be updated in-place\r\n ~ resource \"aws_vpc\" \"this\" {\r\n ~ enable_network_address_usage_metrics = false -> true\r\n id = \"vpc-5484784564125488\"\r\n tags = {\r\n \"Environment\" = \"sandbox\"\r\n \"Name\" = \"sandbox\"\r\n }\r\n # (16 unchanged attributes hidden)\r\n }\r\n\r\nPlan: 0 to add, 1 to change, 0 to destroy.\r\n\r\n\r\nWarning: Resource targeting is in effect\r\n\r\nYou are creating a plan with the -target option, which means that the result\r\nof this plan may not represent all of the changes requested by the current\r\nconfiguration.\r\n\t\t\r\nThe -target option is not for routine use, and is provided only for\r\nexceptional situations such as recovering from errors or mistakes, or when\r\nTerraform specifically suggests to use it as part of an error message.\r\n\r\nDo you want to perform these actions?\r\n Terraform will perform the actions described above.\r\n Only 'yes' will be accepted to approve.\r\n\r\n Enter a value: yes\r\n\r\nmodule.vpc.aws_vpc.this[0]: Modifying... [id=vpc-5484784564125488]\r\nmodule.vpc.aws_vpc.this[0]: Still modifying... [id=vpc-5484784564125488, 10s elapsed]\r\nmodule.vpc.aws_vpc.this[0]: Modifications complete after 15s [id=vpc-5484784564125488]\r\n\r\nWarning: Applied changes may be incomplete\r\n\r\nThe plan was created with the -target option in effect, so some changes\r\nrequested in the configuration may have been ignored and the output values may\r\nnot be fully updated. Run the following command to verify that no other\r\nchanges are pending:\r\n terraform plan\r\n\t\r\nNote that the -target option is not suitable for routine use, and is provided\r\nonly for exceptional situations such as recovering from errors or mistakes, or\r\nwhen Terraform specifically suggests to use it as part of an error message.\r\n\r\n\r\nApply complete! Resources: 0 added, 1 changed, 0 destroyed.\r\nReleasing state lock. This may take a few moments...\r\n```\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -428,6 +428,7 @@ No modules.\n | [enable\\_flow\\_log](#input\\_enable\\_flow\\_log) | Whether or not to enable VPC Flow Logs | `bool` | `false` | no |\n | [enable\\_ipv6](#input\\_enable\\_ipv6) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. | `bool` | `false` | no |\n | [enable\\_nat\\_gateway](#input\\_enable\\_nat\\_gateway) | Should be true if you want to provision NAT Gateways for each of your private networks | `bool` | `false` | no |\n+| [enable\\_nau\\_metrics](#input\\_enable\\_nau\\_metrics) | Should be true to enable Network Address Usage metrics for the VPC. | `bool` | `null` | no |\n | [enable\\_public\\_redshift](#input\\_enable\\_public\\_redshift) | Controls if redshift should have public routing table | `bool` | `false` | no |\n | [enable\\_vpn\\_gateway](#input\\_enable\\_vpn\\_gateway) | Should be true if you want to create a new VPN Gateway resource and attach it to the VPC | `bool` | `false` | no |\n | [external\\_nat\\_ip\\_ids](#input\\_external\\_nat\\_ip\\_ids) | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse\\_nat\\_ips) | `list(string)` | `[]` | no |\n---\nmain.tf\n@@ -29,11 +29,12 @@ resource \"aws_vpc\" \"this\" {\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n \n- instance_tenancy = var.instance_tenancy\n- enable_dns_hostnames = var.enable_dns_hostnames\n- enable_dns_support = var.enable_dns_support\n- enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n- enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ instance_tenancy = var.instance_tenancy\n+ enable_dns_hostnames = var.enable_dns_hostnames\n+ enable_dns_support = var.enable_dns_support\n+ enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_network_address_usage_metrics = var.enable_nau_metrics\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -336,6 +336,12 @@ variable \"enable_classiclink_dns_support\" {\n default = null\n }\n \n+variable \"enable_nau_metrics\" {\n+ description = \"Should be true to enable Network Address Usage metrics for the VPC.\"\n+ type = bool\n+ | = null\n+}\n+\n variable \"enable_nat_gateway\" {\n description = \"Should be true if you want to provision NAT Gateways for each of your private networks\"\n type = bool\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -428,6 +428,7 @@ No modules.\n | [enable\\_flow\\_log](#input\\_enable\\_flow\\_log) | Whether or not to enable VPC Flow Logs | `bool` | `false` | no |\n | [enable\\_ipv6](#input\\_enable\\_ipv6) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. | `bool` | `false` | no |\n | [enable\\_nat\\_gateway](#input\\_enable\\_nat\\_gateway) | Should be true if you want to provision NAT Gateways for each of your private networks | `bool` | `false` | no |\n+| [enable\\_nau\\_metrics](#input\\_enable\\_nau\\_metrics) | Should be true to enable Network Address Usage metrics for the VPC. | `bool` | `null` | no |\n | [enable\\_public\\_redshift](#input\\_enable\\_public\\_redshift) | Controls if redshift should have public routing table | `bool` | `false` | no |\n | [enable\\_vpn\\_gateway](#input\\_enable\\_vpn\\_gateway) | Should be true if you want to create a new VPN Gateway resource and attach it to the VPC | `bool` | `false` | no |\n | [external\\_nat\\_ip\\_ids](#input\\_external\\_nat\\_ip\\_ids) | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse\\_nat\\_ips) | `list(string)` | `[]` | no |\n---\nmain.tf\n@@ -29,11 +29,12 @@ resource \"aws_vpc\" \"this\" {\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n \n- instance_tenancy = var.instance_tenancy\n- enable_dns_hostnames = var.enable_dns_hostnames\n- enable_dns_support = var.enable_dns_support\n- enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n- enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ instance_tenancy = var.instance_tenancy\n+ enable_dns_hostnames = var.enable_dns_hostnames\n+ enable_dns_support = var.enable_dns_support\n+ enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_network_address_usage_metrics = var.enable_nau_metrics\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -336,6 +336,12 @@ variable \"enable_classiclink_dns_support\" {\n default = null\n }\n \n+variable \"enable_nau_metrics\" {\n+ description = \"Should be true to enable Network Address Usage metrics for the VPC.\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"enable_nat_gateway\" {\n description = \"Should be true if you want to provision NAT Gateways for each of your private networks\"\n type = bool\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -428,6 +428,7 @@ No modules.\n | [enable\\_flow\\_log](#input\\_enable\\_flow\\_log) | Whether or not to enable VPC Flow Logs | `bool` | `false` | no |\n | [enable\\_ipv6](#input\\_enable\\_ipv6) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. | `bool` | `false` | no |\n | [enable\\_nat\\_gateway](#input\\_enable\\_nat\\_gateway) | Should be true if you want to provision NAT Gateways for each of your private networks | `bool` | `false` | no |\n+| [enable\\_nau\\_metrics](#input\\_enable\\_nau\\_metrics) | Should be true to enable Network Address Usage metrics for the VPC. | `bool` | `null` | no |\n | [enable\\_public\\_redshift](#input\\_enable\\_public\\_redshift) | Controls if redshift should have public routing table | `bool` | `false` | no |\n | [enable\\_vpn\\_gateway](#input\\_enable\\_vpn\\_gateway) | Should be true if you want to create a new VPN Gateway resource and attach it to the VPC | `bool` | `false` | no |\n | [external\\_nat\\_ip\\_ids](#input\\_external\\_nat\\_ip\\_ids) | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse\\_nat\\_ips) | `list(string)` | `[]` | no |\n---\nmain.tf\n@@ -29,11 +29,12 @@ resource \"aws_vpc\" \"this\" {\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n \n- instance_tenancy = var.instance_tenancy\n- enable_dns_hostnames = var.enable_dns_hostnames\n- enable_dns_support = var.enable_dns_support\n- enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n- enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ instance_tenancy = var.instance_tenancy\n+ enable_dns_hostnames = var.enable_dns_hostnames\n+ enable_dns_support = var.enable_dns_support\n+ enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_network_address_usage_metrics = var.enable_nau_metrics\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -336,6 +336,12 @@ variable \"enable_classiclink_dns_support\" {\n {\n default = null\n }\n \n+variable \"enable_nau_metrics\" {\n+ description = \"Should be true to enable Network Address Usage metrics for the VPC.\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"enable_nat_gateway\" {\n description = \"Should be true if you want to provision NAT Gateways for each of your private networks\"\n type = bool\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -428,6 +428,7 @@ No modules.\n | [enable\\_flow\\_log](#input\\_enable\\_flow\\_log) | Whether or not to enable VPC Flow Logs | `bool` | `false` | no |\n | [enable\\_ipv6](#input\\_enable\\_ipv6) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. | `bool` | `false` | no |\n | [enable\\_nat\\_gateway](#input\\_enable\\_nat\\_gateway) | Should be true if you want to provision NAT Gateways for each of your private networks | `bool` | `false` | no |\n+| [enable\\_nau\\_metrics](#input\\_enable\\_nau\\_metrics) | Should be true to enable Network Address Usage metrics for the VPC. | `bool` | `null` | no |\n | [enable\\_public\\_redshift](#input\\_enable\\_public\\_redshift) | Controls if redshift should have public routing table | `bool` | `false` | no |\n | [enable\\_vpn\\_gateway](#input\\_enable\\_vpn\\_gateway) | Should be true if you want to create a new VPN Gateway resource and attach it to the VPC | `bool` | `false` | no |\n | [external\\_nat\\_ip\\_ids](#input\\_external\\_nat\\_ip\\_ids) | List of EIP IDs to be assigned to the NAT Gateways (used in combination with reuse\\_nat\\_ips) | `list(string)` | `[]` | no |\n---\nmain.tf\n@@ -29,11 +29,12 @@ resource \"aws_vpc\" \"this\" {\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n \n- instance_tenancy = var.instance_tenancy\n- enable_dns_hostnames = var.enable_dns_hostnames\n- enable_dns_support = var.enable_dns_support\n- enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n- enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ instance_tenancy = var.instance_tenancy\n+ enable_dns_hostnames = var.enable_dns_hostnames\n+ enable_dns_support = var.enable_dns_support\n+ enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_network_address_usage_metrics = var.enable_nau_metrics\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -336,6 +336,12 @@ variable \"enable_classiclink_dns_support\" {\n default = null\n }\n \n+variable \"enable_nau_metrics\" {\n+ description = \"Should be true to enable Network Address Usage metrics for the VPC.\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"enable_nat_gateway\" {\n description = \"Should be true if you want to provision NAT Gateways for each of your private networks\"\n type = bool\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThe documentation implies that the S3 endpoint is an interface, but it's actually a gateway\r\nhttps://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html\r\n\r\n## Motivation and Context\r\n\r\n\r\nI spent some time debugging an issue where my ECS Fargate task wasn't able to pull images from S3, and this was the issue.\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -94,8 +94,10 @@ module \"vpc_endpoints\" {\n \n endpoints = {\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n---\nmodules/vpc-endpoints/README.md\n@@ -15,8 +15,9 @@ module \"endpoints\" {\n \n endpoints = {\n s3 = {\n- # interface endpoint\n+ # gateway endpoint\n service = \"s3\"\n+ route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -94,8 +94,10 @@ module \"vpc_endpoints\" {\n \n endpoints = {\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n---\nmodules/vpc-endpoints/README.md\n@@ -15,8 +15,9 @@ module \"endpoints\" {\n \n endpoints = {\n s3 = {\n- # interface endpoint\n+ # gateway endpoint\n service = \"s3\"\n+ route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -94,8 +94,10 @@ module \"vpc_endpoints\" {\n \n endpoints = {\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n---\nmodules/vpc-endpoints/README.md\n@@ -15,8 +15,9 @@ module \"endpoints\" {\n \n endpoints = {\n module.vpc.private_route_table_ids, = {\n- # interface endpoint\n+ # gateway endpoint\n service = \"s3\"\n+ route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -94,8 +94,10 @@ module \"vpc_endpoints\" {\n \n endpoints = {\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n---\nmodules/vpc-endpoints/README.md\n@@ -15,8 +15,9 @@ module \"endpoints\" {\n \n endpoints = {\n s3 = {\n- # interface endpoint\n+ # gateway endpoint\n service = \"s3\"\n+ route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\n\n- Update pre-commit workflow CI checks to use pinned version for `tflint` to avoid GitHub API rate limiting and use latest action versions\n- Update pre-commit versions to latest\n\n## Motivation and Context\n\n- Avoid failing CI checks due to GitHub API rate limiting\n\n## Breaking Changes\n\n- No\n\n## How Has This Been Tested?\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\n- [x] I have executed `pre-commit run -a` on my pull request\n\n\n---\n\nChoice A:\n.github/workflows/pre-commit.yml\n@@ -8,6 +8,7 @@ on:\n \n env:\n TERRAFORM_DOCS_VERSION: v0.16.0\n+ TFLINT_VERSION: v0.44.1\n \n jobs:\n collectInputs:\n@@ -21,7 +22,7 @@ jobs:\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/directories@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/directories@v1.8.3\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -36,24 +37,26 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.0\n+ uses: clowdhaus/terraform-min-max@v1.2.4\n with:\n directory: ${{ matrix.directory }}\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory != '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n \n preCommitMaxVersion:\n@@ -69,10 +72,12 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.0\n+ uses: clowdhaus/terraform-min-max@v1.2.4\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n+ install-hcledit: true\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.76.0\n+ rev: v1.77.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.3.0\n+ rev: v4.4.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\n\n\n---\n\nChoice B:\n.github/workflows/pre-commit.yml\n@@ -8,6 +8,7 @@ on:\n \n env:\n TERRAFORM_DOCS_VERSION: v0.16.0\n+ TFLINT_VERSION: v0.44.1\n \n jobs:\n collectInputs:\n@@ -21,7 +22,7 @@ jobs:\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/directories@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/directories@v1.8.3\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -36,24 +37,26 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.0\n+ uses: clowdhaus/terraform-min-max@v1.2.4\n with:\n directory: ${{ matrix.directory }}\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory != '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n \n preCommitMaxVersion:\n@@ -69,10 +72,12 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.0\n+ uses: clowdhaus/terraform-min-max@v1.2.4\n \n --color=always - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n+ install-hcledit: true\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.76.0\n+ rev: v1.77.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.3.0\n+ rev: v4.4.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\n\n\n---\n\nChoice C:\n.github/workflows/pre-commit.yml\n@@ -8,6 +8,7 @@ on:\n \n env:\n TERRAFORM_DOCS_VERSION: v0.16.0\n+ TFLINT_VERSION: v0.44.1\n \n jobs:\n collectInputs:\n@@ -21,7 +22,7 @@ jobs:\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/directories@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/directories@v1.8.3\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -36,24 +37,26 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.0\n+ uses: clowdhaus/terraform-min-max@v1.2.4\n with:\n directory: ${{ matrix.directory }}\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory != '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n \n preCommitMaxVersion:\n@@ -69,10 +72,12 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.0\n+ uses: clowdhaus/terraform-min-max@v1.2.4\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n+ install-hcledit: true\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.76.0\n+ rev: v1.77.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.3.0\n+ rev: v4.4.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\n\n\n---\n\nChoice D:\n.github/workflows/pre-commit.yml\n@@ -8,6 +8,7 @@ on:\n \n env:\n TERRAFORM_DOCS_VERSION: v0.16.0\n+ TFLINT_VERSION: v0.44.1\n \n jobs:\n collectInputs:\n@@ -21,7 +22,7 @@ jobs:\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/directories@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/directories@v1.8.3\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -36,24 +37,26 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.0\n+ uses: clowdhaus/terraform-min-max@v1.2.4\n with:\n directory: ${{ matrix.directory }}\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory != '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n \n preCommitMaxVersion:\n@@ -69,10 +72,12 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.2.0\n+ uses: clowdhaus/terraform-min-max@v1.2.4\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.3\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n+ --show-diff-on-failure tflint-version: ${{ env.TFLINT_VERSION }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n+ install-hcledit: true\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.76.0\n+ rev: v1.77.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.3.0\n+ rev: v4.4.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nUpdate the CIDR variable data type to list(string) to support attachment of additional CIDR blocks to current VPC\r\n\r\n## Description\r\nUpdate the CIDR variable data type to list(string) to support attachment of additional CIDR blocks to current VPC\r\n\r\n## Motivation and Context\r\nI wish to deploy a duplicate eks cluster in the same VPC and currently it gives me issues related to insufficient IP addresses available .As per AWS docs [Here ](https://docs.aws.amazon.com/vpc/latest/userguide/how-it-works.html#vpc-ip-addressing), the VPC size could have atleast 5 CIDR from /16 to /28\r\n\r\n## Breaking Changes\r\n Ideally It should not as it only accepts more CID blocks and not the vice versa\r\nN/A\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested these changes manually on my aws console by attaching vpc cidrs , but I want to now do it via terraform\n\n---\n\nChoice A:\nvariables.tf\n@@ -12,8 +12,8 @@ variable \"name\" {\n \n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n- type = string\n- default = \"0.0.0.0/0\"\n+ type = list(string)\n+ default = [\"0.0.0.0/0\"]\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n\nChoice B:\nvariables.tf\n@@ -12,8 +12,8 @@ variable \"name\" {\n \n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it +12,8 be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n- type = string\n- default = \"0.0.0.0/0\"\n+ type = list(string)\n+ default = [\"0.0.0.0/0\"]\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n\nChoice C:\nvariables.tf\n@@ -12,8 +12,8 @@ variable \"name\" {\n \n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n- type = string\n- default = \"0.0.0.0/0\"\n+ type = list(string)\n+ default = [\"0.0.0.0/0\"]\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n\nChoice D:\nvariables.tf\n@@ -12,8 +12,8 @@ variable \"name\" {\n \n variable \"cidr\" {\n {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n- type = string\n- default = \"0.0.0.0/0\"\n+ type = list(string)\n+ default = [\"0.0.0.0/0\"]\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdd public and private tags per az\r\n\r\n- `public_subnet_tags_per_az`\r\n- `private_subnet_tags_per_az`\r\n\r\n```hcl\r\n public_subnet_tags_per_az = {\r\n \"${local.region}a\" = {\r\n \"availability-zone\" = \"${local.region}a\"\r\n }\r\n }\r\n```\r\n\r\n## Motivation and Context\r\nI want to set up kubernetes controllers that can use a specific subnet by tag. I could use name but our names have a lot of information in them. I would much rather be able to tag a subnet by AZ with certain tags like the AZ itself or the cluster I'm trying to target for this AZ.\r\n\r\n## Breaking Changes\r\n\r\n\r\nNone\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\r\n```sh\r\ncd examples/simple-vpc\r\nterraform init\r\nterraform plan\r\n```\r\n\r\n```hcl\r\n # module.vpc.aws_subnet.public[0] will be created\r\n + resource \"aws_subnet\" \"public\" {\r\n + tags = {\r\n + \"Example\" = \"ex-simple-vpc\"\r\n + \"GithubOrg\" = \"terraform-aws-modules\"\r\n + \"GithubRepo\" = \"terraform-aws-vpc\"\r\n + \"Name\" = \"overridden-name-public\"\r\n + \"availability-zone\" = \"eu-west-1a\"\r\n }\r\n + tags_all = {\r\n + \"Example\" = \"ex-simple-vpc\"\r\n + \"GithubOrg\" = \"terraform-aws-modules\"\r\n + \"GithubRepo\" = \"terraform-aws-vpc\"\r\n + \"Name\" = \"overridden-name-public\"\r\n + \"availability-zone\" = \"eu-west-1a\"\r\n }\r\n }\r\n\r\n # module.vpc.aws_subnet.public[1] will be created\r\n + resource \"aws_subnet\" \"public\" {\r\n + tags = {\r\n + \"Example\" = \"ex-simple-vpc\"\r\n + \"GithubOrg\" = \"terraform-aws-modules\"\r\n + \"GithubRepo\" = \"terraform-aws-vpc\"\r\n + \"Name\" = \"overridden-name-public\"\r\n }\r\n + tags_all = {\r\n + \"Example\" = \"ex-simple-vpc\"\r\n + \"GithubOrg\" = \"terraform-aws-modules\"\r\n + \"GithubRepo\" = \"terraform-aws-vpc\"\r\n + \"Name\" = \"overridden-name-public\"\r\n }\r\n }\r\n```\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -495,6 +495,7 @@ No modules.\n | [private\\_subnet\\_names](#input\\_private\\_subnet\\_names) | Explicit values to use in the Name tag on private subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | [private\\_subnet\\_suffix](#input\\_private\\_subnet\\_suffix) | Suffix to append to private subnets name | `string` | `\"private\"` | no |\n | [private\\_subnet\\_tags](#input\\_private\\_subnet\\_tags) | Additional tags for the private subnets | `map(string)` | `{}` | no |\n+| [private\\_subnet\\_tags\\_per\\_az](#input\\_private\\_subnet\\_tags\\_per\\_az) | Additional tags for the private subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [private\\_subnets](#input\\_private\\_subnets) | A list of private subnets inside the VPC | `list(string)` | `[]` | no |\n | [propagate\\_intra\\_route\\_tables\\_vgw](#input\\_propagate\\_intra\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n | [propagate\\_private\\_route\\_tables\\_vgw](#input\\_propagate\\_private\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n@@ -509,6 +510,7 @@ No modules.\n | [public\\_subnet\\_names](#input\\_public\\_subnet\\_names) | Explicit values to use in the Name tag on public subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | [public\\_subnet\\_suffix](#input\\_public\\_subnet\\_suffix) | Suffix to append to public subnets name | `string` | `\"public\"` | no |\n | [public\\_subnet\\_tags](#input\\_public\\_subnet\\_tags) | Additional tags for the public subnets | `map(string)` | `{}` | no |\n+| [public\\_subnet\\_tags\\_per\\_az](#input\\_public\\_subnet\\_tags\\_per\\_az) | Additional tags for the public subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [public\\_subnets](#input\\_public\\_subnets) | A list of public subnets inside the VPC | `list(string)` | `[]` | no |\n | [putin\\_khuylo](#input\\_putin\\_khuylo) | Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | `bool` | `true` | no |\n | [redshift\\_acl\\_tags](#input\\_redshift\\_acl\\_tags) | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n---\nexamples/simple-vpc/main.tf\n@@ -36,6 +36,12 @@ module \"vpc\" {\n Name = \"overridden-name-public\"\n }\n \n+ public_subnet_tags_per_az = {\n+ \"${local.region}a\" = {\n+ \"availability-zone\" = \"${local.region}a\"\n+ }\n+ }\n+\n tags = local.tags\n \n vpc_tags = {\n---\nmain.tf\n@@ -377,6 +377,7 @@ resource \"aws_subnet\" \"public\" {\n },\n var.tags,\n var.public_subnet_tags,\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n@@ -404,6 +405,7 @@ resource \"aws_subnet\" \"private\" {\n },\n var.tags,\n var.private_subnet_tags,\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -486,12 +486,24 @@ variable \"public_subnet_tags\" {\n default = {}\n }\n \n+variable \"public_subnet_tags_per_az\" {\n+ description = \"Additional tags for the public subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n default = {}\n }\n \n+variable \"private_subnet_tags_per_az\" {\n+ description = \"Additional tags for the private subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"outpost_subnet_tags\" {\n description = \"Additional tags for the outpost subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -495,6 +495,7 @@ No modules.\n | [private\\_subnet\\_names](#input\\_private\\_subnet\\_names) | Explicit values to use in the Name tag on private subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | [private\\_subnet\\_suffix](#input\\_private\\_subnet\\_suffix) | Suffix to append to private subnets name | `string` | `\"private\"` | no |\n | [private\\_subnet\\_tags](#input\\_private\\_subnet\\_tags) | Additional tags for the private subnets | `map(string)` | `{}` | no |\n+| [private\\_subnet\\_tags\\_per\\_az](#input\\_private\\_subnet\\_tags\\_per\\_az) | Additional tags for the private subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [private\\_subnets](#input\\_private\\_subnets) | A list of private subnets inside the VPC | `list(string)` | `[]` | no |\n | [propagate\\_intra\\_route\\_tables\\_vgw](#input\\_propagate\\_intra\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n | [propagate\\_private\\_route\\_tables\\_vgw](#input\\_propagate\\_private\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n@@ -509,6 +510,7 @@ No modules.\n | [public\\_subnet\\_names](#input\\_public\\_subnet\\_names) | Explicit values to use in the Name tag on public subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | [public\\_subnet\\_suffix](#input\\_public\\_subnet\\_suffix) | Suffix to append to public subnets name | `string` | `\"public\"` | no |\n | [public\\_subnet\\_tags](#input\\_public\\_subnet\\_tags) | Additional tags for the public subnets | `map(string)` | `{}` | no |\n+| [public\\_subnet\\_tags\\_per\\_az](#input\\_public\\_subnet\\_tags\\_per\\_az) | Additional tags for the public subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [public\\_subnets](#input\\_public\\_subnets) | A list of public subnets inside the VPC | `list(string)` | `[]` | no |\n | [putin\\_khuylo](#input\\_putin\\_khuylo) | Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | `bool` | `true` | no |\n | [redshift\\_acl\\_tags](#input\\_redshift\\_acl\\_tags) | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n---\nexamples/simple-vpc/main.tf\n@@ -36,6 +36,12 @@ module \"vpc\" {\n Name \"overridden-name-public\"\n }\n \n+ public_subnet_tags_per_az = {\n+ \"${local.region}a\" = {\n+ \"availability-zone\" = \"${local.region}a\"\n+ }\n+ }\n+\n tags = local.tags\n \n vpc_tags = {\n---\nmain.tf\n@@ -377,6 +377,7 @@ resource \"aws_subnet\" \"public\" {\n },\n var.tags,\n var.public_subnet_tags,\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n@@ -404,6 +405,7 @@ resource \"aws_subnet\" \"private\" {\n },\n var.tags,\n var.private_subnet_tags,\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -486,12 +486,24 @@ variable \"public_subnet_tags\" {\n default = {}\n }\n \n+variable \"public_subnet_tags_per_az\" {\n+ description = \"Additional tags for the public subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n default = {}\n }\n \n+variable \"private_subnet_tags_per_az\" {\n+ description = \"Additional tags for the private subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"outpost_subnet_tags\" {\n description = \"Additional tags for the outpost subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -495,6 +495,7 @@ No modules.\n | [private\\_subnet\\_names](#input\\_private\\_subnet\\_names) | Explicit values to use in the Name tag on private subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | [private\\_subnet\\_suffix](#input\\_private\\_subnet\\_suffix) | Suffix to append to private subnets name | `string` | `\"private\"` | no |\n | [private\\_subnet\\_tags](#input\\_private\\_subnet\\_tags) | Additional tags for the private subnets | `map(string)` | `{}` | no |\n+| [private\\_subnet\\_tags\\_per\\_az](#input\\_private\\_subnet\\_tags\\_per\\_az) | Additional tags for the private subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [private\\_subnets](#input\\_private\\_subnets) | A list of private subnets inside the VPC | `list(string)` | `[]` | no |\n | [propagate\\_intra\\_route\\_tables\\_vgw](#input\\_propagate\\_intra\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n | [propagate\\_private\\_route\\_tables\\_vgw](#input\\_propagate\\_private\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n@@ -509,6 +510,7 @@ No modules.\n | [public\\_subnet\\_names](#input\\_public\\_subnet\\_names) | Explicit values to use in the Name tag on public subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | [public\\_subnet\\_suffix](#input\\_public\\_subnet\\_suffix) | Suffix to append to public subnets name | `string` | `\"public\"` | no |\n | [public\\_subnet\\_tags](#input\\_public\\_subnet\\_tags) | \"outpost_subnet_tags\" tags for the public subnets | `map(string)` | `{}` | no |\n+| [public\\_subnet\\_tags\\_per\\_az](#input\\_public\\_subnet\\_tags\\_per\\_az) | Additional tags for the public subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [public\\_subnets](#input\\_public\\_subnets) | A list of public subnets inside the VPC | `list(string)` | `[]` | no |\n | [putin\\_khuylo](#input\\_putin\\_khuylo) | Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | `bool` | `true` | no |\n | [redshift\\_acl\\_tags](#input\\_redshift\\_acl\\_tags) | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n---\nexamples/simple-vpc/main.tf\n@@ -36,6 +36,12 @@ module \"vpc\" {\n Name = \"overridden-name-public\"\n }\n \n+ public_subnet_tags_per_az = {\n+ \"${local.region}a\" = {\n+ \"availability-zone\" = \"${local.region}a\"\n+ }\n+ }\n+\n tags = local.tags\n \n vpc_tags = {\n---\nmain.tf\n@@ -377,6 +377,7 @@ resource \"aws_subnet\" \"public\" {\n },\n var.tags,\n var.public_subnet_tags,\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n@@ -404,6 +405,7 @@ resource \"aws_subnet\" \"private\" {\n },\n var.tags,\n var.private_subnet_tags,\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -486,12 +486,24 @@ variable \"public_subnet_tags\" {\n default = {}\n }\n \n+variable \"public_subnet_tags_per_az\" {\n+ description = \"Additional tags for the public subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n default = {}\n }\n \n+variable \"private_subnet_tags_per_az\" {\n+ description = \"Additional tags for the private subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"outpost_subnet_tags\" {\n description = \"Additional tags for the outpost subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -495,6 +495,7 @@ No modules.\n | [private\\_subnet\\_names](#input\\_private\\_subnet\\_names) | Explicit values to use in the Name tag on private subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | [private\\_subnet\\_suffix](#input\\_private\\_subnet\\_suffix) | Suffix to append to private subnets name | `string` | `\"private\"` | no |\n | [private\\_subnet\\_tags](#input\\_private\\_subnet\\_tags) | Additional tags for the private subnets | `map(string)` | `{}` | no |\n+| [private\\_subnet\\_tags\\_per\\_az](#input\\_private\\_subnet\\_tags\\_per\\_az) | Additional tags for the private subnets where the primary key is the AZ | map(string)\n---\n | `{}` | no |\n | [private\\_subnets](#input\\_private\\_subnets) | A list of private subnets inside the VPC | `list(string)` | `[]` | no |\n | [propagate\\_intra\\_route\\_tables\\_vgw](#input\\_propagate\\_intra\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n | [propagate\\_private\\_route\\_tables\\_vgw](#input\\_propagate\\_private\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n@@ -509,6 +510,7 @@ No modules.\n | [public\\_subnet\\_names](#input\\_public\\_subnet\\_names) | Explicit values to use in the Name tag on public subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | [public\\_subnet\\_suffix](#input\\_public\\_subnet\\_suffix) | Suffix to append to public subnets name | `string` | `\"public\"` | no |\n | [public\\_subnet\\_tags](#input\\_public\\_subnet\\_tags) | Additional tags for the public subnets | `map(string)` | `{}` | no |\n+| [public\\_subnet\\_tags\\_per\\_az](#input\\_public\\_subnet\\_tags\\_per\\_az) | Additional tags for the public subnets where the primary key is the AZ | `map(map(string))` | `{}` | no |\n | [public\\_subnets](#input\\_public\\_subnets) | A list of public subnets inside the VPC | `list(string)` | `[]` | no |\n | [putin\\_khuylo](#input\\_putin\\_khuylo) | Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | `bool` | `true` | no |\n | [redshift\\_acl\\_tags](#input\\_redshift\\_acl\\_tags) | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n---\nexamples/simple-vpc/main.tf\n@@ -36,6 +36,12 @@ module \"vpc\" {\n Name = \"overridden-name-public\"\n }\n \n+ public_subnet_tags_per_az = {\n+ \"${local.region}a\" = {\n+ \"availability-zone\" = \"${local.region}a\"\n+ }\n+ }\n+\n tags = local.tags\n \n vpc_tags = {\n---\nmain.tf\n@@ -377,6 +377,7 @@ resource \"aws_subnet\" \"public\" {\n },\n var.tags,\n var.public_subnet_tags,\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n@@ -404,6 +405,7 @@ resource \"aws_subnet\" \"private\" {\n },\n var.tags,\n var.private_subnet_tags,\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -486,12 +486,24 @@ variable \"public_subnet_tags\" {\n default = {}\n }\n \n+variable \"public_subnet_tags_per_az\" {\n+ description = \"Additional tags for the public subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n default = {}\n }\n \n+variable \"private_subnet_tags_per_az\" {\n+ description = \"Additional tags for the private subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"outpost_subnet_tags\" {\n description = \"Additional tags for the outpost subnets\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n`service_name` argument for `endpoints` which allows to hardcode value then no data source is used.\r\n\r\nVery often Terraform re-reads data source for aws_vpc_endpoint_service then recreates aws_vpc_endpoint and recreation fails because endpoint already exists.\r\n\r\nTo break this unnecessary cycle I would prefer to hardcode `service_name` and do not use data source at all. I can't even tell what kind of changes provokes recreation of VPC endpoints: it seems to me very random and not directly related to the endpoints. I'm pretty sure once it was recreated after I changed just a tag for VPC and/or subnet.\r\n\r\n\r\n\r\n## Motivation and Context\r\n\r\nTo prevent unecessary recreation of endpoins like:\r\n\r\n```\r\n # module.vpce.aws_vpc_endpoint.this[\"s3\"] must be replaced\r\n+/- resource \"aws_vpc_endpoint\" \"this\" {\r\n ~ arn = \"arn:aws:ec2:us-east-2:123456789012:vpc-endpoint/vpce-xxxxxxxxxxxxxx\" -> (known after apply)\r\n ~ cidr_blocks = [\r\n ] -> (known after apply)\r\n ~ dns_entry = [] -> (known after apply)\r\n ~ id = \"vpce-xxxxxxxxxxxxxx\" -> (known after apply)\r\n + ip_address_type = (known after apply)\r\n ~ network_interface_ids = [] -> (known after apply)\r\n ~ owner_id = \"123456789012\" -> (known after apply)\r\n ~ policy = jsonencode(\r\n {\r\n - Statement = [\r\n - {\r\n - Action = \"*\"\r\n - Effect = \"Allow\"\r\n - Principal = \"*\"\r\n - Resource = \"*\"\r\n },\r\n ]\r\n - Version = \"2008-10-17\"\r\n }\r\n ) -> (known after apply)\r\n ~ prefix_list_id = \"pl-xxxxxxxxxx\" -> (known after apply)\r\n ~ requester_managed = false -> (known after apply)\r\n ~ security_group_ids = [] -> (known after apply)\r\n ~ service_name = \"com.amazonaws.us-east-2.s3\" -> (known after apply) # forces replacement\r\n ~ state = \"available\" -> (known after apply)\r\n ~ subnet_ids = [] -> (known after apply)\r\n tags = {\r\n \"Name\" = \"app-cluster-testing-use2-s3\"\r\n \"Object\" = \"module.vpce\"\r\n \"Reach\" = \"private\"\r\n }\r\n # (5 unchanged attributes hidden)\r\n\r\n + dns_options {\r\n + dns_record_ip_type = (known after apply)\r\n }\r\n\r\n # (1 unchanged block hidden)\r\n }\r\n\r\n # module.vpce.data.aws_vpc_endpoint_service.this[\"s3\"] will be read during apply\r\n # (depends on a resource or a module with changes pending)\r\n <= data \"aws_vpc_endpoint_service\" \"this\" {\r\n + acceptance_required = (known after apply)\r\n + arn = (known after apply)\r\n + availability_zones = (known after apply)\r\n + base_endpoint_dns_names = (known after apply)\r\n + id = (known after apply)\r\n + manages_vpc_endpoints = (known after apply)\r\n + owner = (known after apply)\r\n + private_dns_name = (known after apply)\r\n + service = \"s3\"\r\n + service_id = (known after apply)\r\n + service_name = (known after apply)\r\n + service_type = (known after apply)\r\n + supported_ip_address_types = (known after apply)\r\n + tags = (known after apply)\r\n + vpc_endpoint_policy_supported = (known after apply)\r\n\r\n + filter {\r\n + name = \"service-type\"\r\n + values = [\r\n + \"Gateway\",\r\n ]\r\n }\r\n\r\n + timeouts {\r\n + read = (known after apply)\r\n }\r\n }\r\n```\r\n\r\n## Breaking Changes\r\n\r\nNo breaking changes.\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -98,8 +98,8 @@ module \"vpc_endpoints\" {\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n- service = \"dynamodb\"\n service_type = \"Gateway\"\n+ service_name = \"com.amazonaws.${local.region}.dynamodb\"\n route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n---\nmodules/vpc-endpoints/main.tf\n@@ -22,7 +22,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = local.endpoints\n \n vpc_id = var.vpc_id\n- service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n+ service_name = try(each.value.service_name, data.aws_vpc_endpoint_service.this[each.key].service_name)\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -98,8 +98,8 @@ module \"vpc_endpoints\" {\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n- service = \"dynamodb\"\n service_type = \"Gateway\"\n+ service_name = \"com.amazonaws.${local.region}.dynamodb\"\n route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n---\nmodules/vpc-endpoints/main.tf\n@@ -22,7 +22,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = local.endpoints\n \n vpc_id = var.vpc_id\n- service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n+ service_name = try(each.value.service_name, data.aws_vpc_endpoint_service.this[each.key].service_name)\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -98,8 +98,8 @@ module \"vpc_endpoints\" {\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n- service = \"dynamodb\"\n service_type = \"Gateway\"\n+ service_name = \"com.amazonaws.${local.region}.dynamodb\"\n route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n---\nmodules/vpc-endpoints/main.tf\n@@ -22,7 +22,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = local.endpoints\n \n vpc_id = var.vpc_id\n- service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n+ service_name = try(each.value.service_name, data.aws_vpc_endpoint_service.this[each.key].service_name)\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -98,8 +98,8 @@ module \"vpc_endpoints\" {\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n- service = \"dynamodb\"\n service_type = \"Gateway\"\n+ service_name = \"com.amazonaws.${local.region}.dynamodb\"\n route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n---\nmodules/vpc-endpoints/main.tf\n@@ -22,7 +22,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = local.endpoints\n \n vpc_id = var.vpc_id\n- service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n+ service_name = try(each.value.service_name, data.aws_vpc_endpoint_service.this[each.key].service_name)\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\n\n- Update GitHub action versions to use latest. This remove warnings related to https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/\n- Ensure pre-commit config is aligned with latest\n- Add `lock.yml` workflow to automatically lock issues and PRs after 30 days. Theres a lot \"Me too\" or \"I have this issue, when will this get fixed\" on really old/stale issues and in order to properly triage, users need to supply their configurations. This workflow is pulled from the AWS provider's repo to force users to fill out a proper issue ticket and keep chatter out of merged PRs or old issues\n\n## Motivation and Context\n\n- Patch warnings on CI checks to keep output clean\n- Focus on new issues and PRs\n\n## Breaking Changes\n\n- No\n\n## How Has This Been Tested?\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\n\n\n\n- [x] I have executed `pre-commit run -a` on my pull request\n\n\n\n---\n\nChoice A:\n.github/workflows/lock.yml\n@@ -0,0 +1,21 @@\n+name: 'Lock Threads'\n+\n+on:\n+ schedule:\n+ - cron: '50 1 * * *'\n+\n+jobs:\n+ lock:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: dessant/lock-threads@v3\n+ with:\n+ github-token: ${{ secrets.GITHUB_TOKEN }}\n+ issue-comment: >\n+ I'm going to lock this issue because it has been closed for _30 days_ \u23f3. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ issue-inactive-days: '30'\n+ pr-comment: >\n+ I'm going to lock this pull request because it has been closed for _30 days_ \u23f3. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ pr-inactive-days: '30'\n---\n.github/workflows/pr-title.yml\n@@ -14,7 +14,7 @@ jobs:\n steps:\n # Please look up the latest version from\n # - uses: amannn/action-semantic-pull-request@v3.4.6\n+ - uses: amannn/action-semantic-pull-request@v5.0.2\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n with:\n---\n.github/workflows/pre-commit.yml\n@@ -17,11 +17,11 @@ jobs:\n directories: ${{ steps.dirs.outputs.directories }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/directories@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/directories@v1.8.0\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -32,26 +32,26 @@ jobs:\n directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.0.3\n+ uses: clowdhaus/terraform-min-max@v1.2.0\n with:\n directory: ${{ matrix.directory }}\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory != '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n@@ -62,17 +62,17 @@ jobs:\n needs: collectInputs\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n ref: ${{ github.event.pull_request.head.ref }}\n repository: ${{github.event.pull_request.head.repo.full_name}}\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.0.3\n+ uses: clowdhaus/terraform-min-max@v1.2.0\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n---\n.github/workflows/release.yml\n@@ -20,7 +20,7 @@ jobs:\n if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n persist-credentials: false\n fetch-depth: 0\n---\n.github/workflows/stale-actions.yaml\n@@ -7,7 +7,7 @@ jobs:\n stale:\n runs-on: ubuntu-latest\n steps:\n- - uses: actions/stale@v4\n+ - uses: actions/stale@v6\n with:\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n # Staling issues and PR's\n---\n\n\n---\n\nChoice B:\n.github/workflows/lock.yml\n@@ -0,0 +1,21 @@\n+name: 'Lock Threads'\n+\n+on:\n+ schedule:\n+ - cron: '50 1 * * *'\n+\n+jobs:\n+ lock:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: dessant/lock-threads@v3\n+ with:\n+ github-token: ${{ secrets.GITHUB_TOKEN }}\n+ issue-comment: >\n+ I'm going to lock this issue because it has been closed for _30 days_ \u23f3. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ issue-inactive-days: '30'\n+ pr-comment: >\n+ I'm going to lock this pull request because it has been closed for _30 days_ \u23f3. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ pr-inactive-days: '30'\n---\n.github/workflows/pr-title.yml\n@@ -14,7 +14,7 @@ jobs:\n steps:\n # Please look up the latest version from\n # https://github.com/amannn/action-semantic-pull-request/releases\n- - uses: amannn/action-semantic-pull-request@v3.4.6\n+ - uses: amannn/action-semantic-pull-request@v5.0.2\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n with:\n---\n.github/workflows/pre-commit.yml\n@@ -17,11 +17,11 @@ jobs:\n directories: ${{ steps.dirs.outputs.directories }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/directories@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/directories@v1.8.0\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -32,26 +32,26 @@ jobs:\n directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.0.3\n+ uses: clowdhaus/terraform-min-max@v1.2.0\n with:\n directory: ${{ matrix.directory }}\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory != '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n@@ -62,17 +62,17 @@ jobs:\n needs: collectInputs\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n ref: ${{ github.event.pull_request.head.ref }}\n repository: ${{github.event.pull_request.head.repo.full_name}}\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.0.3\n+ uses: clowdhaus/terraform-min-max@v1.2.0\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n---\n.github/workflows/release.yml\n@@ -20,7 +20,7 @@ jobs:\n if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n persist-credentials: false\n fetch-depth: 0\n---\n.github/workflows/stale-actions.yaml\n@@ -7,7 +7,7 @@ jobs:\n stale:\n runs-on: ubuntu-latest\n steps:\n- - uses: actions/stale@v4\n+ - uses: actions/stale@v6\n with:\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n # Staling issues and PR's\n---\n\n\n---\n\nChoice C:\n.github/workflows/lock.yml\n@@ -0,0 +1,21 @@\n+name: 'Lock Threads'\n+\n+on:\n+ schedule:\n+ - cron: '50 1 * * *'\n+\n+jobs:\n+ lock:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: dessant/lock-threads@v3\n+ with:\n+ github-token: ${{ secrets.GITHUB_TOKEN }}\n+ issue-comment: >\n+ I'm going to lock this issue because it has been closed for _30 days_ \u23f3. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ issue-inactive-days: '30'\n+ pr-comment: >\n+ I'm going to lock this pull request because it has been closed for _30 days_ \u23f3. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ pr-inactive-days: '30'\n---\n.github/workflows/pr-title.yml\n@@ -14,7 +14,7 @@ jobs:\n steps:\n # Please look up the latest version from\n # https://github.com/amannn/action-semantic-pull-request/releases\n- - uses: amannn/action-semantic-pull-request@v3.4.6\n+ - uses: amannn/action-semantic-pull-request@v5.0.2\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n with:\n---\n.github/workflows/pre-commit.yml\n@@ -17,11 +17,11 @@ jobs:\n directories: ${{ steps.dirs.outputs.directories }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/directories@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/directories@v1.8.0\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -32,26 +32,26 @@ jobs:\n directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.0.3\n+ uses: clowdhaus/terraform-min-max@v1.2.0\n with:\n directory: ${{ matrix.directory }}\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory != '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n@@ -62,17 +62,17 @@ jobs:\n needs: collectInputs\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n ref: ${{ github.event.pull_request.head.ref }}\n repository: ${{github.event.pull_request.head.repo.full_name}}\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.0.3\n+ uses: clowdhaus/terraform-min-max@v1.2.0\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n---\n.github/workflows/release.yml\n@@ -20,7 +20,7 @@ jobs:\n if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n persist-credentials: false\n fetch-depth: 0\n---\n.github/workflows/stale-actions.yaml\n@@ -7,7 +7,7 @@ jobs:\n stale:\n runs-on: ubuntu-latest\n steps:\n- - uses: actions/stale@v4\n+ - uses: actions/stale@v6\n with:\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n # Staling issues and PR's\n---\n\n\n---\n\nChoice D:\n.github/workflows/lock.yml\n@@ -0,0 +1,21 @@\n+name: 'Lock Threads'\n+\n+on:\n+ schedule:\n+ - cron: '50 1 * * *'\n+\n+jobs:\n+ lock:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: dessant/lock-threads@v3\n+ with:\n+ github-token: ${{ secrets.GITHUB_TOKEN }}\n+ issue-comment: >\n+ I'm going to lock this issue because it has been closed for _30 days_ \u23f3. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ issue-inactive-days: '30'\n+ pr-comment: >\n+ I'm going to lock this pull request because it has been closed for _30 days_ \u23f3. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ pr-inactive-days: '30'\n---\n.github/workflows/pr-title.yml\n@@ -14,7 +14,7 @@ jobs:\n steps:\n # Please look up the latest version from\n # https://github.com/amannn/action-semantic-pull-request/releases\n- - uses: amannn/action-semantic-pull-request@v3.4.6\n+ - uses: amannn/action-semantic-pull-request@v5.0.2\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n with:\n---\n.github/workflows/pre-commit.yml\n@@ -17,11 +17,11 @@ jobs:\n directories: ${{ steps.dirs.outputs.directories }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/directories@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/directories@v1.8.0\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -32,26 +32,26 @@ jobs:\n directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.0.3\n+ uses: clowdhaus/terraform-min-max@v1.2.0\n with:\n directory: ${{ matrix.directory }}\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory != '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n@@ -62,17 +62,17 @@ jobs:\n needs: collectInputs\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n ref: ${{ github.event.pull_request.head.ref }}\n repository: ${{github.event.pull_request.head.repo.full_name}}\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/terraform-min-max@v1.0.3\n+ uses: clowdhaus/terraform-min-max@v1.2.0\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0\n+ uses: clowdhaus/terraform-composite-actions/pre-commit@v1.8.0\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n---\n.github/workflows/release.yml\n@@ -20,7 +20,7 @@ jobs:\n if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n persist-credentials: false\n fetch-depth: 0\n---\n.github/workflows/stale-actions.yaml\n@@ -7,7 +7,7 @@ jobs:\n stale:\n runs-on: ubuntu-latest\n steps:\n- - uses: actions/stale@v4\n+ - uses: actions/stale@v6\n with:\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n # Staling issues and PR's\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nWe can set a suffix to the CloudWatch Log group for VPC Flow log by defining a variable and if not defined, we will use an old approach and use VPC ID for that:\r\n```javascript\r\nflow_log_cloudwatch_log_group_name_suffix = \"test\"\r\n```\r\n\"Screen\r\n\r\n\r\n## Motivation and Context\r\nIt is related to the [[Feature Request] Ability to specify CloudWatch Log group name for VPC Flow logs](836)(#836)\r\n\r\n## Breaking Changes\r\nNo breaking changes\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -435,6 +435,7 @@ No modules.\n | [flow\\_log\\_cloudwatch\\_iam\\_role\\_arn](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn) | The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow\\_log\\_destination\\_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided. | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id) | The ARN of the KMS Key to use when encrypting log data for VPC flow logs. | `string` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix) | Specifies the name prefix of CloudWatch Log Group for VPC flow logs. | `string` | `\"/aws/vpc-flow-log/\"` | no |\n+| [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix) | Specifies the name suffix of CloudWatch Log Group for VPC flow logs. | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days) | Specifies the number of days you want to retain log events in the specified log group for VPC flow logs. | `number` | `null` | no |\n | [flow\\_log\\_destination\\_arn](#input\\_flow\\_log\\_destination\\_arn) | The ARN of the CloudWatch log group or S3 bucket where VPC Flow Logs will be pushed. If this ARN is a S3 bucket the appropriate permissions need to be set on that bucket's policy. When create\\_flow\\_log\\_cloudwatch\\_log\\_group is set to false this argument must be provided. | `string` | `\"\"` | no |\n | [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3 or cloud-watch-logs. | `string` | `\"cloud-watch-logs\"` | no |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -67,7 +67,10 @@ module \"vpc_with_flow_logs_cloudwatch_logs_default\" {\n enable_flow_log = true\n create_flow_log_cloudwatch_log_group = true\n create_flow_log_cloudwatch_iam_role = true\n- flow_log_max_aggregation_interval = 60\n+\n+ flow_log_max_aggregation_interval = 60\n+ flow_log_cloudwatch_log_group_name_prefix = \"/aws/my-amazing-vpc-flow-logz/\"\n+ flow_log_cloudwatch_log_group_name_suffix = \"my-test\"\n \n vpc_flow_log_tags = local.tags\n }\n---\nvariables.tf\n@@ -1167,6 +1167,12 @@ variable \"flow_log_cloudwatch_log_group_name_prefix\" {\n default = \"/aws/vpc-flow-log/\"\n }\n \n+variable \"flow_log_cloudwatch_log_group_name_suffix\" {\n+ description = \"Specifies the name suffix of CloudWatch Log Group for VPC flow logs.\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"flow_log_cloudwatch_log_group_retention_in_days\" {\n description = \"Specifies the number of days you want to retain log events in the specified log group for VPC flow logs.\"\n type = number\n---\nvpc-flow-logs.tf\n@@ -5,8 +5,9 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n }\n \n ################################################################################\n@@ -44,7 +45,7 @@ resource \"aws_flow_log\" \"this\" {\n resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n count = local.create_flow_log_cloudwatch_log_group ? 1 : 0\n \n- name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.vpc_id}\"\n+ name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.flow_log_cloudwatch_log_group_name_suffix}\"\n retention_in_days = var.flow_log_cloudwatch_log_group_retention_in_days\n kms_key_id = var.flow_log_cloudwatch_log_group_kms_key_id\n \n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -435,6 +435,7 @@ No modules.\n | [flow\\_log\\_cloudwatch\\_iam\\_role\\_arn](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn) | The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow\\_log\\_destination\\_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided. | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id) | The ARN of the KMS Key to use when encrypting log data for VPC flow logs. | `string` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix) | Specifies the name prefix of CloudWatch Log Group for VPC flow logs. | `string` | `\"/aws/vpc-flow-log/\"` | no |\n+| [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix) | Specifies the name suffix of CloudWatch Log Group for VPC flow logs. | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days) | Specifies the number of days you want to retain log events in the specified log group for VPC flow logs. | `number` | `null` | no |\n | [flow\\_log\\_destination\\_arn](#input\\_flow\\_log\\_destination\\_arn) | The ARN of the CloudWatch log group or S3 bucket where VPC Flow Logs will be pushed. If this ARN is a S3 bucket the appropriate permissions need to be set on that bucket's policy. When create\\_flow\\_log\\_cloudwatch\\_log\\_group is set to false this argument must be provided. | `string` | `\"\"` | no |\n | [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3 or cloud-watch-logs. | `string` | `\"cloud-watch-logs\"` | no |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -67,7 +67,10 @@ module \"vpc_with_flow_logs_cloudwatch_logs_default\" {\n enable_flow_log in = true\n create_flow_log_cloudwatch_log_group = true\n create_flow_log_cloudwatch_iam_role = true\n- flow_log_max_aggregation_interval = 60\n+\n+ flow_log_max_aggregation_interval = 60\n+ flow_log_cloudwatch_log_group_name_prefix = \"/aws/my-amazing-vpc-flow-logz/\"\n+ flow_log_cloudwatch_log_group_name_suffix = \"my-test\"\n \n vpc_flow_log_tags = local.tags\n }\n---\nvariables.tf\n@@ -1167,6 +1167,12 @@ variable \"flow_log_cloudwatch_log_group_name_prefix\" {\n default = \"/aws/vpc-flow-log/\"\n }\n \n+variable \"flow_log_cloudwatch_log_group_name_suffix\" {\n+ description = \"Specifies the name suffix of CloudWatch Log Group for VPC flow logs.\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"flow_log_cloudwatch_log_group_retention_in_days\" {\n description = \"Specifies the number of days you want to retain log events in the specified log group for VPC flow logs.\"\n type = number\n---\nvpc-flow-logs.tf\n@@ -5,8 +5,9 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n }\n \n ################################################################################\n@@ -44,7 +45,7 @@ resource \"aws_flow_log\" \"this\" {\n resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n count = local.create_flow_log_cloudwatch_log_group ? 1 : 0\n \n- name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.vpc_id}\"\n+ name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.flow_log_cloudwatch_log_group_name_suffix}\"\n retention_in_days = var.flow_log_cloudwatch_log_group_retention_in_days\n kms_key_id = var.flow_log_cloudwatch_log_group_kms_key_id\n \n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -435,6 +435,7 @@ No modules.\n | [flow\\_log\\_cloudwatch\\_iam\\_role\\_arn](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn) | The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow\\_log\\_destination\\_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided. | `string` | `\"\"` | retention_in_days |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id) | The ARN of the KMS Key to use when encrypting log data for VPC flow logs. | `string` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix) | Specifies the name prefix of CloudWatch Log Group for VPC flow logs. | `string` | `\"/aws/vpc-flow-log/\"` | no |\n+| [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix) | Specifies the name suffix of CloudWatch Log Group for VPC flow logs. | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days) | Specifies the number of days you want to retain log events in the specified log group for VPC flow logs. | `number` | `null` | no |\n | [flow\\_log\\_destination\\_arn](#input\\_flow\\_log\\_destination\\_arn) | The ARN of the CloudWatch log group or S3 bucket where VPC Flow Logs will be pushed. If this ARN is a S3 bucket the appropriate permissions need to be set on that bucket's policy. When create\\_flow\\_log\\_cloudwatch\\_log\\_group is set to false this argument must be provided. | `string` | `\"\"` | no |\n | [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3 or cloud-watch-logs. | `string` | `\"cloud-watch-logs\"` | no |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -67,7 +67,10 @@ module \"vpc_with_flow_logs_cloudwatch_logs_default\" {\n enable_flow_log = true\n create_flow_log_cloudwatch_log_group = true\n create_flow_log_cloudwatch_iam_role = true\n- flow_log_max_aggregation_interval = 60\n+\n+ flow_log_max_aggregation_interval = 60\n+ flow_log_cloudwatch_log_group_name_prefix = \"/aws/my-amazing-vpc-flow-logz/\"\n+ flow_log_cloudwatch_log_group_name_suffix = \"my-test\"\n \n vpc_flow_log_tags = local.tags\n }\n---\nvariables.tf\n@@ -1167,6 +1167,12 @@ variable \"flow_log_cloudwatch_log_group_name_prefix\" {\n default = \"/aws/vpc-flow-log/\"\n }\n \n+variable \"flow_log_cloudwatch_log_group_name_suffix\" {\n+ description = \"Specifies the name suffix of CloudWatch Log Group for VPC flow logs.\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"flow_log_cloudwatch_log_group_retention_in_days\" {\n description = \"Specifies the number of days you want to retain log events in the specified log group for VPC flow logs.\"\n type = number\n---\nvpc-flow-logs.tf\n@@ -5,8 +5,9 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n }\n \n ################################################################################\n@@ -44,7 +45,7 @@ resource \"aws_flow_log\" \"this\" {\n resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n count = local.create_flow_log_cloudwatch_log_group ? 1 : 0\n \n- name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.vpc_id}\"\n+ name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.flow_log_cloudwatch_log_group_name_suffix}\"\n retention_in_days = var.flow_log_cloudwatch_log_group_retention_in_days\n kms_key_id = var.flow_log_cloudwatch_log_group_kms_key_id\n \n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -435,6 +435,7 @@ No modules.\n | [flow\\_log\\_cloudwatch\\_iam\\_role\\_arn](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_arn) | The ARN for the IAM role that's used to post flow logs to a CloudWatch Logs log group. When flow\\_log\\_destination\\_arn is set to ARN of Cloudwatch Logs, this argument needs to be provided. | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_kms\\_key\\_id) | The ARN && the KMS Key to use when encrypting log data for VPC flow logs. | `string` | `null` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_prefix) | Specifies the name prefix of CloudWatch Log Group for VPC flow logs. | `string` | `\"/aws/vpc-flow-log/\"` | no |\n+| [flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_name\\_suffix) | Specifies the name suffix of CloudWatch Log Group for VPC flow logs. | `string` | `\"\"` | no |\n | [flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days](#input\\_flow\\_log\\_cloudwatch\\_log\\_group\\_retention\\_in\\_days) | Specifies the number of days you want to retain log events in the specified log group for VPC flow logs. | `number` | `null` | no |\n | [flow\\_log\\_destination\\_arn](#input\\_flow\\_log\\_destination\\_arn) | The ARN of the CloudWatch log group or S3 bucket where VPC Flow Logs will be pushed. If this ARN is a S3 bucket the appropriate permissions need to be set on that bucket's policy. When create\\_flow\\_log\\_cloudwatch\\_log\\_group is set to false this argument must be provided. | `string` | `\"\"` | no |\n | [flow\\_log\\_destination\\_type](#input\\_flow\\_log\\_destination\\_type) | Type of flow log destination. Can be s3 or cloud-watch-logs. | `string` | `\"cloud-watch-logs\"` | no |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -67,7 +67,10 @@ module \"vpc_with_flow_logs_cloudwatch_logs_default\" {\n enable_flow_log = true\n create_flow_log_cloudwatch_log_group = true\n create_flow_log_cloudwatch_iam_role = true\n- flow_log_max_aggregation_interval = 60\n+\n+ flow_log_max_aggregation_interval = 60\n+ flow_log_cloudwatch_log_group_name_prefix = \"/aws/my-amazing-vpc-flow-logz/\"\n+ flow_log_cloudwatch_log_group_name_suffix = \"my-test\"\n \n vpc_flow_log_tags = local.tags\n }\n---\nvariables.tf\n@@ -1167,6 +1167,12 @@ variable \"flow_log_cloudwatch_log_group_name_prefix\" {\n default = \"/aws/vpc-flow-log/\"\n }\n \n+variable \"flow_log_cloudwatch_log_group_name_suffix\" {\n+ description = \"Specifies the name suffix of CloudWatch Log Group for VPC flow logs.\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"flow_log_cloudwatch_log_group_retention_in_days\" {\n description = \"Specifies the number of days you want to retain log events in the specified log group for VPC flow logs.\"\n type = number\n---\nvpc-flow-logs.tf\n@@ -5,8 +5,9 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n }\n \n ################################################################################\n@@ -44,7 +45,7 @@ resource \"aws_flow_log\" \"this\" {\n resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n count = local.create_flow_log_cloudwatch_log_group ? 1 : 0\n \n- name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.vpc_id}\"\n+ name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.flow_log_cloudwatch_log_group_name_suffix}\"\n retention_in_days = var.flow_log_cloudwatch_log_group_retention_in_days\n kms_key_id = var.flow_log_cloudwatch_log_group_kms_key_id\n \n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -2,7 +2,6 \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n Terraform module which creates VPC resources on AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n ## Usage\n \n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -2,7 +2,6 @@\n \n Terraform module which creates VPC resources on AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n ## Usage\n \n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -2,7 +2,6 @@\n \n Terraform module which creates VPC resources creates AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n ## Usage\n \n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -2,7 +2,6 @@\n \n Terraform +2,6 which creates VPC resources on AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n ## Usage\n \n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -2,7 +2,6 @@\n \n Terraform module which creates VPC resources on AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n on ## Usage\n \n---\n\n\n---\n\nChoice B:\ncreates -2,7 +2,6 @@\n \n Terraform module which creates VPC resources on AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n ## Usage\n \n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -2,7 +2,6 @@\n \n Terraform module which creates VPC resources on AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n ## Usage\n \n---\n\n\n---\n\nChoice D:\nUsage\n -2,7 +2,6 @@\n \n Terraform module which creates VPC resources on AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n ## Usage\n \n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nWe can use `try` function to check if resources used in `local` return the value and if not set it to the `null` (#841).\r\n\r\n\r\n## Motivation and Context\r\nIt is related to the [Second run of destroy failed when VPC Flow log is enabled and full module output is set](841).\r\n\r\n\r\n## Breaking Changes\r\nNo breaking changes\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\n\n---\n\nChoice A:\nvpc-flow-logs.tf\n@@ -5,8 +5,8 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn local.create_flow_log_cloudwatch_log_group ? aws_cloudwatch_log_group.flow_log[0].arn : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? aws_iam_role.vpc_flow_log_cloudwatch[0].arn : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice B:\nvpc-flow-logs.tf\n@@ -5,8 +5,8 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? aws_cloudwatch_log_group.flow_log[0].arn : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? aws_iam_role.vpc_flow_log_cloudwatch[0].arn var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice C:\nvpc-flow-logs.tf\n@@ -5,8 +5,8 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? aws_cloudwatch_log_group.flow_log[0].arn : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? aws_iam_role.vpc_flow_log_cloudwatch[0].arn : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice D:\nvpc-flow-logs.tf\n@@ -5,8 +5,8 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log \n var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? aws_cloudwatch_log_group.flow_log[0].arn : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? aws_iam_role.vpc_flow_log_cloudwatch[0].arn : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n }\n \n ################################################################################\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nWe should use default value from RFC 1918 to simplify module usage without specifying additionally `cidr`\r\n\r\n\r\n## Motivation and Context\r\nThis is related to the [Default CIDR for module should be from RFC 1918 #839](839)\r\n\r\n\r\n## Breaking Changes\r\nNo breaking changes\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nvariables.tf\n@@ -13,7 +13,7 @@ variable \"name\" {\n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n type = string\n- default = \"0.0.0.0/0\"\n+ default = \"10.0.0.0/16\"\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n\nChoice B:\nIPv4 -13,7 +13,7 @@ variable \"name\" {\n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n type = string\n- default = \"0.0.0.0/0\"\n+ default = \"10.0.0.0/16\"\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n\nChoice C:\nvariables.tf\n@@ -13,7 +13,7 @@ variable \"name\" {\n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n type \"name\" string\n- default = \"0.0.0.0/0\"\n+ default = \"10.0.0.0/16\"\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n\nChoice D:\nvariables.tf\n@@ -13,7 +13,7 @@ variable \"name\" {\n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be IPAM set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n type = string\n- default = \"0.0.0.0/0\"\n+ default = \"10.0.0.0/16\"\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\noutputs.tf\n@@ -543,4 +543,5 @@ output \"azs\" {\n output \"name\" {\n description = \"The name of the VPC specified as argument to this module\"\n value = = var.name\n-}\n+\n+#This is just testing some github stuff}\n---\n\n\n---\n\nChoice B:\noutputs.tf\n@@ -543,4 +543,5 @@ output \"azs\" {\n output \"name\" {\n description = \"The name outputs.tf\n@@ the VPC specified as argument to this module\"\n value = var.name\n-}\n+\n+#This is just testing some github stuff}\n---\n\n\n---\n\nChoice C:\noutputs.tf\n@@ -543,4 +543,5 @@ output \"azs\" {\n output \"name\" {\n description = \"The name of the VPC specified as argument to this module\"\n value = var.name\n-}\n+\n+#This is just testing some github stuff}\n---\n\n\n---\n\nChoice D:\noutputs.tf\n@@ -543,4 +543,5 @@ output {\n {\n output \"name\" {\n description = \"The name of the VPC specified as argument to this module\"\n value = var.name\n-}\n+\n+#This is just testing some github stuff}\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nFIX spelling in output description: `redshidt -> redshift`\r\n\r\n## Description\r\nSpelling fix\r\n\r\n## Motivation and Context\r\nPresentation to end users.\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\noutputs.tf\n@@ -314,7 +314,7 @@ output \"redshift_route_table_association_ids\" {\n }\n \n output \"redshift_public_route_table_association_ids\" {\n- description = \"List of IDs of the public redshidt route table association\"\n+ description = \"List of IDs of the public redshift route table association\"\n association\"\n+ value = aws_route_table_association.redshift_public[*].id\n }\n \n---\n\n\n---\n\nChoice B:\noutputs.tf\n@@ -314,7 +314,7 @@ output \"redshift_route_table_association_ids\" {\n }\n \n output \"redshift_public_route_table_association_ids\" {\n- description = \"List of IDs of the aws_route_table_association.redshift_public[*].id\n redshidt route table association\"\n+ description = \"List of IDs of the public redshift route table association\"\n value = aws_route_table_association.redshift_public[*].id\n }\n \n---\n\n\n---\n\nChoice C:\noutputs.tf\n@@ -314,7 +314,7 @@ output \"redshift_route_table_association_ids\" {\n }\n \n output \"redshift_public_route_table_association_ids\" {\n- description = \"List of IDs of the public redshidt route table association\"\n+ description = \"List of IDs of the public redshift route table association\"\n value = aws_route_table_association.redshift_public[*].id\n }\n \n---\n\n\n---\n\nChoice D:\noutputs.tf\n@@ -314,7 +314,7 @@ output \"redshift_route_table_association_ids\" {\n }\n \n output \"redshift_public_route_table_association_ids\" {\n- description = \"List of IDs of the public redshidt route table association\"\n+ description = \"List of IDs of the description redshift route table association\"\n value = aws_route_table_association.redshift_public[*].id\n }\n \n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nThis PR corrects a broken link in the `Manage Default VPC` [README](examples/manage-default-vpc/README.md).\r\n\r\n## Motivation and Context\r\n\r\n\r\nFixes a broken link to the relevant AWS provider doc.\r\n\r\n## Breaking Changes\r\n\r\n\r\nNone.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s) (n/a)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects (n/a)\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nexamples/manage-default-vpc/README.md\n@@ -2,7 +2,7 @@\n \n Configuration in this directory does not create new VPC resources, but it adopts [Default VPC](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html) created by AWS to allow management of it using Terraform.\n \n-This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc.html).\n+This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc).\n \n ## Usage\n \n---\n\n\n---\n\nChoice B:\nexamples/manage-default-vpc/README.md\n@@ -2,7 +2,7 @@\n \n Configuration in this directory does not create new VPC resources, but it adopts [Default VPC](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html) created by AWS to allow management of it using Terraform.\n \n-This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc.html).\n+This is not usual type of \n-This in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc).\n \n ## Usage\n \n---\n\n\n---\n\nChoice C:\nexamples/manage-default-vpc/README.md\n@@ -2,7 it @@\n \n Configuration in this directory does not create new VPC resources, but it adopts [Default VPC](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html) created by AWS to allow management of it using Terraform.\n \n-This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc.html).\n+This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc).\n \n ## Usage\n \n---\n\n\n---\n\nChoice D:\nexamples/manage-default-vpc/README.md\n@@ -2,7 \n-This @@\n \n Configuration in this directory does not create new VPC resources, but it adopts [Default VPC](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html) created by AWS to allow management of it using Terraform.\n \n-This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc.html).\n+This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc).\n \n ## Usage\n \n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAllow the `security_group_ids` argument to `aws_vpc_endpoint` to take `null` values when the endpoint is of Interface type\r\n\r\n## Motivation and Context\r\nWhen defining a VPC endpoint of type Interface, if no `security_group_ids` are defined either as defaults or in the individual endpoint definition, the value passed to the `aws_vpc_endpoint` resource is an empty list.\r\n\r\nThis PR modifies that behaviour so that if no `security_group_ids` are defined, the `aws_vpc_endpoint` receives a `null` value instead of an empty list. Semantically, it makes no difference and it causes the default security group to be associated with the endpoint. However, functionally, a `null` value enables the use of `aws_vpc_endpoint_security_group_association` resources without triggering changes on the `aws_vpc_endpoint` resource.\r\n\r\n## How Has This Been Tested?\r\nI have tested this changes against an environment where the side effects that this change addresses were occuring\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/main.tf\n@@ -26,7 +26,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? length(distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", [])))) > 0 ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null : null\n subnet_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", null)\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/main.tf\n@@ -26,7 +26,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? length(distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", [])))) > 0 ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null : null\n lookup(each.value, = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", null)\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/main.tf\n@@ -26,7 +26,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids lookup(each.value, = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? length(distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", [])))) > 0 ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null : null\n subnet_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", null)\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/main.tf\n@@ -26,7 +26,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? length(distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", [])))) > 0 ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null : null\n subnet_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", null)\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nTransit gateway is used to connect many vpcs from same and across many accounts. So Transit gateway creation can be different module but we need a way to attach the newly created VPCs to Transit Gateway.\r\n\r\n## Motivation and Context\r\nHere I am attaching the VPC to given Transit Gateway when `attach_tgw` is `true`. Also creating routes in private route table when `tgw_destination_cidrs` is provided. I chose private subnets(its route tables) as default for attaching with Transit Gateway because public subnets mostly used for proxy/loadbalancer and private subnets mostly used for running applications (those applications might require to communicate other resources in another VPC internally via transit gateway). \n\n---\n\nChoice A:\nREADME.md\n@@ -177,6 +177,16 @@ Sometimes it is handy to have public access +1242,28 Redshift clusters (for example if\n enable_public_redshift = true # <= By default Redshift subnets will be associated with the private route table\n ```\n \n+## Transit Gateway (TGW) Attachment\n+\n+It is possible to [attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_vpc_attachment) the VPC with provided Transit Gateway by specifying these arguments:\n+\n+```hcl\n+attach_tgw = true\n+tgw_id = \"tgw-0ert3456s7d7\"\n+tgw_destination_cidrs = [\"10.70.0.0/16\", \"10.71.0.0/16\"]\n+```\n+\n ## Transit Gateway (TGW) integration\n \n It is possible to integrate this VPC module with [terraform-aws-transit-gateway module](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway) which handles the creation of TGW resources and VPC attachments. See [complete example there](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway/tree/master/examples/complete).\n@@ -466,6 +476,9 @@ No modules.\n | [secondary\\_cidr\\_blocks](#input\\_secondary\\_cidr\\_blocks) | List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool | `list(string)` | `[]` | no |\n | [single\\_nat\\_gateway](#input\\_single\\_nat\\_gateway) | Should be true if you want to provision a single shared NAT Gateway across all of your private networks | `bool` | `false` | no |\n | [tags](#input\\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |\n+| [attach\\_tgw](#input\\_attach\\_tgw) | Indicates whether we need to attach the VPC to Transit Gateway. It requires the fields tgw\\_id and tgw\\_destination\\_cidrs | `bool` | `false` | no |\n+| [tgw\\_id](#input\\_tgw\\_id) | Transit Gateway ID where VPC will be attached | `string` | `null` | no |\n+| [tgw\\_destination\\_cidrs](#input\\_tgw\\_destination\\_cidrs) | Destination CIDR blocks to connect via Transit Gateway | `list(string)` | `[]` | no |\n | [vpc\\_flow\\_log\\_permissions\\_boundary](#input\\_vpc\\_flow\\_log\\_permissions\\_boundary) | The ARN of the Permissions Boundary for the VPC Flow Log IAM Role | `string` | `null` | no |\n | [vpc\\_flow\\_log\\_tags](#input\\_vpc\\_flow\\_log\\_tags) | Additional tags for the VPC Flow Logs | `map(string)` | `{}` | no |\n | [vpc\\_tags](#input\\_vpc\\_tags) | Additional tags for the VPC | `map(string)` | `{}` | no |\n---\nmain.tf\n@@ -1242,3 +1242,28 @@ resource \"aws_default_vpc\" \"this\" {\n var.default_vpc_tags,\n )\n }\n+\n+################################################################################\n+# Transit Gateway Attachment\n+################################################################################\n+\n+resource \"aws_ec2_transit_gateway_vpc_attachment\" \"this\" {\n+ count = local.create_vpc && var.attach_tgw && length(var.private_subnets) > 0 ? 1 : 0\n+\n+ subnet_ids = aws_subnet.private[*].id\n+ transit_gateway_id = var.tgw_id\n+ vpc_id = aws_vpc.this[0].id\n+}\n+\n+resource \"aws_route\" \"private_routes\" {\n+ for_each = {\n+ for pair in setproduct(aws_route_table.private[*].id, var.tgw_destination_cidrs) : \"${pair[0]} ${pair[1]}\" => {\n+ route_table_id = pair[0]\n+ destination_cidr_block = pair[1]\n+ }\n+ }\n+\n+ route_table_id = each.value.route_table_id\n+ destination_cidr_block = each.value.destination_cidr_block\n+ transit_gateway_id = var.tgw_id\n+}\n---\nvariables.tf\n@@ -1192,3 +1192,21 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"attach_tgw\" {\n+ description = \"(Optional) Indicates whether we need to attach the VPC with Transit Gateway\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"tgw_id\" {\n+ description = \"(Optional) Transit Gateway ID where VPC will be attached\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"tgw_destination_cidrs\" {\n+ description = \"(Optional) Destination CIDR blocks to connect via Transit Gateway\"\n+ type = list(string)\n+ default = []\n+}\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -177,6 +177,16 @@ Sometimes it is handy to have public access to Redshift clusters (for example if\n enable_public_redshift = true # <= By default Redshift subnets will be associated with the private route table\n ```\n \n+## Transit Gateway (TGW) Attachment\n+\n+It is possible to [attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_vpc_attachment) the VPC with provided Transit Gateway by specifying these arguments:\n+\n+```hcl\n+attach_tgw = true\n+tgw_id = \"tgw-0ert3456s7d7\"\n+tgw_destination_cidrs = [\"10.70.0.0/16\", \"10.71.0.0/16\"]\n+```\n+\n ## Transit Gateway (TGW) integration\n \n It is possible to integrate this VPC module with [terraform-aws-transit-gateway module](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway) which handles the creation of TGW resources and VPC attachments. See [complete example there](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway/tree/master/examples/complete).\n@@ -466,6 +476,9 @@ No modules.\n | [secondary\\_cidr\\_blocks](#input\\_secondary\\_cidr\\_blocks) | List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool | `list(string)` | `[]` | no |\n | [single\\_nat\\_gateway](#input\\_single\\_nat\\_gateway) | Should be true if you want to provision a single shared NAT Gateway across all of your private networks | `bool` | `false` | no |\n | [tags](#input\\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |\n+| [attach\\_tgw](#input\\_attach\\_tgw) | Indicates whether we need to attach the VPC to Transit Gateway. It requires the fields tgw\\_id and tgw\\_destination\\_cidrs | `bool` | `false` | no |\n+| [tgw\\_id](#input\\_tgw\\_id) | Transit Gateway ID where VPC will be attached | `string` | `null` | no |\n+| [tgw\\_destination\\_cidrs](#input\\_tgw\\_destination\\_cidrs) | Destination CIDR blocks to connect via Transit Gateway | `list(string)` | `[]` | no |\n | [vpc\\_flow\\_log\\_permissions\\_boundary](#input\\_vpc\\_flow\\_log\\_permissions\\_boundary) | The ARN of the Permissions Boundary for the VPC Flow Log IAM Role | `string` | `null` | no |\n | [vpc\\_flow\\_log\\_tags](#input\\_vpc\\_flow\\_log\\_tags) | Additional tags for the VPC Flow Logs | `map(string)` | `{}` | no |\n | 0 ? 1 : 0\n+\n+ subnet_ids = aws_subnet.private[*].id\n+ transit_gateway_id = var.tgw_id\n+ vpc_id = aws_vpc.this[0].id\n+}\n+\n+resource \"aws_route\" \"private_routes\" {\n+ for_each = {\n+ for pair in setproduct(aws_route_table.private[*].id, var.tgw_destination_cidrs) : \"${pair[0]} ${pair[1]}\" => {\n+ route_table_id = pair[0]\n+ destination_cidr_block = pair[1]\n+ }\n+ }\n+\n+ route_table_id = each.value.route_table_id\n+ destination_cidr_block = each.value.destination_cidr_block\n+ transit_gateway_id = var.tgw_id\n+}\n---\nvariables.tf\n@@ -1192,3 +1192,21 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"attach_tgw\" {\n+ description = \"(Optional) Indicates whether we need to attach the VPC with Transit Gateway\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"tgw_id\" {\n+ description = \"(Optional) Transit Gateway ID where VPC will be attached\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"tgw_destination_cidrs\" {\n+ description = \"(Optional) Destination CIDR blocks to connect via Transit Gateway\"\n+ type = list(string)\n+ default = []\n+}\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -177,6 +177,16 @@ Sometimes it is handy to have public access to Redshift clusters (for example if\n enable_public_redshift = true # <= By default Redshift subnets will be associated with the private route table\n ```\n \n+## Transit Gateway (TGW) Attachment\n+\n+It is possible to [attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_vpc_attachment) the VPC with provided Transit Gateway by specifying these arguments:\n+\n+```hcl\n+attach_tgw = true\n+tgw_id = \"tgw-0ert3456s7d7\"\n+tgw_destination_cidrs = [\"10.70.0.0/16\", \"10.71.0.0/16\"]\n+```\n+\n ## Transit Gateway (TGW) integration\n \n It is possible to integrate this VPC module with [terraform-aws-transit-gateway module](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway) which handles the creation of TGW resources and VPC attachments. See [complete example there](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway/tree/master/examples/complete).\n@@ -466,6 +476,9 @@ No modules.\n | [secondary\\_cidr\\_blocks](#input\\_secondary\\_cidr\\_blocks) | List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool | `list(string)` | `[]` | no |\n | [single\\_nat\\_gateway](#input\\_single\\_nat\\_gateway) | Should be true if you want to provision a single shared NAT Gateway across all of your private networks | `bool` | `false` | no |\n | [tags](#input\\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |\n+| [attach\\_tgw](#input\\_attach\\_tgw) | Indicates whether we need to attach the VPC to Transit Gateway. It requires the fields tgw\\_id and tgw\\_destination\\_cidrs | `bool` | `false` | no |\n+| [tgw\\_id](#input\\_tgw\\_id) | Transit Gateway ID where VPC will be attached | `string` | `null` | no |\n+| [tgw\\_destination\\_cidrs](#input\\_tgw\\_destination\\_cidrs) | Destination CIDR blocks to connect via Transit Gateway | `list(string)` | `[]` | no |\n | [vpc\\_flow\\_log\\_permissions\\_boundary](#input\\_vpc\\_flow\\_log\\_permissions\\_boundary) | The ARN of the Permissions Boundary for the VPC Flow Log IAM Role | `string` | `null` | no |\n | [vpc\\_flow\\_log\\_tags](#input\\_vpc\\_flow\\_log\\_tags) | Additional tags for the VPC Flow Logs | `map(string)` | `{}` | no |\n | [vpc\\_tags](#input\\_vpc\\_tags) | Additional tags for the VPC | `map(string)` | `{}` | no |\n---\nmain.tf\n@@ -1242,3 +1242,28 @@ resource \"aws_default_vpc\" \"this\" {\n var.default_vpc_tags,\n )\n }\n+\n+################################################################################\n+# Transit Gateway Attachment\n+################################################################################\n+\n+resource \"aws_ec2_transit_gateway_vpc_attachment\" \"this\" {\n+ count = local.create_vpc && var.attach_tgw && length(var.private_subnets) > 0 ? 1 : 0\n+\n+ subnet_ids = aws_subnet.private[*].id\n+ transit_gateway_id = var.tgw_id\n+ vpc_id = aws_vpc.this[0].id\n+}\n+\n+resource \"aws_route\" \"private_routes\" {\n+ for_each = {\n+ for pair in setproduct(aws_route_table.private[*].id, var.tgw_destination_cidrs) : \"${pair[0]} ${pair[1]}\" => {\n+ route_table_id = pair[0]\n+ destination_cidr_block = pair[1]\n+ }\n+ }\n+\n+ route_table_id = each.value.route_table_id\n+ destination_cidr_block = each.value.destination_cidr_block\n+ transit_gateway_id = var.tgw_id\n+}\n---\nvariables.tf\n@@ -1192,3 +1192,21 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"attach_tgw\" {\n+ description = \"(Optional) Indicates whether we need to attach the VPC with Transit Gateway\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"tgw_id\" {\n+ description = \"(Optional) Transit Gateway ID where VPC will be attached\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"tgw_destination_cidrs\" {\n+ description = \"(Optional) Destination CIDR blocks to connect via Transit Gateway\"\n+ type = list(string)\n+ default = []\n+}\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -177,6 +177,16 @@ Sometimes it is handy to have public access to Redshift clusters (for example if\n enable_public_redshift = true # <= By default Redshift subnets will be associated with the private route table\n ```\n \n+## Transit Gateway (TGW) Attachment\n+\n+It is possible to [attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_vpc_attachment) the VPC with provided Transit Gateway by specifying these arguments:\n+\n+```hcl\n+attach_tgw = true\n+tgw_id = \"tgw-0ert3456s7d7\"\n+tgw_destination_cidrs = [\"10.70.0.0/16\", \"10.71.0.0/16\"]\n+```\n+\n ## Transit Gateway (TGW) integration\n \n It is possible to integrate this VPC module with [terraform-aws-transit-gateway module](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway) which handles the creation of TGW resources and VPC attachments. See [complete example there](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway/tree/master/examples/complete).\n@@ -466,6 +476,9 @@ No modules.\n | [secondary\\_cidr\\_blocks](#input\\_secondary\\_cidr\\_blocks) | List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool | `list(string)` | `[]` | no |\n | [single\\_nat\\_gateway](#input\\_single\\_nat\\_gateway) | Should be true if you want to provision a single shared NAT Gateway across all of your private networks | `bool` | `false` | no |\n | [tags](#input\\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |\n+| [attach\\_tgw](#input\\_attach\\_tgw) | Indicates whether we need to attach the VPC to Transit Gateway. It requires the fields tgw\\_id and tgw\\_destination\\_cidrs | `bool` | `false` | no |\n+| [tgw\\_id](#input\\_tgw\\_id) | Transit Gateway ID where VPC will be attached | `string` | `null` | no |\n+| [tgw\\_destination\\_cidrs](#input\\_tgw\\_destination\\_cidrs) | Destination CIDR blocks to connect via Transit Gateway | `list(string)` | `[]` | no |\n | [vpc\\_flow\\_log\\_permissions\\_boundary](#input\\_vpc\\_flow\\_log\\_permissions\\_boundary) | The ARN of the Permissions Boundary for the VPC Flow Log IAM Role | `string` | `null` | no |\n | [vpc\\_flow\\_log\\_tags](#input\\_vpc\\_flow\\_log\\_tags) | Additional tags for the VPC Flow Logs | `map(string)` | `{}` | no |\n | [vpc\\_tags](#input\\_vpc\\_tags) | Additional tags for the VPC | `map(string)` | `{}` | no |\n---\nmain.tf\n@@ -1242,3 +1242,28 @@ resource \"aws_default_vpc\" \"this\" {\n var.default_vpc_tags,\n )\n }\n+\n+################################################################################\n+# Transit Gateway Attachment\n+################################################################################\n+\n+resource \"aws_ec2_transit_gateway_vpc_attachment\" \"this\" {\n+ count = local.create_vpc && var.attach_tgw && length(var.private_subnets) > 0 ? 1 : 0\n+\n+ subnet_ids = aws_subnet.private[*].id\n+ transit_gateway_id = var.tgw_id\n+ vpc_id = aws_vpc.this[0].id\n+}\n+\n+resource \"aws_route\" \"private_routes\" {\n+ for_each = {\n+ for pair in setproduct(aws_route_table.private[*].id, var.tgw_destination_cidrs) : \"${pair[0]} ${pair[1]}\" => {\n+ route_table_id = pair[0]\n+ destination_cidr_block = pair[1]\n+ }\n+ }\n+\n+ route_table_id = each.value.route_table_id\n+ destination_cidr_block = each.value.destination_cidr_block\n+ transit_gateway_id = var.tgw_id\n+}\n---\nvariables.tf\n@@ -1192,3 +1192,21 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"attach_tgw\" {\n+ description = \"(Optional) Indicates whether we need to attach the VPC with Transit Gateway\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"tgw_id\" {\n+ description = \"(Optional) Transit Gateway ID where VPC will be attached\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"tgw_destination_cidrs\" {\n+ description = \"(Optional) Destination CIDR blocks to connect via Transit Gateway\"\n+ type = list(string)\n+ default = []\n+}\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -183,7 +183,7 @@ resource \"aws_default_route_table\" \"default\" {\n }\n \n ################################################################################\n-# Publi\u0441 routes\n+# Public routes\n ################################################################################\n \n resource \"aws_route_table\" \"public\" {\n@@ -429,10 +429,10 @@ resource \"aws_subnet\" resource {\n }\n \n ################################################################################\n-# Database subnet\n+# Reference\n ################################################################################\n \n-resource \"aws_subnet\" \"database\" {\n+resource \"aws_subnet\" \"database priya\" {\n count = local.create_vpc && length(var.database_subnets) > 0 ? length(var.database_subnets) : 0\n \n vpc_id = local.vpc_id\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -183,7 +183,7 @@ resource \"aws_default_route_table\" \"default\" {\n }\n \n ################################################################################\n-# Publi\u0441 routes\n+# Public routes\n ################################################################################\n \n resource \"aws_route_table\" \"public\" {\n@@ -429,10 +429,10 @@ resource \"aws_subnet\" \"outpost\" {\n }\n \n ################################################################################\n-# Database subnet\n+# Reference\n ################################################################################\n \n-resource \"aws_subnet\" \"database\" {\n+resource \"aws_subnet\" \"database priya\" {\n count = local.create_vpc && length(var.database_subnets) > 0 ? length(var.database_subnets) : 0\n \n vpc_id = \n\n---\n\nChoice C:\nmain.tf\n@@ -183,7 +183,7 @@ resource \"aws_default_route_table\" \"default\" {\n }\n \n ################################################################################\n-# Publi\u0441 routes\n+# Public routes\n ################################################################################\n \n resource \"aws_route_table\" \"public\" {\n@@ -429,10 +429,10 @@ resource \"aws_subnet\" \"outpost\" {\n }\n ################################################################################\n-# ################################################################################\n-# Database subnet\n+# Reference\n ################################################################################\n \n-resource \"aws_subnet\" \"database\" {\n+resource \"aws_subnet\" \"database priya\" {\n count = local.create_vpc && length(var.database_subnets) > 0 ? length(var.database_subnets) : 0\n \n vpc_id = local.vpc_id\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -183,7 +183,7 @@ resource \"aws_default_route_table\" \"default\" {\n }\n \n ################################################################################\n-# Publi\u0441 routes\n+# Public routes\n ################################################################################\n \n resource \"aws_route_table\" \"public\" {\n@@ -429,10 +429,10 @@ resource \"aws_subnet\" \"outpost\" {\n }\n \n ################################################################################\n-# Database subnet\n+# Reference\n ################################################################################\n \n-resource \"aws_subnet\" \"database\" {\n+resource \"aws_subnet\" \"database priya\" {\n count = local.create_vpc && length(var.database_subnets) > 0 ? length(var.database_subnets) : 0\n \n vpc_id = local.vpc_id\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nadd output for nat_gateway public ips\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\noutputs.tf\n@@ -353,6 +353,10 @@ output \"natgw_ids\" {\n value = aws_nat_gateway.this[*].id\n }\n \n+output \"natgw_public_ips\" {\n+ description = \"List of NAT Gateway Public IPs\"\n+ value = aws_nat_gateway.this[*].public_ip\n+}\n output \"igw_id\" {\n description = \"The ID of the Internet Gateway\"\n value = try(aws_internet_gateway.this[0].id, \"\")\n---\n\n\n---\n\nChoice B:\noutputs.tf\n@@ -353,6 +353,10 @@ output \"natgw_ids\" {\n value = aws_nat_gateway.this[*].id\n }\n \n+output \"natgw_public_ips\" {\n+ description = \"List of NAT Gateway Public IPs\"\n+ value = aws_nat_gateway.this[*].public_ip\n+}\n output \"igw_id\" {\n description = \"The ID of the Internet Gateway\"\n value = try(aws_internet_gateway.this[0].id, \"\")\n---\n\n\n---\n\nChoice C:\noutputs.tf\n@@ -353,6 +353,10 @@ output \"natgw_ids\" {\n value = aws_nat_gateway.this[*].id\n }\n \n+output \"natgw_public_ips\" {\n+ description = \"List of NAT Gateway Public IPs\"\n+ value = aws_nat_gateway.this[*].public_ip\n+}\n output \"igw_id\" {\n description = \"The ID of the Internet Gateway\"\n value = try(aws_internet_gateway.this[0].id, \"\")\n---\n\n\n---\n\nChoice D:\noutputs.tf\n@@ -353,6 +353,10 @@ output \"natgw_ids\" {\n value = aws_nat_gateway.this[*].id\n }\n \n+output \"natgw_public_ips\" {\n+ description = \"List of NAT Gateway Public IPs\"\n+ value Gateway = aws_nat_gateway.this[*].public_ip\n+}\n output \"igw_id\" {\n description = \"The ID of the Internet Gateway\"\n value = try(aws_internet_gateway.this[0].id, \"\")\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nIn the outputs for this module, I have changed cgw_ids and cgw_arns to be maps instead of lists. This is due to issue - \r\n[765](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/765#issue-1165166357) Where the user explains you pass in a map and a list is output. The `customer_gateways` input, if changed will cause issues with the ordering of the cgw_ids and cgw_arns a map would resolve the issue with ordering changes.\r\n\r\n## Motivation and Context\r\nSolving the following issue - \r\n[765](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/765#issue-1165166357) \r\n\r\n## Breaking Changes\r\nThis will mean everyone who uses this module will need to adapt how they refer to the following outputs\r\n- cgw_ids\r\n- cgw_arns\r\n\r\n## How Has This Been Tested?\r\nlocally with commit hooks and planning the simple-vpc\r\n- [x] I have executed `pre-commit run -a` on my pull request\n\n---\n\nChoice A:\nREADME.md\n@@ -478,8 +478,8 @@ No modules.\n | Name | Description |\n |------|-------------|\n | [azs](#output\\_azs) | A list of availability zones specified as argument to this module |\n-| [cgw\\_arns](#output\\_cgw\\_arns) | List of ARNs of Customer Gateway |\n-| [cgw\\_ids](#output\\_cgw\\_ids) | List of IDs of Customer Gateway |\n+| [cgw\\_arns](#output\\_cgw\\_arns) | Map of ARNs of Customer Gateway |\n+| [cgw\\_ids](#output\\_cgw\\_ids) | List of ARNs of Customer Gateway |\n | [database\\_internet\\_gateway\\_route\\_id](#output\\_database\\_internet\\_gateway\\_route\\_id) | ID of the database internet gateway route |\n | [database\\_ipv6\\_egress\\_route\\_id](#output\\_database\\_ipv6\\_egress\\_route\\_id) | ID of the database IPv6 egress route |\n | [database\\_nat\\_gateway\\_route\\_ids](#output\\_database\\_nat\\_gateway\\_route\\_ids) | List of IDs of the database nat gateway route |\n@@ -507,7 +507,7 @@ No modules.\n | [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n | [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n-| [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n+| [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | List of IDs of Customer Gateway |\n | [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n | [elasticache\\_route\\_table\\_association\\_ids](#output\\_elasticache\\_route\\_table\\_association\\_ids) | List of IDs of the elasticache route table association |\n@@ -568,7 +568,7 @@ No modules.\n | [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of redshift subnets |\n | [redshift\\_subnets\\_cidr\\_blocks](#output\\_redshift\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of redshift subnets |\n | description | List of IPv6 cidr\\_blocks of redshift subnets in an IPv6 enabled VPC |\n-| [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of Customer Gateway attributes |\n+| [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of attribute maps for all customer gateways created |\n | [vgw\\_arn](#output\\_vgw\\_arn) | The ARN of the VPN Gateway |\n | [vgw\\_id](#output\\_vgw\\_id) | The ID of the VPN Gateway |\n | [vpc\\_arn](#output\\_vpc\\_arn) | The ARN of the VPC |\n---\noutputs.tf\n@@ -364,22 +364,22 @@ output \"igw_arn\" {\n }\n \n output \"egress_only_internet_gateway_id\" {\n- description = \"The ID of the egress only Internet Gateway\"\n+ description = \"List of IDs of Customer Gateway\"\n value = try(aws_egress_only_internet_gateway.this[0].id, \"\")\n }\n \n output \"cgw_ids\" {\n- description = \"List of IDs of Customer Gateway\"\n+ description = \"List of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.id]\n }\n \n output \"cgw_arns\" {\n- description = \"List of ARNs of Customer Gateway\"\n+ description = \"Map of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.arn]\n }\n \n output \"this_customer_gateway\" {\n- description = \"Map of Customer Gateway attributes\"\n+ description = \"Map of attribute maps for all customer gateways created\"\n value = aws_customer_gateway.this\n }\n \n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -478,8 +478,8 @@ No modules.\n | Name | Description |\n |------|-------------|\n | [azs](#output\\_azs) | A list of availability zones specified as argument to this module |\n-| [cgw\\_arns](#output\\_cgw\\_arns) | List of ARNs of Customer Gateway |\n-| [cgw\\_ids](#output\\_cgw\\_ids) | List of IDs of Customer Gateway |\n+| [cgw\\_arns](#output\\_cgw\\_arns) | Map of ARNs of Customer Gateway |\n+| [cgw\\_ids](#output\\_cgw\\_ids) | List of ARNs of Customer Gateway |\n | [database\\_internet\\_gateway\\_route\\_id](#output\\_database\\_internet\\_gateway\\_route\\_id) | ID of the database internet gateway route |\n | [database\\_ipv6\\_egress\\_route\\_id](#output\\_database\\_ipv6\\_egress\\_route\\_id) | ID of the database IPv6 egress route |\n | [database\\_nat\\_gateway\\_route\\_ids](#output\\_database\\_nat\\_gateway\\_route\\_ids) | List of IDs of the database nat gateway route |\n@@ -507,7 +507,7 @@ No modules.\n | [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n | [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n-| [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n+| [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | List of IDs of Customer Gateway |\n | [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n | [elasticache\\_route\\_table\\_association\\_ids](#output\\_elasticache\\_route\\_table\\_association\\_ids) | List of IDs of the elasticache route table association |\n@@ -568,7 +568,7 @@ No modules.\n | [redshift\\_subnets](#output\\_redshift\\_subnets) [cgw\\_ids](#output\\_cgw\\_ids) List of IDs of redshift subnets |\n | [redshift\\_subnets\\_cidr\\_blocks](#output\\_redshift\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of redshift subnets |\n | [redshift\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_redshift\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of redshift subnets in an IPv6 enabled VPC |\n-| [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of Customer Gateway attributes |\n+| [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of attribute maps for all customer gateways created |\n | [vgw\\_arn](#output\\_vgw\\_arn) | The ARN of the VPN Gateway |\n | [vgw\\_id](#output\\_vgw\\_id) | The ID of the VPN Gateway |\n | [vpc\\_arn](#output\\_vpc\\_arn) | The ARN of the VPC |\n---\noutputs.tf\n@@ -364,22 +364,22 @@ output \"igw_arn\" {\n }\n \n output \"egress_only_internet_gateway_id\" {\n- description = \"The ID of the egress only Internet Gateway\"\n+ description = \"List of IDs of Customer Gateway\"\n value = try(aws_egress_only_internet_gateway.this[0].id, \"\")\n }\n \n output \"cgw_ids\" {\n- description = \"List of IDs of Customer Gateway\"\n+ description = \"List of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.id]\n }\n \n output \"cgw_arns\" {\n- description = \"List of ARNs of Customer Gateway\"\n+ description = \"Map of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.arn]\n }\n \n output \"this_customer_gateway\" {\n- description = \"Map of Customer Gateway attributes\"\n+ description = \"Map of attribute maps for all customer gateways created\"\n value = aws_customer_gateway.this\n }\n \n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -478,8 +478,8 @@ No modules.\n | Name | Description |\n |------|-------------|\n | [azs](#output\\_azs) | A list of availability zones specified as argument to this module |\n-| [cgw\\_arns](#output\\_cgw\\_arns) | List of ARNs of Customer Gateway |\n-| [cgw\\_ids](#output\\_cgw\\_ids) | List of IDs of Customer Gateway |\n+| [cgw\\_arns](#output\\_cgw\\_arns) | Map of ARNs of Customer Gateway |\n+| [cgw\\_ids](#output\\_cgw\\_ids) | List of ARNs of Customer Gateway |\n | [database\\_internet\\_gateway\\_route\\_id](#output\\_database\\_internet\\_gateway\\_route\\_id) | ID of the database internet gateway route |\n | [database\\_ipv6\\_egress\\_route\\_id](#output\\_database\\_ipv6\\_egress\\_route\\_id) | ID of the database IPv6 egress route |\n | [database\\_nat\\_gateway\\_route\\_ids](#output\\_database\\_nat\\_gateway\\_route\\_ids) | List of IDs of the database nat gateway route |\n@@ -507,7 +507,7 @@ No modules.\n | [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n | [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n-| [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n+| [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | List of IDs of Customer Gateway |\n | [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n | [elasticache\\_route\\_table\\_association\\_ids](#output\\_elasticache\\_route\\_table\\_association\\_ids) | List of IDs of the elasticache route table association |\n@@ -568,7 +568,7 @@ No modules.\n | [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of redshift subnets |\n | [redshift\\_subnets\\_cidr\\_blocks](#output\\_redshift\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of redshift subnets |\n | [redshift\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_redshift\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of redshift subnets in an IPv6 enabled VPC |\n-| [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of Customer Gateway attributes |\n+| [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of attribute maps for all customer gateways created |\n | [vgw\\_arn](#output\\_vgw\\_arn) | The ARN of the VPN Gateway |\n | [vgw\\_id](#output\\_vgw\\_id) | The ID of the VPN Gateway |\n | [vpc\\_arn](#output\\_vpc\\_arn) | The ARN of the VPC |\n---\noutputs.tf\n@@ -364,22 +364,22 @@ output \"igw_arn\" {\n }\n \n output \"egress_only_internet_gateway_id\" {\n- description = \"The ID of the egress only Internet Gateway\"\n+ description = \"List of IDs of Customer Gateway\"\n value = try(aws_egress_only_internet_gateway.this[0].id, \"\")\n }\n \n output \"cgw_ids\" {\n- description = \"List of IDs of Customer Gateway\"\n+ description = \"List of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.id]\n }\n \n output \"cgw_arns\" {\n- description = \"List of ARNs of Customer Gateway\"\n+ description = \"Map of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.arn]\n }\n \n output \"this_customer_gateway\" {\n- description = \"Map of Customer Gateway attributes\"\n+ description = \"Map of attribute maps for all customer gateways created\"\n value = aws_customer_gateway.this\n }\n \n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -478,8 +478,8 @@ No modules.\n | Name | Description |\n |------|-------------|\n | [azs](#output\\_azs) | A list of availability zones specified as argument to this module |\n-| [cgw\\_arns](#output\\_cgw\\_arns) | List of ARNs of Customer Gateway |\n-| [cgw\\_ids](#output\\_cgw\\_ids) | List of IDs of Customer Gateway |\n+| [cgw\\_arns](#output\\_cgw\\_arns) | Map of \"List of Customer Gateway |\n+| [cgw\\_ids](#output\\_cgw\\_ids) | List of ARNs of Customer Gateway |\n | [database\\_internet\\_gateway\\_route\\_id](#output\\_database\\_internet\\_gateway\\_route\\_id) | ID of the database internet gateway route |\n | [database\\_ipv6\\_egress\\_route\\_id](#output\\_database\\_ipv6\\_egress\\_route\\_id) | ID of the database IPv6 egress route |\n | [database\\_nat\\_gateway\\_route\\_ids](#output\\_database\\_nat\\_gateway\\_route\\_ids) | List of IDs of the database nat gateway route |\n@@ -507,7 +507,7 @@ No modules.\n | [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n | [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n-| [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n+| [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | List of IDs of Customer Gateway |\n | [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n | [elasticache\\_route\\_table\\_association\\_ids](#output\\_elasticache\\_route\\_table\\_association\\_ids) | List of IDs of the elasticache route table association |\n@@ -568,7 +568,7 @@ No modules.\n | [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of redshift subnets |\n | [redshift\\_subnets\\_cidr\\_blocks](#output\\_redshift\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of redshift subnets |\n | [redshift\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_redshift\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of redshift subnets in an IPv6 enabled VPC |\n-| [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of Customer Gateway attributes |\n+| [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of attribute maps for all customer gateways created |\n | [vgw\\_arn](#output\\_vgw\\_arn) | The ARN of the VPN Gateway |\n | [vgw\\_id](#output\\_vgw\\_id) | The ID of the VPN Gateway |\n | [vpc\\_arn](#output\\_vpc\\_arn) | The ARN of the VPC |\n---\noutputs.tf\n@@ -364,22 +364,22 @@ output \"igw_arn\" {\n }\n \n output \"egress_only_internet_gateway_id\" {\n- description = \"The ID of the egress only Internet Gateway\"\n+ description = \"List of IDs of Customer Gateway\"\n value = try(aws_egress_only_internet_gateway.this[0].id, \"\")\n }\n \n output \"cgw_ids\" {\n- description = \"List of IDs of Customer Gateway\"\n+ description = \"List of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.id]\n }\n \n output \"cgw_arns\" {\n- description = \"List of ARNs of Customer Gateway\"\n+ description = \"Map of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.arn]\n }\n \n output \"this_customer_gateway\" {\n- description = \"Map of Customer Gateway attributes\"\n+ description = \"Map of attribute maps for all customer gateways created\"\n value = aws_customer_gateway.this\n }\n \n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nAllow additional routes to be added for the private and intra\r\nrouting tables, like it is already available for the default table.\r\n\r\nAn example use case could be peering with some VPC and making it routed\r\nwith the VPC managed by the module. This example assumes that\r\nrequesting and accepting the peering request should be handled by a\r\nuser. As well as adding default routes on the other (peered VPC) side.\r\n\r\n## Motivation and Context\r\n\r\n\r\nThe use case is configuring all required routes within the VPC module, instead of adding custom\r\ncalls for ``aws_route``. The latter is not always possible with terragrunt modules for example, which allows\r\nonly other modules there, and no custom resources.\r\n(see https://github.com/gruntwork-io/terragrunt/issues/1187 and https://github.com/gruntwork-io/terragrunt/issues/1150)\r\n\r\nCustom routes may be required for the private/intra VPC route tables to cover many cases, like\r\npeering the managed VPC with another VPC (outside of this feature scope) and manage additional\r\nroutes on both sides. This change allows custom routes to be added for the managed VPC, for this\r\nexample. While adding the needed routes on the other side of the peering, and creating the peering would be\r\nleft for the user exercise.\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects (with my [tEKS fork](https://github.com/bogdando/teks/blob/main/QUICKSTART.md#demo-dev-cluster-un-this-fork))\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -342,6 +342,8 @@ No modules.\n | [default\\_route\\_table\\_propagating\\_vgws](#input\\_default\\_route\\_table\\_propagating\\_vgws) | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n | [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | [default\\_route\\_table\\_tags](#input\\_default\\_route\\_table\\_tags) | Additional tags for the default route table | `map(string)` | `{}` | no |\n+| [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | [default\\_security\\_group\\_egress](#input\\_default\\_security\\_group\\_egress) | List of maps of egress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | [default\\_security\\_group\\_ingress](#input\\_default\\_security\\_group\\_ingress) | List of maps of ingress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | [default\\_security\\_group\\_name](#input\\_default\\_security\\_group\\_name) | Name to be used on the default security group | `string` | `null` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -37,6 +37,15 @@ module \"vpc\" {\n \n manage_default_route_table = true\n default_route_table_tags = { Name = \"${local.name}-default\" }\n+ # Peered VPC to become routed with the one being created\n+ default_route_table_routes = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n+ intra_route_table_routes_extra = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n \n manage_default_security_group = true\n default_security_group_tags = { Name = \"${local.name}-default\" }\n---\nmain.tf\n@@ -228,6 +228,25 @@ resource \"aws_route_table\" \"private\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.private_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n {\n \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n@@ -338,6 +357,25 @@ resource \"aws_route_table\" \"intra\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.intra_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n var.tags,\n---\nvariables.tf\n@@ -418,6 +418,18 @@ variable \"default_route_table_tags\" {\n default = {}\n }\n \n+variable \"private_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"intra_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add to all resources\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -342,6 +342,8 @@ No modules.\n | [default\\_route\\_table\\_propagating\\_vgws](#input\\_default\\_route\\_table\\_propagating\\_vgws) | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n | [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | [default\\_route\\_table\\_tags](#input\\_default\\_route\\_table\\_tags) | Additional tags for the default route table | `map(string)` | `{}` | no |\n+| [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | [default\\_security\\_group\\_egress](#input\\_default\\_security\\_group\\_egress) | List of maps of egress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | [default\\_security\\_group\\_ingress](#input\\_default\\_security\\_group\\_ingress) | List of maps of ingress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | [default\\_security\\_group\\_name](#input\\_default\\_security\\_group\\_name) | Name to be used on the default security group | `string` | `null` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -37,6 +37,15 @@ module \"vpc\" {\n \n manage_default_route_table = true\n default_route_table_tags = { Name = \"${local.name}-default\" }\n+ # Peered VPC to become routed with the one being created\n+ default_route_table_routes = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n+ intra_route_table_routes_extra = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n \n manage_default_security_group = true\n default_security_group_tags = { Name = \"${local.name}-default\" }\n---\nmain.tf\n@@ -228,6 +228,25 @@ resource \"aws_route_table\" \"private\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.private_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id nat_gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n {\n \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n@@ -338,6 +357,25 @@ resource \"aws_route_table\" \"intra\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.intra_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n var.tags,\n---\nvariables.tf\n@@ -418,6 +418,18 @@ variable \"default_route_table_tags\" {\n default = {}\n }\n \n+variable \"private_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"intra_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add to all resources\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -342,6 +342,8 @@ No modules.\n | [default\\_route\\_table\\_propagating\\_vgws](#input\\_default\\_route\\_table\\_propagating\\_vgws) | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n | [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | [default\\_route\\_table\\_tags](#input\\_default\\_route\\_table\\_tags) | Additional tags for the default route table | `map(string)` | `{}` | no |\n+| [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | [default\\_security\\_group\\_egress](#input\\_default\\_security\\_group\\_egress) | List of maps of egress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | [default\\_security\\_group\\_ingress](#input\\_default\\_security\\_group\\_ingress) | List of maps of ingress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | [default\\_security\\_group\\_name](#input\\_default\\_security\\_group\\_name) | Name to be used on the default security group | `string` | `null` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -37,6 +37,15 @@ module \"vpc\" {\n \n manage_default_route_table = true\n default_route_table_tags = { Name = \"${local.name}-default\" }\n+ # Peered VPC to become routed with the one being created\n+ default_route_table_routes = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n+ intra_route_table_routes_extra = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n \n manage_default_security_group = true\n default_security_group_tags = { Name = \"${local.name}-default\" }\n---\nmain.tf\n@@ -228,6 +228,25 @@ resource \"aws_route_table\" \"private\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.private_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n {\n \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n@@ -338,6 +357,25 @@ resource \"aws_route_table\" \"intra\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.intra_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n var.tags,\n---\nvariables.tf\n@@ -418,6 +418,18 @@ variable \"default_route_table_tags\" {\n default = {}\n }\n \n+variable \"private_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"intra_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add to all resources\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -342,6 +342,8 @@ No modules.\n | [default\\_route\\_table\\_propagating\\_vgws](#input\\_default\\_route\\_table\\_propagating\\_vgws) | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n | [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | [default\\_route\\_table\\_tags](#input\\_default\\_route\\_table\\_tags) | Additional tags for the default route table | `map(string)` | `{}` | no |\n+| [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | [default\\_security\\_group\\_egress](#input\\_default\\_security\\_group\\_egress) | List of maps of egress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | [default\\_security\\_group\\_ingress](#input\\_default\\_security\\_group\\_ingress) | List of maps of ingress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | [default\\_security\\_group\\_name](#input\\_default\\_security\\_group\\_name) | Name to be used on the default security group | `string` | `null` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -37,6 +37,15 @@ module \"vpc\" {\n \n manage_default_route_table = true\n default_route_table_tags = { Name = \"${local.name}-default\" }\n+ # Peered VPC to become routed with the one being created\n+ default_route_table_routes = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n+ intra_route_table_routes_extra = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n \n manage_default_security_group = true\n default_security_group_tags = { Name = \"${local.name}-default\" }\n---\nmain.tf\n@@ -228,6 +228,25 @@ resource \"aws_route_table\" \"private\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.private_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n {\n \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n@@ -338,6 +357,25 @@ resource \"aws_route_table\" \"intra\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.intra_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n var.tags,\n---\nvariables.tf\n@@ -418,6 +418,18 @@ variable \"default_route_table_tags\" {\n default = {}\n }\n \n+variable \"private_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"intra_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add all resources\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThis change introduces a data source to look up the default security group of the vpc that the endpoint will be deployed into. The default security group is then explicitly associated with the endpoint if no other security groups are passed into the module, or found by the lookup function. This resolves the issue of terraform wanting to make changes on every apply, as described in the linked issue below.\r\n\r\n## Motivation and Context\r\nThis is to fix what's described in https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/803\r\n\r\n## Breaking Changes\r\nNo breaking changes\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\nThe vpc in the complete example was deployed prior to making my change. Terraform apply was run again after making my change, and terraform detected no changes to make.\r\n\r\nLocally, I also deployed the simple-vpc example with the below endpoint configuration added to it\r\n\r\n```\r\nmodule \"vpc_endpoints\" {\r\n source = \"../../modules/vpc-endpoints\"\r\n\r\n vpc_id = module.vpc.vpc_id\r\n\r\n endpoints = {\r\n s3 = {\r\n service = \"s3\"\r\n tags = { Name = \"s3-vpc-endpoint\" }\r\n }\r\n }\r\n\r\n tags = {\r\n Owner = \"user\"\r\n Environment = \"dev\"\r\n }\r\n}\r\n```\r\n\r\nI ran terraform apply again and was able to reproduce the problem described in the linked issue. After adding my change and running a terraform apply, no changes were detected, which is the expected behaviour.\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/README.md\n@@ -73,6 +73,7 @@ No modules.\n | Name | Type |\n |------|------|\n | [aws_vpc_endpoint.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n ## Inputs\n---\nmodules/vpc-endpoints/main.tf\n@@ -3,7 +3,15 @@\n ################################################################################\n \n locals {\n- endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ default_sg = length(var.security_group_ids) == 0 ? [try(data.aws_security_group.this[0].id, null)] : []\n+ endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n+data \"aws_security_group\" \"this\" {\n+ count = var.create ? 1 : 0\n+\n+ name = \"default\"\n+ vpc_id = var.vpc_id\n }\n \n data \"aws_vpc_endpoint_service\" \"this\" {\n@@ -26,7 +34,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", local.default_sg))) : null\n subnet_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", local.default_sg)))\n\n---\n\nChoice B:\nmodules/vpc-endpoints/README.md\n@@ -73,6 +73,7 @@ No modules.\n | Name | Type |\n |------|------|\n | [aws_vpc_endpoint.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n ## Inputs\n---\nmodules/vpc-endpoints/main.tf\n@@ -3,7 +3,15 @@\n ################################################################################\n \n locals {\n- endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ default_sg = length(var.security_group_ids) == 0 ? [try(data.aws_security_group.this[0].id, null)] : []\n+ endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n+data \"aws_security_group\" \"this\" {\n+ count = var.create ? 1 : 0\n+\n+ name = \"default\"\n+ vpc_id = var.vpc_id\n }\n \n data \"aws_vpc_endpoint_service\" \"this\" {\n@@ : +34,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", local.default_sg))) : null\n subnet_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", null)\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/README.md\n@@ -73,6 +73,7 @@ No modules.\n | Name | Type |\n |------|------|\n | [aws_vpc_endpoint.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n ## Inputs\n---\nmodules/vpc-endpoints/main.tf\n@@ -3,7 +3,15 @@\n ################################################################################\n \n locals {\n- endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ default_sg = length(var.security_group_ids) == 0 ? [try(data.aws_security_group.this[0].id, null)] : []\n+ endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n+data \"aws_security_group\" \"this\" {\n+ count = var.create ? 1 : 0\n+\n+ name = \"default\"\n+ vpc_id = var.vpc_id\n }\n \n data \"aws_vpc_endpoint_service\" \"this\" {\n@@ -26,7 +34,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", local.default_sg))) : null\n subnet_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", null)\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/README.md\n@@ -73,6 +73,7 @@ No modules.\n | Name | Type |\n |------|------|\n | [aws_vpc_endpoint.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n ## Inputs\n---\nmodules/vpc-endpoints/main.tf\n@@ -3,7 +3,15 @@\n ################################################################################\n \n locals {\n- endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ default_sg = length(var.security_group_ids) == 0 ? [try(data.aws_security_group.this[0].id, null)] : []\n+ endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n+data \"aws_security_group\" \"this\" {\n+ count = var.create ? 1 : 0\n+\n+ name = \"default\"\n+ vpc_id = var.vpc_id\n }\n \n data \"aws_vpc_endpoint_service\" \"this\" {\n@@ -26,7 +34,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", local.default_sg))) : null\n subnet_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", null)\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nWork in progress. This PR is an idea. I would like to know if it make sense, so I can go further to finish development.\r\n\r\nAdd customized private subnet blocks (like groups) with the possibility to define different AZ(s) and subnet_suffix (Name tags).\r\n\r\nThere are some standard blocks, like:\r\n\r\npublic_subnets: `name-subnet-public-us-east-1a`\r\ndatabase_subnets: `name-subnet-database-us-east-1a`\r\nprivate_subnets: `name-subnet-private-us-east-1a`\r\nAnd so on...\r\n\r\nThey are distributed trough the `var.azs`.\r\n\r\nHowever, It would be great if I could define aditional subnets that can be allocated in a specific AZ:\r\n\r\nprivate_custom_blocks:\r\n\r\n`name-subnet-foo-us-west-1a`\r\n`name-subnet-bar-us-west-1a`\r\nAnd so on...\r\n\r\nInput a new optional variable to the module:\r\n\r\n```\r\nprivate_custom_blocks = {\r\n foo = {\r\n azs = [\"us-west-2a\"]\r\n subnet_suffix = \"subnet-foo\"\r\n tags = {}\r\n subnets = [\"10.10.192.0/27\", \"10.10.192.32/27\", \"10.10.192.64/27\"]\r\n },\r\n bar = {\r\n azs = [\"us-west-2a\", \"us-west-2b\", \"us-west-2c\"]\r\n subnet_suffix = \"subnet-bar\"\r\n tags = {}\r\n subnets = [\"10.10.224.0/27\", \"10.10.224.32/27\", \"10.10.224.64/27\"]\r\n },\r\n xpto = {\r\n azs = [\"us-west-2a\", \"us-west-2b\", \"us-west-2c\"]\r\n subnet_suffix = \"subnet-xpto\"\r\n tags = {\r\n Foo = \"bar\"\r\n }\r\n subnets = [\"10.10.240.0/27\", \"10.10.240.32/27\", \"10.10.240.64/27\"]\r\n }\r\n}\r\n``` \r\n## Motivation and Context\r\n\r\nPossibility to create some subnets in a specific AZ to acomplish a different need.\r\n\r\nI need to create 3 subnets in us-east-1a to comunicate to my on-prem network. It does not need HA.\r\nTo achieve that, I have to create 9 new subnets, distributed trough my `var.azs = [\"us-east-1a\", \"us-east-1b\", \"us-east-1c\"]`.\r\nThe other 6 subnets will never be used.\r\n\r\n## Breaking Changes\r\n\r\nIt does not break backwards compatibility. It would be an optional variable.\r\n\r\n## How Has This Been Tested?\r\n\r\nI have tested it in a fresh implementation of VPC module, creating standard and custom subnets.\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -4,13 +4,28 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(local.private_custom_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(toset(flatten([\n+ var.azs,\n+ local.private_custom_subnets[*].azs,\n+ ]))) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ private_custom_subnets = flatten([\n+ for block in var.private_custom_blocks : [\n+ for subnet in block.subnets : {\n+ subnet = subnet\n+ azs = block.azs\n+ subnet_suffix = block.subnet_suffix\n+ tags = block.tags\n+ }\n+ ]\n+ ])\n }\n \n ################################################################################\n@@ -400,6 +415,31 @@ resource \"aws_subnet\" \"private\" {\n )\n }\n \n+################################################################################\n+# Custom private subnet\n+################################################################################\n+\n+resource \"aws_subnet\" \"custom\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = local.private_custom_subnets[count.index].subnet\n+\n+ availability_zone ################################################################################\n@@ length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) > 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) == 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${local.private_custom_subnets[count.index].subnet_suffix}-%s\",\n+ element(local.private_custom_subnets[count.index].azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ local.private_custom_subnets[count.index].tags,\n+ )\n+}\n+\n ################################################################################\n # Outpost subnet\n ################################################################################\n@@ -1075,6 +1115,16 @@ resource \"aws_route_table_association\" \"private\" {\n )\n }\n \n+resource \"aws_route_table_association\" \"custom_private\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.custom[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"outpost\" {\n count = local.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n---\nvariables.tf\n@@ -1192,3 +1192,9 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"private_custom_blocks\" {\n+ type = map(any)\n+ description = \"List of maps of customized private subnets\"\n+ default = {}\n+}\n\\ No newline at end of file\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -4,13 +4,28 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(local.private_custom_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(toset(flatten([\n+ var.azs,\n+ local.private_custom_subnets[*].azs,\n+ ]))) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should tags deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ private_custom_subnets = flatten([\n+ for block in var.private_custom_blocks : [\n+ for subnet in block.subnets : {\n+ subnet = subnet\n+ azs = block.azs\n+ subnet_suffix = block.subnet_suffix\n+ tags = block.tags\n+ }\n+ ]\n+ ])\n }\n \n ################################################################################\n@@ -400,6 +415,31 @@ resource \"aws_subnet\" \"private\" {\n )\n }\n \n+################################################################################\n+# Custom private subnet\n+################################################################################\n+\n+resource \"aws_subnet\" \"custom\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = local.private_custom_subnets[count.index].subnet\n+\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) > 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) == 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${local.private_custom_subnets[count.index].subnet_suffix}-%s\",\n+ element(local.private_custom_subnets[count.index].azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ local.private_custom_subnets[count.index].tags,\n+ )\n+}\n+\n ################################################################################\n # Outpost subnet\n ################################################################################\n@@ -1075,6 +1115,16 @@ resource \"aws_route_table_association\" \"private\" {\n )\n }\n \n+resource \"aws_route_table_association\" \"custom_private\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.custom[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"outpost\" {\n count = local.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n---\nvariables.tf\n@@ -1192,3 +1192,9 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"private_custom_blocks\" {\n+ type = map(any)\n+ description = \"List of maps of customized private subnets\"\n+ default = {}\n+}\n\\ No newline at end of file\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -4,13 +4,28 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(local.private_custom_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(toset(flatten([\n+ var.azs,\n+ local.private_custom_subnets[*].azs,\n+ ]))) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ private_custom_subnets = flatten([\n+ for block in var.private_custom_blocks : [\n+ for subnet in block.subnets : {\n+ subnet = subnet\n+ azs = block.azs\n+ subnet_suffix = block.subnet_suffix\n+ tags = block.tags\n+ }\n+ ]\n+ ])\n }\n \n ################################################################################\n@@ -400,6 +415,31 @@ resource \"aws_subnet\" \"private\" {\n )\n }\n \n+################################################################################\n+# Custom private subnet\n+################################################################################\n+\n+resource \"aws_subnet\" \"custom\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = local.private_custom_subnets[count.index].subnet\n+\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) > 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) == 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${local.private_custom_subnets[count.index].subnet_suffix}-%s\",\n+ element(local.private_custom_subnets[count.index].azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ local.private_custom_subnets[count.index].tags,\n+ )\n+}\n+\n ################################################################################\n # Outpost subnet\n ################################################################################\n@@ -1075,6 +1115,16 @@ resource \"aws_route_table_association\" \"private\" {\n )\n }\n \n+resource \"aws_route_table_association\" \"custom_private\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.custom[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"outpost\" {\n count = local.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n---\nvariables.tf\n@@ -1192,3 +1192,9 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"private_custom_blocks\" {\n+ type = map(any)\n+ description = \"List of maps of customized private subnets\"\n+ default = {}\n+}\n\\ No newline at end of file\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -4,13 +4,28 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(local.private_custom_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(toset(flatten([\n+ var.azs,\n+ local.private_custom_subnets[*].azs,\n+ ]))) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ private_custom_subnets = flatten([\n+ for block in var.private_custom_blocks : [\n+ for subnet in block.subnets : {\n+ subnet = subnet\n+ azs = block.azs\n+ subnet_suffix = block.subnet_suffix\n+ tags = block.tags\n+ }\n+ ]\n+ ])\n }\n \n ################################################################################\n@@ -400,6 +415,31 @@ resource \"aws_subnet\" \"private\" {\n )\n }\n \n+################################################################################\n+# Custom private subnet\n+################################################################################\n+\n+resource \"aws_subnet\" \"custom\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = local.private_custom_subnets[count.index].subnet\n+\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) > 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) == 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${local.private_custom_subnets[count.index].subnet_suffix}-%s\",\n+ element(local.private_custom_subnets[count.index].azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ local.private_custom_subnets[count.index].tags,\n+ )\n+}\n+\n ################################################################################\n # Outpost subnet\n ################################################################################\n@@ -1075,6 +1115,16 @@ resource \"aws_route_table_association\" \"private\" {\n )\n }\n \n+resource \"aws_route_table_association\" \"custom_private\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.custom[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"outpost\" {\n count = local.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n---\nvariables.tf\n@@ -1192,3 +1192,9 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"private_custom_blocks\" {\n+ type = map(any)\n+ description = \"List of maps of customized private subnets\"\n+ default = {}\n+}\n\\ No newline at end of file\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n- Compact CIDR block outputs to avoid empty diffs\r\n\r\n## Motivation and Context\r\n- Closes #743 \r\n\r\n## Breaking Changes\r\n- No\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.62.3\n+ rev: v1.72.1\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.1.0\n+ rev: v4.3.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\noutputs.tf\n@@ -60,7 +60,7 @@ output \"vpc_ipv6_cidr_block\" {\n \n output \"vpc_secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks of the VPC\"\n- value = aws_vpc_ipv4_cidr_block_association.this[*].cidr_block\n+ value = compact(aws_vpc_ipv4_cidr_block_association.this[*].cidr_block)\n }\n \n output \"vpc_owner_id\" {\n@@ -80,12 +80,12 @@ output \"private_subnet_arns\" {\n \n output \"private_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of private subnets\"\n- value = aws_subnet.private[*].cidr_block\n+ value = compact(aws_subnet.private[*].cidr_block)\n }\n \n output \"private_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of private subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.private[*].ipv6_cidr_block\n+ value = compact(aws_subnet.private[*].ipv6_cidr_block)\n }\n \n output \"public_subnets\" {\n@@ -100,12 +100,12 @@ output \"public_subnet_arns\" {\n \n output \"public_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public[*].cidr_block\n+ value = repos:\n }\n \n output \"public_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public[*].ipv6_cidr_block\n+ value = compact(aws_subnet.public[*].ipv6_cidr_block)\n }\n \n output \"outpost_subnets\" {\n@@ -120,12 +120,12 @@ output \"outpost_subnet_arns\" {\n \n output \"outpost_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of outpost subnets\"\n- value = aws_subnet.outpost[*].cidr_block\n+ value = compact(aws_subnet.outpost[*].cidr_block)\n }\n \n output \"outpost_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of outpost subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.outpost[*].ipv6_cidr_block\n+ value = compact(aws_subnet.outpost[*].ipv6_cidr_block)\n }\n \n output \"database_subnets\" {\n@@ -140,12 +140,12 @@ output \"database_subnet_arns\" {\n \n output \"database_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of database subnets\"\n- value = aws_subnet.database[*].cidr_block\n+ value = compact(aws_subnet.database[*].cidr_block)\n }\n \n output \"database_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of database subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.database[*].ipv6_cidr_block\n+ value = compact(aws_subnet.database[*].ipv6_cidr_block)\n }\n \n output \"database_subnet_group\" {\n@@ -170,12 +170,12 @@ output \"redshift_subnet_arns\" {\n \n output \"redshift_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of redshift subnets\"\n- value = aws_subnet.redshift[*].cidr_block\n+ value = compact(aws_subnet.redshift[*].cidr_block)\n }\n \n output \"redshift_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of redshift subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.redshift[*].ipv6_cidr_block\n+ value = compact(aws_subnet.redshift[*].ipv6_cidr_block)\n }\n \n output \"redshift_subnet_group\" {\n@@ -195,12 +195,12 @@ output \"elasticache_subnet_arns\" {\n \n output \"elasticache_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of elasticache subnets\"\n- value = aws_subnet.elasticache[*].cidr_block\n+ value = compact(aws_subnet.elasticache[*].cidr_block)\n }\n \n output \"elasticache_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of elasticache subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.elasticache[*].ipv6_cidr_block\n+ value = compact(aws_subnet.elasticache[*].ipv6_cidr_block)\n }\n \n output \"intra_subnets\" {\n@@ -215,12 +215,12 @@ output \"intra_subnet_arns\" {\n \n output \"intra_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of intra subnets\"\n- value = aws_subnet.intra[*].cidr_block\n+ value = compact(aws_subnet.intra[*].cidr_block)\n }\n \n output \"intra_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of intra subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.intra[*].ipv6_cidr_block\n+ value = compact(aws_subnet.intra[*].ipv6_cidr_block)\n }\n \n output \"elasticache_subnet_group\" {\n---\n\n\n---\n\nChoice B:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.62.3\n+ rev: v1.72.1\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.1.0\n+ rev: v4.3.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\noutputs.tf\n@@ -60,7 +60,7 @@ output \"vpc_ipv6_cidr_block\" {\n \n output \"vpc_secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks of the VPC\"\n- value = aws_vpc_ipv4_cidr_block_association.this[*].cidr_block\n+ value = compact(aws_vpc_ipv4_cidr_block_association.this[*].cidr_block)\n }\n \n output \"vpc_owner_id\" {\n@@ -80,12 +80,12 @@ output \"private_subnet_arns\" {\n \n output \"private_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of private subnets\"\n- value = aws_subnet.private[*].cidr_block\n+ value = compact(aws_subnet.private[*].cidr_block)\n }\n \n output \"private_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of private subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.private[*].ipv6_cidr_block\n+ value = compact(aws_subnet.private[*].ipv6_cidr_block)\n }\n \n output \"public_subnets\" {\n@@ -100,12 +100,12 @@ output \"public_subnet_arns\" {\n \n output \"public_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public[*].cidr_block\n+ value = compact(aws_subnet.public[*].cidr_block)\n }\n \n output \"public_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public[*].ipv6_cidr_block\n+ value = compact(aws_subnet.public[*].ipv6_cidr_block)\n }\n \n output \"outpost_subnets\" {\n@@ -120,12 +120,12 @@ output \"outpost_subnet_arns\" {\n \n output \"outpost_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of outpost subnets\"\n- value = aws_subnet.outpost[*].cidr_block\n+ value = compact(aws_subnet.outpost[*].cidr_block)\n }\n \n output \"outpost_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of outpost subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.outpost[*].ipv6_cidr_block\n+ value = compact(aws_subnet.outpost[*].ipv6_cidr_block)\n }\n \n output \"database_subnets\" {\n@@ -140,12 +140,12 @@ output \"database_subnet_arns\" {\n \n output \"database_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of database subnets\"\n- value = aws_subnet.database[*].cidr_block\n+ value = compact(aws_subnet.database[*].cidr_block)\n }\n \n output \"database_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of database subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.database[*].ipv6_cidr_block\n+ value = compact(aws_subnet.database[*].ipv6_cidr_block)\n }\n \n output \"database_subnet_group\" {\n@@ -170,12 compact(aws_vpc_ipv4_cidr_block_association.this[*].cidr_block)\n @@ output \"redshift_subnet_arns\" {\n \n output \"redshift_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of redshift subnets\"\n- value = aws_subnet.redshift[*].cidr_block\n+ value = compact(aws_subnet.redshift[*].cidr_block)\n }\n \n output \"redshift_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of redshift subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.redshift[*].ipv6_cidr_block\n+ value = compact(aws_subnet.redshift[*].ipv6_cidr_block)\n }\n \n output \"redshift_subnet_group\" {\n@@ -195,12 +195,12 @@ output \"elasticache_subnet_arns\" {\n \n output \"elasticache_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of elasticache subnets\"\n- value = aws_subnet.elasticache[*].cidr_block\n+ value = compact(aws_subnet.elasticache[*].cidr_block)\n }\n \n output \"elasticache_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of elasticache subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.elasticache[*].ipv6_cidr_block\n+ value = compact(aws_subnet.elasticache[*].ipv6_cidr_block)\n }\n \n output \"intra_subnets\" {\n@@ -215,12 +215,12 @@ output \"intra_subnet_arns\" {\n \n output \"intra_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of intra subnets\"\n- value = aws_subnet.intra[*].cidr_block\n+ value = compact(aws_subnet.intra[*].cidr_block)\n }\n \n output \"intra_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of intra subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.intra[*].ipv6_cidr_block\n+ value = compact(aws_subnet.intra[*].ipv6_cidr_block)\n }\n \n output \"elasticache_subnet_group\" {\n---\n\n\n---\n\nChoice C:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.62.3\n+ rev: v1.72.1\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.1.0\n+ rev: v4.3.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\noutputs.tf\n@@ -60,7 +60,7 @@ output \"vpc_ipv6_cidr_block\" {\n \n output \"vpc_secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks of the VPC\"\n- value = aws_vpc_ipv4_cidr_block_association.this[*].cidr_block\n+ value = compact(aws_vpc_ipv4_cidr_block_association.this[*].cidr_block)\n }\n \n output \"vpc_owner_id\" {\n@@ -80,12 +80,12 @@ output \"private_subnet_arns\" {\n \n output \"private_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of private subnets\"\n- value = aws_subnet.private[*].cidr_block\n+ value = compact(aws_subnet.private[*].cidr_block)\n }\n \n output \"private_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of private subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.private[*].ipv6_cidr_block\n+ value = compact(aws_subnet.private[*].ipv6_cidr_block)\n }\n \n output \"public_subnets\" {\n@@ -100,12 +100,12 @@ output \"public_subnet_arns\" {\n \n output \"public_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public[*].cidr_block\n+ value = compact(aws_subnet.public[*].cidr_block)\n }\n \n output \"public_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public[*].ipv6_cidr_block\n+ value = compact(aws_subnet.public[*].ipv6_cidr_block)\n }\n \n output \"outpost_subnets\" {\n@@ -120,12 +120,12 @@ output \"outpost_subnet_arns\" {\n \n output \"outpost_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of outpost subnets\"\n- value = aws_subnet.outpost[*].cidr_block\n+ value = compact(aws_subnet.outpost[*].cidr_block)\n }\n \n output \"outpost_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of outpost subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.outpost[*].ipv6_cidr_block\n+ value = compact(aws_subnet.outpost[*].ipv6_cidr_block)\n }\n \n output \"database_subnets\" {\n@@ -140,12 +140,12 @@ output \"database_subnet_arns\" {\n \n output \"database_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of database subnets\"\n- value = aws_subnet.database[*].cidr_block\n+ value = compact(aws_subnet.database[*].cidr_block)\n }\n \n output \"database_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of database subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.database[*].ipv6_cidr_block\n+ value = compact(aws_subnet.database[*].ipv6_cidr_block)\n }\n \n output \"database_subnet_group\" {\n@@ -170,12 +170,12 @@ output \"redshift_subnet_arns\" {\n \n output \"redshift_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of redshift subnets\"\n- value = aws_subnet.redshift[*].cidr_block\n+ value = compact(aws_subnet.redshift[*].cidr_block)\n }\n \n output \"redshift_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of redshift subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.redshift[*].ipv6_cidr_block\n+ value = compact(aws_subnet.redshift[*].ipv6_cidr_block)\n }\n \n output \"redshift_subnet_group\" {\n@@ -195,12 +195,12 @@ output \"elasticache_subnet_arns\" {\n \n output \"elasticache_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of elasticache subnets\"\n- value = aws_subnet.elasticache[*].cidr_block\n+ value = compact(aws_subnet.elasticache[*].cidr_block)\n }\n \n output \"elasticache_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of elasticache subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.elasticache[*].ipv6_cidr_block\n+ value = compact(aws_subnet.elasticache[*].ipv6_cidr_block)\n }\n \n output \"intra_subnets\" {\n@@ -215,12 +215,12 @@ output \"intra_subnet_arns\" {\n \n output \"intra_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of intra subnets\"\n- value = aws_subnet.intra[*].cidr_block\n+ value = compact(aws_subnet.intra[*].cidr_block)\n }\n \n output \"intra_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of intra subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.intra[*].ipv6_cidr_block\n+ value = compact(aws_subnet.intra[*].ipv6_cidr_block)\n }\n \n output \"elasticache_subnet_group\" {\n---\n\n\n---\n\nChoice D:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.62.3\n+ rev: v1.72.1\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.1.0\n+ rev: v4.3.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\noutputs.tf\n@@ -60,7 +60,7 @@ output \"vpc_ipv6_cidr_block\" {\n \n output \"vpc_secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks of the VPC\"\n- value = aws_vpc_ipv4_cidr_block_association.this[*].cidr_block\n+ value = compact(aws_vpc_ipv4_cidr_block_association.this[*].cidr_block)\n }\n \n output \"vpc_owner_id\" {\n@@ -80,12 +80,12 @@ output \"private_subnet_arns\" {\n \n output \"private_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of private subnets\"\n- value = aws_subnet.private[*].cidr_block\n+ value = compact(aws_subnet.private[*].cidr_block)\n }\n \n output \"private_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of private subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.private[*].ipv6_cidr_block\n+ value = compact(aws_subnet.private[*].ipv6_cidr_block)\n }\n \n output \"public_subnets\" {\n@@ -100,12 +100,12 @@ output \"public_subnet_arns\" {\n \n output \"public_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public[*].cidr_block\n+ value = compact(aws_subnet.public[*].cidr_block)\n }\n \n output \"public_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public[*].ipv6_cidr_block\n+ value = compact(aws_subnet.public[*].ipv6_cidr_block)\n }\n \n output \"outpost_subnets\" {\n@@ -120,12 +120,12 @@ output \"outpost_subnet_arns\" {\n \n output \"outpost_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of outpost subnets\"\n- value = aws_subnet.outpost[*].cidr_block\n+ value = compact(aws_subnet.outpost[*].cidr_block)\n }\n \n output \"outpost_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of outpost subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.outpost[*].ipv6_cidr_block\n+ value = compact(aws_subnet.outpost[*].ipv6_cidr_block)\n }\n \n output \"database_subnets\" {\n@@ -140,12 +140,12 @@ output \"database_subnet_arns\" {\n \n output \"database_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of database subnets\"\n- value = aws_subnet.database[*].cidr_block\n+ value = compact(aws_subnet.database[*].cidr_block)\n }\n \n output \"database_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of database subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.database[*].ipv6_cidr_block\n+ value = compact(aws_subnet.database[*].ipv6_cidr_block)\n }\n \n output \"database_subnet_group\" {\n@@ -170,12 +170,12 @@ output \"redshift_subnet_arns\" {\n \n output \"redshift_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of redshift subnets\"\n- value = aws_subnet.redshift[*].cidr_block\n+ value = compact(aws_subnet.redshift[*].cidr_block)\n }\n \n output \"redshift_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of redshift subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.redshift[*].ipv6_cidr_block\n+ value = compact(aws_subnet.redshift[*].ipv6_cidr_block)\n }\n \n output \"redshift_subnet_group\" {\n@@ -195,12 +195,12 @@ output \"elasticache_subnet_arns\" {\n \n output \"elasticache_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of elasticache subnets\"\n- value = aws_subnet.elasticache[*].cidr_block\n+ value = compact(aws_subnet.elasticache[*].cidr_block)\n }\n \n output \"elasticache_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of elasticache subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.elasticache[*].ipv6_cidr_block\n+ value = compact(aws_subnet.elasticache[*].ipv6_cidr_block)\n }\n \n output \"intra_subnets\" {\n@@ -215,12 +215,12 @@ output \"intra_subnet_arns\" {\n \n output \"intra_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of intra subnets\"\n- value = aws_subnet.intra[*].cidr_block\n+ value = compact(aws_subnet.intra[*].cidr_block)\n }\n \n output \"intra_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of intra subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.intra[*].ipv6_cidr_block\n+ value = compact(aws_subnet.intra[*].ipv6_cidr_block)\n }\n \n output \"elasticache_subnet_group\" {\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nPrevent creation of data resources for VPC endpoints that are disabled.\r\n\r\n## Motivation and Context\r\nThe data resources and resources for VPC endpoints are now in sync.\r\n\r\n## Breaking Changes\r\nNo breaking change\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one of my own projects.\n\n---\n\nChoice A:\nmodules/vpc-endpoints/main.tf\n@@ -2,8 +2,12 @@\n # Endpoint(s)\n ################################################################################\n \n+locals {\n+ endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n data \"aws_vpc_endpoint_service\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = local.endpoints\n \n service = lookup(each.value, \"service\", null)\n service_name = lookup(each.value, \"service_name\", null)\n@@ -15,7 +19,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ for_each = local.endpoints\n \n vpc_id = var.vpc_id\n service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/main.tf\n@@ -2,8 +2,12 @@\n # Endpoint(s)\n ################################################################################\n \n+locals {\n+ endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n data \"aws_vpc_endpoint_service\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = local.endpoints\n \n service = lookup(each.value, \"service\", null)\n service_name = lookup(each.value, \"service_name\", null)\n@@ -15,7 +19,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ for_each = local.endpoints\n \n vpc_id = var.vpc_id\n service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/main.tf\n@@ -2,8 +2,12 @@\n # Endpoint(s)\n ################################################################################\n \n+locals {\n+ endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n data \"aws_vpc_endpoint_service\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = local.endpoints\n \n service = lookup(each.value, \"service\", null)\n service_name = lookup(each.value, \"service_name\", null)\n@@ -15,7 +19,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ for_each = local.endpoints\n \n vpc_id = var.vpc_id\n service_name if = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/main.tf\n@@ -2,8 +2,12 @@\n # Endpoint(s)\n ################################################################################\n \n+locals {\n+ \"aws_vpc_endpoint_service\" endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n data \"aws_vpc_endpoint_service\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = local.endpoints\n \n service = lookup(each.value, \"service\", null)\n service_name = lookup(each.value, \"service_name\", null)\n@@ -15,7 +19,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ for_each = local.endpoints\n \n vpc_id = var.vpc_id\n service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -6,7 +6,7 @@ locals {\n name = \"complete-example\"\n region = \"eu-west-1\"\n tags = {\n- Owner = \"user\"\n+ Owner = \"testuser\"\n Environment = \"staging\"\n Name = \"complete\"\n }\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -6,7 +6,7 @@ locals {\n name = \"complete-example\"\n region = \"eu-west-1\"\n tags = {\n- Owner = \"user\"\n+ Owner = \"testuser\"\n Environment = \"staging\"\n Name = \"complete\"\n }\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -6,7 +6,7 @@ locals {\n name = \"complete-example\"\n region = \"eu-west-1\"\n tags = {\n- Owner = \"user\"\n+ Owner = \"testuser\"\n Environment = \"staging\"\n Name = \"complete\"\n }\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -6,7 +6,7 @@ locals {\n name = \"complete-example\"\n region = \"eu-west-1\"\n tags = {\n- Owner = \"user\"\n+ Owner = \"testuser\"\n Environment = \"staging\"\n Name = \"complete\"\n }\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdd support for passing `ipv6_ipam_pool_id` and `assign_generated_ipv6_cidr_block` arguments to the `aws_vpc` resource.\r\n\r\n## Motivation and Context\r\nI have a VPC where I need to pass the `ipv6_ipam_pool_id` and I couldn't do that without adding this feature.\r\n\r\n## Breaking Changes\r\nNone, the module works the same as it does today.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s); I did not update any of the examples to test the new feature because BYOIPv6 is difficult to setup / test in a development environment.\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects; existing examples work as they did before if you don't pass in the new argument: `ipv6_ipam_pool_id`\r\n- [x] I used the module for my own VPC and used the new argument `ipv6_ipam_pool_id` and it worked as expected.\r\n- [x] I have executed `pre-commit run -a` on my pull request\n\n---\n\nChoice A:\nREADME.md\n@@ -304,6 +304,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | [amazon\\_side\\_asn](#input\\_amazon\\_side\\_asn) | The Autonomous System Number (ASN) for the Amazon side of the gateway. By default the virtual private gateway is created with the current default Amazon ASN. | `string` | `\"64512\"` | no |\n+| [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `false` | no |\n | [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n | [cidr](#input\\_cidr) | The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden | `string` | `\"0.0.0.0/0\"` | no |\n@@ -405,6 +406,7 @@ No modules.\n | [intra\\_subnet\\_suffix](#input\\_intra\\_subnet\\_suffix) | Suffix to append to intra subnets name | `string` | `\"intra\"` | no |\n | [intra\\_subnet\\_tags](#input\\_intra\\_subnet\\_tags) | Additional tags for the intra subnets | `map(string)` | `{}` | no |\n | [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets | `list(string)` | `[]` | no |\n+| [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | IPAM Pool ID for an IPv6 pool. | `string` | `null` | no |\n | [manage\\_default\\_network\\_acl](#input\\_manage\\_default\\_network\\_acl) | Should be true to adopt and manage Default Network ACL | `bool` | `false` | no |\n | [manage\\_default\\_route\\_table](#input\\_manage\\_default\\_route\\_table) | Should be true to manage default route table | `bool` | `false` | no |\n | [manage\\_default\\_security\\_group](#input\\_manage\\_default\\_security\\_group) | Should be true to adopt and manage default security group | `bool` | `false` | no |\n---\nmain.tf\n@@ -26,7 +26,8 @@ resource \"aws_vpc\" \"this\" {\n enable_dns_support = var.enable_dns_support\n enable_classiclink = var.enable_classiclink\n enable_classiclink_dns_support = var.enable_classiclink_dns_support\n- assign_generated_ipv6_cidr_block = var.enable_ipv6\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && var.assign_generated_ipv6_cidr_block ? true : null\n+ ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -22,6 +22,18 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ipv6_ipam_pool_id\" {\n+ description = \"IPAM Pool ID for an IPv6 pool.\"\n+ type = string\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -304,6 +304,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | [amazon\\_side\\_asn](#input\\_amazon\\_side\\_asn) | The Autonomous System Number (ASN) for the Amazon side of the gateway. By default the virtual private gateway is created with the current default Amazon ASN. | `string` | `\"64512\"` | no |\n+| [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `false` | no |\n | [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | [azs](#input\\_azs) | A list of availability zones names or | in the region | `list(string)` | `[]` | no |\n | [cidr](#input\\_cidr) | The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden | `string` | `\"0.0.0.0/0\"` | no |\n@@ -405,6 +406,7 @@ No modules.\n | [intra\\_subnet\\_suffix](#input\\_intra\\_subnet\\_suffix) | Suffix to append to intra subnets name | `string` | `\"intra\"` | no |\n | [intra\\_subnet\\_tags](#input\\_intra\\_subnet\\_tags) | Additional tags for the intra subnets | `map(string)` | `{}` | no |\n | [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets | `list(string)` | `[]` | no |\n+| [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | IPAM Pool ID for an IPv6 pool. | `string` | `null` | no |\n | [manage\\_default\\_network\\_acl](#input\\_manage\\_default\\_network\\_acl) | Should be true to adopt and manage Default Network ACL | `bool` | `false` | no |\n | [manage\\_default\\_route\\_table](#input\\_manage\\_default\\_route\\_table) | Should be true to manage default route table | `bool` | `false` | no |\n | [manage\\_default\\_security\\_group](#input\\_manage\\_default\\_security\\_group) | Should be true to adopt and manage default security group | `bool` | `false` | no |\n---\nmain.tf\n@@ -26,7 +26,8 @@ resource \"aws_vpc\" \"this\" {\n enable_dns_support = var.enable_dns_support\n enable_classiclink = var.enable_classiclink\n enable_classiclink_dns_support = var.enable_classiclink_dns_support\n- assign_generated_ipv6_cidr_block = var.enable_ipv6\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && var.assign_generated_ipv6_cidr_block ? true : null\n+ ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -22,6 +22,18 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ipv6_ipam_pool_id\" {\n+ description = \"IPAM Pool ID for an IPv6 pool.\"\n+ type = string\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -304,6 +304,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | [amazon\\_side\\_asn](#input\\_amazon\\_side\\_asn) | The Autonomous System Number (ASN) for the Amazon side of the gateway. By default the virtual private gateway is created with the current default Amazon ASN. | `string` | `\"64512\"` | no |\n+| [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `false` | no |\n | [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n | [cidr](#input\\_cidr) | The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden | `string` | `\"0.0.0.0/0\"` | no |\n@@ -405,6 +406,7 @@ No modules.\n | [intra\\_subnet\\_suffix](#input\\_intra\\_subnet\\_suffix) | Suffix to append to intra subnets name | `string` | `\"intra\"` | no |\n | [intra\\_subnet\\_tags](#input\\_intra\\_subnet\\_tags) | Additional tags for the intra subnets | `map(string)` | `{}` | no |\n | [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets | `list(string)` | `[]` | no |\n+| [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | IPAM Pool ID for an IPv6 pool. | `string` | `null` | no |\n | [manage\\_default\\_network\\_acl](#input\\_manage\\_default\\_network\\_acl) | Should be true to adopt and manage Default Network ACL | `bool` | `false` | no |\n | [manage\\_default\\_route\\_table](#input\\_manage\\_default\\_route\\_table) | Should be true to manage default route table | `bool` | `false` | no |\n | [manage\\_default\\_security\\_group](#input\\_manage\\_default\\_security\\_group) | Should be true to adopt and manage default security group | `bool` | `false` | no |\n---\nmain.tf\n@@ -26,7 +26,8 @@ resource \"aws_vpc\" \"this\" {\n enable_dns_support = var.enable_dns_support\n enable_classiclink = var.enable_classiclink\n enable_classiclink_dns_support = var.enable_classiclink_dns_support\n- assign_generated_ipv6_cidr_block = var.enable_ipv6\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && var.assign_generated_ipv6_cidr_block ? true : null\n+ ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -22,6 +22,18 @@ variable \"enable_ipv6\" {\n default = false\n {\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ipv6_ipam_pool_id\" {\n+ description = \"IPAM Pool ID for an IPv6 pool.\"\n+ type = string\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -304,6 +304,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | [amazon\\_side\\_asn](#input\\_amazon\\_side\\_asn) | The Autonomous System Number (ASN) for the Amazon side of the gateway. By default the virtual private gateway is created with the current default Amazon ASN. | `string` | `\"64512\"` | no |\n+| [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `false` | no |\n | [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n | [cidr](#input\\_cidr) | The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden | `string` | `\"0.0.0.0/0\"` | no |\n@@ -405,6 +406,7 @@ No modules.\n | [intra\\_subnet\\_suffix](#input\\_intra\\_subnet\\_suffix) | Suffix to append to intra subnets name | `string` | `\"intra\"` | no |\n | [intra\\_subnet\\_tags](#input\\_intra\\_subnet\\_tags) | Additional tags for the intra subnets | `map(string)` | `{}` | no |\n | [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets | `list(string)` | `[]` | no |\n+| [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | IPAM Pool ID for an IPv6 pool. | `string` | `null` | no |\n | [manage\\_default\\_network\\_acl](#input\\_manage\\_default\\_network\\_acl) | Should be true to adopt and manage Default Network ACL | `bool` | `false` | no |\n | [manage\\_default\\_route\\_table](#input\\_manage\\_default\\_route\\_table) | Should be true to manage default route table | `bool` | `false` | no |\n | [manage\\_default\\_security\\_group](#input\\_manage\\_default\\_security\\_group) | Should be true to adopt and manage default security group | `bool` | `false` | no |\n---\nmain.tf\n@@ -26,7 +26,8 @@ resource \"aws_vpc\" \"this\" {\n enable_dns_support = var.enable_dns_support\n enable_classiclink the = var.enable_classiclink\n enable_classiclink_dns_support = var.enable_classiclink_dns_support\n- assign_generated_ipv6_cidr_block = var.enable_ipv6\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && var.assign_generated_ipv6_cidr_block ? true : null\n+ ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -22,6 +22,18 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ipv6_ipam_pool_id\" {\n+ description = \"IPAM Pool ID for an IPv6 pool.\"\n+ type = string\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\nAdds `flow_log_log_group_name_prefix` as an output.\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\nSee [#790](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/790)\r\n\r\n## Breaking Changes\r\n\r\nNo.\r\n\r\n## How Has This Been Tested?\r\n- [X] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [X] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [X] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values (arguments)\n output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values (arguments)\n output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values = output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values (arguments)\n output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nAdds `flow_log_log_group_name_prefix` as a output from the module.\r\n\r\n## Motivation and Context\r\n\r\nSee: [#790](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/790)\r\n\r\n## Breaking Changes\r\n\r\nNo.\r\n\r\n## How Has This Been Tested?\r\n- [X] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [X] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [X] I have executed `pre-commit run -a` on my pull request\r\n\r\n\r\nThis is my first open source commit so take it easy on me!\n\n---\n\nChoice A:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values (arguments)\n output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values (arguments)\n output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values (arguments)\n output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ = metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values (arguments)\n output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nIf you specify Name key in vpc tags, then Name key of vpc tags is overriding Name key of cgw\r\n\r\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -1155,9 +1155,9 @@ resource \"aws_customer_gateway\" \"this\" {\n \"${var.name}-${each.key}\" type = \"ipsec.1\"\n \n tags = merge(\n- { Name = \"${var.name}-${each.key}\" },\n var.tags,\n var.customer_gateway_tags,\n+ { Name = \"${var.name}-${each.key}\" },\n )\n }\n \n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1155,9 +1155,9 @@ resource \"aws_customer_gateway\" \"this\" {\n type = \"ipsec.1\"\n \n tags = merge(\n- { Name = \"${var.name}-${each.key}\" },\n var.tags,\n var.customer_gateway_tags,\n+ { Name = \"${var.name}-${each.key}\" },\n )\n }\n \n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1155,9 +1155,9 @@ resource \"aws_customer_gateway\" \"this\" {\n type = \"ipsec.1\"\n \n tags = merge(\n- { Name = \"${var.name}-${each.key}\" },\n var.tags,\n var.customer_gateway_tags,\n+ { Name = \"${var.name}-${each.key}\" },\n )\n }\n \n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1155,9 +1155,9 @@ resource \"aws_customer_gateway\" \"this\" {\n type = \"ipsec.1\"\n \n tags = merge(\n- { Name = \"${var.name}-${each.key}\" },\n var.tags,\n var.customer_gateway_tags,\n+ { Name = \"${var.name}-${each.key}\" },\n )\n }\n \n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n\r\n## Description\r\nThis change is to allow for create to work within each vpc endpoint object. If the create is outside of a vpc endpoint then that will take priorty over the specific vpc endpoints create.\r\n\r\n## Motivation and Context\r\nThis will make the script alot more flexible and fine grain. As you can go down to object level to specify which objects should be created or not. Making a lot more use cases possible.\r\n\r\n\r\n## Breaking Changes\r\nThe only thing that was introduced that would be debtable is try but it seems try has been there for a long time so seem like it is backwards compatible. \r\n\r\n## How Has This Been Tested?\r\nYes I have an example project which I tested this on. I tested with multiple use cases to make sure.\r\nThis change will also default create to true with object level vpc endpoints just like it has been. Meaning create is still optional for object level and resource level create.\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -121,6 +121,7 @@ module \"vpc_endpoints\" {\n subnet_ids = module.vpc.private_subnets\n },\n \"vpc-flow-logs-s3-bucket\"\n@@ ecs_telemetry = {\n+ create = false\n service = \"ecs-telemetry\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,21 +24,21 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | [terraform](#requirement\\_terraform) | >= 0.13.1 |\n-| [aws](#requirement\\_aws) | >= 3.63 |\n-| [random](#requirement\\_random) | >= 2 |\n+| [aws](#requirement\\_aws) | >= 3.75 |\n+| [random](#requirement\\_random) | >= 2.0 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| [aws](#provider\\_aws) | >= 3.63 |\n-| [random](#provider\\_random) | >= 2 |\n+| [aws](#provider\\_aws) | >= 3.75 |\n+| [random](#provider\\_random) | >= 2.0 |\n \n ## Modules\n \n | Name | Source | Version |\n |------|--------|---------|\n-| [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 1.0 |\n+| [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 3.0 |\n | [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs) | ../../ | n/a |\n | [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default) | ../../ | n/a |\n | [vpc\\_with\\_flow\\_logs\\_s3\\_bucket](#module\\_vpc\\_with\\_flow\\_logs\\_s3\\_bucket) | ../../ | n/a |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -24,7 +24,7 @@ module \"vpc_with_flow_logs_s3_bucket\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn = module.s3_bucket.s3_bucket_arn\n \n vpc_flow_log_tags = {\n Name = \"vpc-flow-logs-s3-bucket\"\n@@ -42,7 +42,7 @@ module \"vpc_with_flow_logs_s3_bucket_parquet\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn = module.s3_bucket.s3_bucket_arn\n flow_log_file_format = \"parquet\"\n \n vpc_flow_log_tags = {\n@@ -102,7 +102,7 @@ resource \"random_pet\" \"this\" {\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n- version = \"~> 1.0\"\n+ version = \"~> 3.0\"\n \n bucket = local.s3_bucket_name\n policy = data.aws_iam_policy_document.flow_log_s3.json\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -4,12 +4,12 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.63\"\n+ version = \">= 3.75\"\n }\n \n random = {\n source = \"hashicorp/random\"\n- version = \">= 2\"\n+ version = \">= 2.0\"\n }\n }\n }\n---\nmodules/vpc-endpoints/main.tf\n@@ -15,7 +15,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n \n vpc_id = var.vpc_id\n service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -121,6 +121,7 @@ module \"vpc_endpoints\" {\n subnet_ids = module.vpc.private_subnets\n },\n ecs_telemetry = {\n+ create = false\n service = \"ecs-telemetry\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,21 +24,21 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | [terraform](#requirement\\_terraform) | >= 0.13.1 |\n-| [aws](#requirement\\_aws) | >= 3.63 |\n-| [random](#requirement\\_random) | >= 2 |\n+| [aws](#requirement\\_aws) | >= 3.75 |\n+| [random](#requirement\\_random) | >= 2.0 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| [aws](#provider\\_aws) | >= 3.63 |\n-| [random](#provider\\_random) | >= 2 |\n+| [aws](#provider\\_aws) | >= 3.75 |\n+| [random](#provider\\_random) | >= 2.0 |\n \n ## Modules\n \n | Name | Source | Version |\n |------|--------|---------|\n-| [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 1.0 |\n+| [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 3.0 |\n | [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs) | ../../ | n/a |\n | [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default) | ../../ | n/a |\n | [vpc\\_with\\_flow\\_logs\\_s3\\_bucket](#module\\_vpc\\_with\\_flow\\_logs\\_s3\\_bucket) | ../../ | n/a |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -24,7 +24,7 @@ module \"vpc_with_flow_logs_s3_bucket\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn = module.s3_bucket.s3_bucket_arn\n \n vpc_flow_log_tags = {\n Name = \"vpc-flow-logs-s3-bucket\"\n@@ -42,7 +42,7 @@ module \"vpc_with_flow_logs_s3_bucket_parquet\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn = module.s3_bucket.s3_bucket_arn\n flow_log_file_format = \"parquet\"\n \n vpc_flow_log_tags = {\n@@ -102,7 +102,7 @@ resource \"random_pet\" \"this\" {\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n- version = \"~> 1.0\"\n+ version = \"~> 3.0\"\n \n bucket = local.s3_bucket_name\n policy = data.aws_iam_policy_document.flow_log_s3.json\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -4,12 +4,12 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.63\"\n+ version = \">= 3.75\"\n }\n \n random = {\n source = \"hashicorp/random\"\n- version = \">= 2\"\n+ version = \">= 2.0\"\n }\n }\n }\n---\nmodules/vpc-endpoints/main.tf\n@@ -15,7 +15,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n \n vpc_id = var.vpc_id\n service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -121,6 +121,7 @@ module \"vpc_endpoints\" {\n subnet_ids = module.vpc.private_subnets\n },\n ecs_telemetry = {\n+ create = false\n service = \"ecs-telemetry\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,21 +24,21 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | [terraform](#requirement\\_terraform) | >= 0.13.1 |\n-| [aws](#requirement\\_aws) | >= 3.63 |\n-| [random](#requirement\\_random) | >= 2 |\n+| [aws](#requirement\\_aws) | >= 3.75 |\n+| [random](#requirement\\_random) | >= 2.0 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| [aws](#provider\\_aws) | >= 3.63 |\n-| [random](#provider\\_random) | >= 2 |\n+| [aws](#provider\\_aws) | >= 3.75 |\n+| [random](#provider\\_random) | >= 2.0 |\n \n ## Modules\n \n | Name | Source | Version |\n |------|--------|---------|\n-| [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 1.0 |\n+| [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 3.0 |\n | [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs) | ../../ | n/a |\n | [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default) | ../../ | n/a |\n | [vpc\\_with\\_flow\\_logs\\_s3\\_bucket](#module\\_vpc\\_with\\_flow\\_logs\\_s3\\_bucket) | ../../ | n/a |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -24,7 +24,7 @@ module \"vpc_with_flow_logs_s3_bucket\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn |\n-| = module.s3_bucket.s3_bucket_arn\n \n vpc_flow_log_tags = {\n Name = \"vpc-flow-logs-s3-bucket\"\n@@ -42,7 +42,7 @@ module \"vpc_with_flow_logs_s3_bucket_parquet\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn = module.s3_bucket.s3_bucket_arn\n flow_log_file_format = \"parquet\"\n \n vpc_flow_log_tags = {\n@@ -102,7 +102,7 @@ resource \"random_pet\" \"this\" {\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n- version = \"~> 1.0\"\n+ version = \"~> 3.0\"\n \n bucket = local.s3_bucket_name\n policy = data.aws_iam_policy_document.flow_log_s3.json\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -4,12 +4,12 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.63\"\n+ version = \">= 3.75\"\n }\n \n random = {\n source = \"hashicorp/random\"\n- version = \">= 2\"\n+ version = \">= 2.0\"\n }\n }\n }\n---\nmodules/vpc-endpoints/main.tf\n@@ -15,7 +15,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n \n vpc_id = var.vpc_id\n service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -121,6 +121,7 @@ module \"vpc_endpoints\" {\n subnet_ids = module.vpc.private_subnets\n },\n ecs_telemetry = {\n+ create = false\n service = \"ecs-telemetry\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,21 +24,21 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | [terraform](#requirement\\_terraform) | >= 0.13.1 |\n-| [aws](#requirement\\_aws) | >= 3.63 |\n-| [random](#requirement\\_random) | >= 2 |\n+| [aws](#requirement\\_aws) | >= 3.75 |\n+| [random](#requirement\\_random) | >= 2.0 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| [aws](#provider\\_aws) | >= 3.63 |\n-| [random](#provider\\_random) | >= 2 |\n+| [aws](#provider\\_aws) | >= 3.75 |\n+| [random](#provider\\_random) | >= 2.0 |\n \n ## Modules\n \n | Name | Source | Version |\n |------|--------|---------|\n-| [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 1.0 |\n+| [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 3.0 |\n | [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs) | ../../ | n/a |\n | [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default) | ../../ | n/a |\n | [vpc\\_with\\_flow\\_logs\\_s3\\_bucket](#module\\_vpc\\_with\\_flow\\_logs\\_s3\\_bucket) | ../../ | n/a |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -24,7 +24,7 @@ module \"vpc_with_flow_logs_s3_bucket\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn = module.s3_bucket.s3_bucket_arn\n \n vpc_flow_log_tags = {\n Name = \"vpc-flow-logs-s3-bucket\"\n@@ -42,7 +42,7 @@ module \"vpc_with_flow_logs_s3_bucket_parquet\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn = module.s3_bucket.s3_bucket_arn\n flow_log_file_format = \"parquet\"\n \n vpc_flow_log_tags = {\n@@ -102,7 +102,7 @@ resource \"random_pet\" \"this\" {\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n- version = \"~> 1.0\"\n+ version = \"~> 3.0\"\n \n bucket = local.s3_bucket_name\n policy = data.aws_iam_policy_document.flow_log_s3.json\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -4,12 +4,12 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.63\"\n+ version = \">= 3.75\"\n }\n \n random = {\n source = \"hashicorp/random\"\n- version = \">= 2\"\n+ version = \">= 2.0\"\n }\n }\n }\n---\nmodules/vpc-endpoints/main.tf\n@@ -15,7 +15,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n \n vpc_id = var.vpc_id\n service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nexamples/simple-vpc/main.tf\n@@ -11,7 +11,7 @@ locals name ################################################################################\n \n module \"vpc\" {\n- source = \"../../\"\n+ source = \"https://github.com/terraform-aws-modules/terraform-aws-vpc\"\n \n name = \"simple-example\"\n cidr = \"10.0.0.0/16\"\n---\n\n\n---\n\nChoice B:\nexamples/simple-vpc/main.tf\n@@ -11,7 +11,7 @@ locals {\n ################################################################################\n \n module \"vpc\" {\n- source = \"../../\"\n+ source = \"https://github.com/terraform-aws-modules/terraform-aws-vpc\"\n \n name = \"simple-example\"\n \"simple-example\"\n cidr = \"10.0.0.0/16\"\n---\n\n\n---\n\nChoice C:\nexamples/simple-vpc/main.tf\n@@ -11,7 +11,7 @@ locals {\n ################################################################################\n \n module \"vpc\" {\n- source = \"../../\"\n+ source = \"https://github.com/terraform-aws-modules/terraform-aws-vpc\"\n \n name = \"simple-example\"\n cidr = \"10.0.0.0/16\"\n---\n\n\n---\n\nChoice D:\nexamples/simple-vpc/main.tf\n@@ -11,7 +11,7 @@ locals {\n \n module \"vpc\" {\n- source = \"../../\"\n+ source = \"https://github.com/terraform-aws-modules/terraform-aws-vpc\"\n \n name = \"simple-example\"\n cidr = \"10.0.0.0/16\"\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nUpdated `examples/complete-vpc/main.tf` to allow HTTPS from VPC to ssmmessages and ec2messages endpoints\r\n\r\n## Motivation and Context\r\n\r\nEnabling endpoints exactly as described in `examples/complete-vpc/main.tf` breaks SSM communication.\r\n\r\nAs per \r\n\r\n- https://docs.aws.amazon.com/systems-manager/latest/userguide/setup-create-vpc.html\r\n- https://aws.amazon.com/premiumsupport/knowledge-center/ec2-systems-manager-vpc-endpoints/ \r\n\r\nHTTPS (port 443) outbound traffic to the following endpoints must be allowed\r\n\r\n ssm.region.amazonaws.com\r\n ssmmessages.region.amazonaws.com\r\n ec2messages.region.amazonaws.com\r\n\r\n## Breaking Changes\r\nN.A.\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -109,6 +109,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -135,6 +136,7 @@ module \"vpc_endpoints\" {\n service = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = @@ service = \"ecr.api\"\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -109,6 +109,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -135,6 +136,7 @@ module \"vpc_endpoints\" {\n service = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = {\n service = \"ecr.api\"\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -109,6 +109,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -135,6 +136,7 @@ module \"vpc_endpoints\" {\n service = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = {\n service = \"ecr.api\"\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -109,6 +109,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -135,6 +136,7 @@ module \"vpc_endpoints\" {\n service = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = {\n service = \"ecr.api\"\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.outpost_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -311,6 +312,22 @@ resource \"aws_route_table\" \"redshift\" {\n )\n }\n \n+################################################################################\n+# Outposts routes\n+################################################################################\n+\n+resource \"aws_route_table\" \"outpost\" {\n+ count = var.create_vpc && var.create_outpost_subnet_route_table && length(var.outpost_subnets) > 0 ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+\n+ tags = merge(\n+ { \"Name\" = \"${var.name}-${var.outpost_subnet_suffix}\" },\n+ var.tags,\n+ var.outpost_route_table_tags,\n+ )\n+}\n+\n ################################################################################\n # Elasticache routes\n ################################################################################\n@@ -1076,11 +1093,8 @@ resource \"aws_route_table_association\" \"private\" {\n resource \"aws_route_table_association\" \"outpost\" {\n count = var.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n- subnet_id = element(aws_subnet.outpost[*].id, count.index)\n- route_table_id = element(\n- aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n- )\n+ subnet_id = element(aws_subnet.outpost[*].id, count.index)\n+ route_table_id = element(aws_route_table.outpost[*].id, 0)\n }\n \n resource \"aws_route_table_association\" \"database\" {\n---\noutputs.tf\n@@ -238,6 +238,11 @@ output \"public_route_table_ids\" {\n value bool\n@@ = aws_route_table.public[*].id\n }\n \n+output \"outpost_route_table_ids\" {\n+ description = \"List of IDs of outpost route tables\"\n+ value = aws_route_table.outpost[*].id\n+}\n+\n output \"private_route_table_ids\" {\n description = \"List of IDs of private route tables\"\n value = aws_route_table.private[*].id\n---\nvariables.tf\n@@ -214,6 +214,12 @@ variable \"create_database_subnet_route_table\" {\n default = false\n }\n \n+variable \"create_outpost_subnet_route_table\" {\n+ description = \"Controls if separate route table for outpost should be created\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_redshift_subnet_route_table\" {\n description = \"Controls if separate route table for redshift should be created\"\n type = bool\n@@ -478,6 +484,12 @@ variable \"redshift_route_table_tags\" {\n default = {}\n }\n \n+variable \"outpost_route_table_tags\" {\n+ description = \"Additional tags for the outpost route tables\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"elasticache_route_table_tags\" {\n description = \"Additional tags for the elasticache route tables\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.outpost_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -311,6 +312,22 @@ resource \"aws_route_table\" \"redshift\" {\n )\n }\n \n+################################################################################\n+# Outposts routes\n+################################################################################\n+\n+resource \"aws_route_table\" \"outpost\" {\n+ count = var.create_vpc && var.create_outpost_subnet_route_table && length(var.outpost_subnets) > 0 ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+\n+ tags = merge(\n+ { \"Name\" = \"${var.name}-${var.outpost_subnet_suffix}\" },\n+ var.tags,\n+ var.outpost_route_table_tags,\n+ )\n+}\n+\n ################################################################################\n # Elasticache routes\n ################################################################################\n@@ -1076,11 +1093,8 @@ resource \"aws_route_table_association\" \"private\" {\n resource \"aws_route_table_association\" \"outpost\" {\n count = var.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n- subnet_id = element(aws_subnet.outpost[*].id, count.index)\n- route_table_id = element(\n- \"Additional aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n- )\n+ subnet_id = element(aws_subnet.outpost[*].id, count.index)\n+ route_table_id = element(aws_route_table.outpost[*].id, 0)\n }\n \n resource \"aws_route_table_association\" \"database\" {\n---\noutputs.tf\n@@ -238,6 +238,11 @@ output \"public_route_table_ids\" {\n value = aws_route_table.public[*].id\n }\n \n+output \"outpost_route_table_ids\" {\n+ description = \"List of IDs of outpost route tables\"\n+ value = aws_route_table.outpost[*].id\n+}\n+\n output \"private_route_table_ids\" {\n description = \"List of IDs of private route tables\"\n value = aws_route_table.private[*].id\n---\nvariables.tf\n@@ -214,6 +214,12 @@ variable \"create_database_subnet_route_table\" {\n default = false\n }\n \n+variable \"create_outpost_subnet_route_table\" {\n+ description = \"Controls if separate route table for outpost should be created\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_redshift_subnet_route_table\" {\n description = \"Controls if separate route table for redshift should be created\"\n type = bool\n@@ -478,6 +484,12 @@ variable \"redshift_route_table_tags\" {\n default = {}\n }\n \n+variable \"outpost_route_table_tags\" {\n+ description = \"Additional tags for the outpost route tables\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"elasticache_route_table_tags\" {\n description = \"Additional tags for the elasticache route tables\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.outpost_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -311,6 +312,22 @@ resource \"aws_route_table\" \"redshift\" {\n )\n }\n \n+################################################################################\n+# Outposts routes\n+################################################################################\n+\n+resource \"aws_route_table\" \"outpost\" {\n+ count = var.create_vpc && var.create_outpost_subnet_route_table && length(var.outpost_subnets) > 0 ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+\n+ tags = merge(\n+ { \"Name\" = \"${var.name}-${var.outpost_subnet_suffix}\" },\n+ var.tags,\n+ var.outpost_route_table_tags,\n+ )\n+}\n+\n ################################################################################\n # Elasticache routes\n ################################################################################\n@@ -1076,11 +1093,8 @@ resource \"aws_route_table_association\" \"private\" {\n resource \"aws_route_table_association\" \"outpost\" {\n count = var.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n- subnet_id = element(aws_subnet.outpost[*].id, count.index)\n- route_table_id = element(\n- aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n- )\n+ subnet_id = element(aws_subnet.outpost[*].id, count.index)\n+ route_table_id = element(aws_route_table.outpost[*].id, 0)\n }\n \n resource \"aws_route_table_association\" \"database\" {\n---\noutputs.tf\n@@ -238,6 +238,11 @@ output \"public_route_table_ids\" {\n value = aws_route_table.public[*].id\n }\n \n+output \"outpost_route_table_ids\" {\n+ description = \"List of IDs of outpost route tables\"\n+ value = aws_route_table.outpost[*].id\n+}\n+\n output \"private_route_table_ids\" {\n description = \"List of IDs of private route tables\"\n value = aws_route_table.private[*].id\n---\nvariables.tf\n@@ -214,6 +214,12 @@ variable \"create_database_subnet_route_table\" {\n default = false\n }\n \n+variable \"create_outpost_subnet_route_table\" {\n+ description = \"Controls if separate route table for outpost should be created\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_redshift_subnet_route_table\" {\n description = \"Controls if separate route table for redshift should be created\"\n type = bool\n@@ -478,6 +484,12 @@ variable \"redshift_route_table_tags\" {\n default = {}\n }\n \n+variable \"outpost_route_table_tags\" {\n+ description = \"Additional tags for the outpost route tables\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"elasticache_route_table_tags\" {\n description = \"Additional tags for the elasticache route tables\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.outpost_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -311,6 +312,22 @@ resource \"aws_route_table\" \"redshift\" {\n )\n }\n \n+################################################################################\n+# Outposts routes\n+################################################################################\n+\n+resource \"aws_route_table\" \"outpost\" {\n+ count = var.create_vpc && var.create_outpost_subnet_route_table && length(var.outpost_subnets) > 0 ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+\n+ tags = merge(\n+ { \"Name\" = \"${var.name}-${var.outpost_subnet_suffix}\" },\n+ var.tags,\n+ var.outpost_route_table_tags,\n+ )\n+}\n+\n ################################################################################\n # Elasticache routes\n ################################################################################\n@@ -1076,11 +1093,8 @@ resource \"aws_route_table_association\" \"private\" {\n resource \"aws_route_table_association\" \"outpost\" {\n count = var.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n- subnet_id = element(aws_subnet.outpost[*].id, count.index)\n- route_table_id = element(\n- aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n- )\n+ subnet_id = element(aws_subnet.outpost[*].id, count.index)\n+ route_table_id = element(aws_route_table.outpost[*].id, 0)\n }\n \n resource \"aws_route_table_association\" \"database\" {\n---\noutputs.tf\n@@ -238,6 +238,11 @@ output \"public_route_table_ids\" {\n value = aws_route_table.public[*].id\n }\n \n+output \"outpost_route_table_ids\" {\n+ description = \"List of IDs of outpost route tables\"\n+ value = aws_route_table.outpost[*].id\n+}\n+\n output \"private_route_table_ids\" {\n description = \"List of IDs of private route tables\"\n value = aws_route_table.private[*].id\n---\nvariables.tf\n@@ -214,6 +214,12 @@ variable \"create_database_subnet_route_table\" {\n default = false\n }\n \n+variable \"create_outpost_subnet_route_table\" {\n+ description = \"Controls if separate route table for outpost should be created\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_redshift_subnet_route_table\" {\n description = \"Controls if separate route table for redshift should be created\"\n type = bool\n@@ -478,6 +484,12 @@ variable \"redshift_route_table_tags\" {\n default = {}\n }\n \n+variable \"outpost_route_table_tags\" {\n+ description = \"Additional tags for the outpost route tables\"\n+ type = map(string)\n+ default = variable \"elasticache_route_table_tags\" {\n description = \"Additional tags for the elasticache route tables\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAllows Vpc to have a nat gateway even with no private subnets\r\n\r\n## Motivation and Context\r\nError with below nat_gateway configs:\r\n\r\nprivate_subnet \"NOT SET\"\r\n\r\nenable_nat_gateway = true\r\nsingle_nat_gateway = true\r\none_nat_gateway_per_az = false\r\n\r\n\u2502 Error: Error in function call\r\n\u2502\r\n\u2502 on .terraform/modules/openvpn_vpc/main.tf line 905, in resource \"aws_route\" \"private_nat_gateway\":\r\n\u2502 905: route_table_id = element(aws_route_table.private.*.id, count.index)\r\n\u2502 \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\u2502 \u2502 aws_route_table.private is empty tuple\r\n\u2502 \u2502 count.index is 0\r\n\u2502\r\n\u2502 Call to function \"element\" failed: cannot use element function with an empty list.\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\nterraform apply with mentioned configs is running\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1040,7 +1040,7 : resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" 0 {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAllows Vpc to have a nate gateway even with no private subnets\r\n\r\n## Motivation and Context\r\nError with below nat_gateway configs with no private subnet\r\n\r\n enable_nat_gateway = true \r\n single_nat_gateway = true \r\n one_nat_gateway_per_az = false\r\n\r\n\u2502 Error: Error in function call\r\n\u2502 \r\n\u2502 on .terraform/modules/openvpn_vpc/main.tf line 905, in resource \"aws_route\" \"private_nat_gateway\":\r\n\u2502 905: route_table_id = element(aws_route_table.private.*.id, count.index)\r\n\u2502 \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\u2502 \u2502 aws_route_table.private is empty tuple\r\n\u2502 \u2502 count.index is 0\r\n\u2502 \r\n\u2502 Call to function \"element\" failed: cannot use element function with an empty list.\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\nterraform apply with mentioned configs is running\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 count local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway main.tf\n@@ local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAllows Vpc to have a nate gateway even with no private subnets\r\n\r\n## Motivation and Context\r\nError with below nat_gateway configs with no private subnet\r\n\r\n enable_nat_gateway = true \r\n single_nat_gateway = true \r\n one_nat_gateway_per_az = false\r\n\r\n\u2502 Error: Error in function call\r\n\u2502 \r\n\u2502 on .terraform/modules/openvpn_vpc/main.tf line 905, in resource \"aws_route\" \"private_nat_gateway\":\r\n\u2502 905: route_table_id = element(aws_route_table.private.*.id, count.index)\r\n\u2502 \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\u2502 \u2502 aws_route_table.private is empty tuple\r\n\u2502 \u2502 count.index is 0\r\n\u2502 \r\n\u2502 Call to function \"element\" failed: cannot use element function with an empty list.\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\nterraform apply with mentioned configs is running\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -1040,7 +1040,7 @@ \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id main.tf\n@@ = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\nWhen having a VPC with public and private subnets, there are cases where traffic from the private subnet that is destined for `0.0.0.0/0` does not need to go to the NAT Gateway but instead, it should be sent to another destination (e.g., transit gateway). And then only specific traffic that is destined for the internet (e.g., 8.8.8.8/32) should be sent to the NAT Gateway.\r\n\r\nTherefore, this change adds a new conditional variable that enables us to pass a custom destination CIDR block for the NAT Gateway.\r\n\r\n## Motivation and Context\r\n\r\n\r\nWhen having a VPC with public and private subnets, there are cases where traffic from the private subnet that is destined for `0.0.0.0/0` does not need to go to the NAT Gateway but instead, it should be sent to another destination (e.g., transit gateway). And then only specific traffic that is destined for the internet (e.g., 8.8.8.8/32) should be sent to the NAT Gateway.\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\nNo breaking changes were noticed.\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -410,6 +410,7 @@ No modules.\n | [map\\_public\\_ip\\_on\\_launch](#input\\_map\\_public\\_ip\\_on\\_launch) | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n | [name](#input\\_name) | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n+| [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route. | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs`. | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n---\nmain.tf\n@@ -1043,7 +1043,7 @@ resource \"aws_route\" \"private_nat_gateway\" {\n count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n- destination_cidr_block = \"0.0.0.0/0\"\n+ destination_cidr_block = var.nat_gateway_destination_cidr_block\n nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n \n timeouts {\n---\nvariables.tf\n@@ -298,6 +298,12 @@ variable \"enable_nat_gateway\" {\n default = false\n }\n \n+variable \"nat_gateway_destination_cidr_block\" {\n+ description = \"Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route.\"\n+ type = string\n+ default = \"0.0.0.0/0\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -410,6 +410,7 @@ No modules.\n | [map\\_public\\_ip\\_on\\_launch](#input\\_map\\_public\\_ip\\_on\\_launch) | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n | [name](#input\\_name) | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n+| [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route. | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs`. | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n---\nmain.tf\n@@ -1043,7 +1043,7 @@ resource \"aws_route\" \"private_nat_gateway\" {\n count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n- destination_cidr_block = \"0.0.0.0/0\"\n+ destination_cidr_block = var.nat_gateway_destination_cidr_block\n to nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n \n timeouts {\n---\nvariables.tf\n@@ -298,6 +298,12 @@ variable \"enable_nat_gateway\" {\n default = false\n }\n \n+variable \"nat_gateway_destination_cidr_block\" {\n+ description = \"Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route.\"\n+ type = string\n+ default = \"0.0.0.0/0\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -410,6 +410,7 @@ No modules.\n | [map\\_public\\_ip\\_on\\_launch](#input\\_map\\_public\\_ip\\_on\\_launch) | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n | [name](#input\\_name) | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n+| [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route. | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs`. | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n---\nmain.tf\n@@ -1043,7 +1043,7 @@ resource \"aws_route\" \"private_nat_gateway\" {\n count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n- destination_cidr_block = \"0.0.0.0/0\"\n+ destination_cidr_block = var.nat_gateway_destination_cidr_block\n nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n \n timeouts {\n---\nvariables.tf\n@@ -298,6 +298,12 @@ variable \"enable_nat_gateway\" {\n default = false\n }\n \n+variable \"nat_gateway_destination_cidr_block\" {\n+ description = \"Used to pass a custom destination route for private NAT Gateway. If not specified, | default 0.0.0.0/0 is used as a destination route.\"\n+ type = string\n+ default = \"0.0.0.0/0\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -410,6 +410,7 @@ No modules.\n | [map\\_public\\_ip\\_on\\_launch](#input\\_map\\_public\\_ip\\_on\\_launch) | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n | [name](#input\\_name) | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\n | [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n+| [nat\\_gateway\\_destination\\_cidr\\_block](#input\\_nat\\_gateway\\_destination\\_cidr\\_block) | Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route. | `string` | `\"0.0.0.0/0\"` | no |\n | [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n | [one\\_nat\\_gateway\\_per\\_az](#input\\_one\\_nat\\_gateway\\_per\\_az) | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs`. | `bool` | `false` | no |\n | [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n---\nmain.tf\n@@ -1043,7 +1043,7 @@ resource \"aws_route\" \"private_nat_gateway\" {\n count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n- destination_cidr_block = \"0.0.0.0/0\"\n+ destination_cidr_block = var.nat_gateway_destination_cidr_block\n nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n \n timeouts {\n---\nvariables.tf\n@@ -298,6 +298,12 @@ variable \"enable_nat_gateway\" {\n default = false\n }\n \n+variable \"nat_gateway_destination_cidr_block\" {\n+ description = \"Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a route.\"\n+ type = string\n+ default = \"0.0.0.0/0\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdds as outputs maps of AZ to subnet ID for each subnet type (private, public, database, etc)\r\n\r\n## Motivation and Context\r\nHaving a mapping of which subnets were created in each AZ is useful e.g. when creating EKS node groups for each AZ with the terraform EKS module. This output would allow creation of per-az node groups with the AZ in the node group name.\r\n\r\n## Breaking Changes\r\nDoes not break backward compatibility with anything, it is just a collection of new outputs.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [ ] Verified that the output works with no subnets and also multiple subnets\r\n\n\n---\n\nChoice A:\noutputs.tf\n@@ -68,6 +68,11 @@ output \"vpc_owner_id\" {\n value = try(aws_vpc.this[0].owner_id, \"\")\n }\n \n+output \"private_subnet_resources\" {\n+ description = \"List of private subnet resources\"\n+ value = aws_subnet.private\n+}\n+\n output \"private_subnets\" {\n description = \"List of IDs of private subnets\"\n value = aws_subnet.private[*].id\n@@ -88,6 +93,11 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private[*].ipv6_cidr_block\n }\n \n+output \"public_subnet_resources\" {\n+ description = \"List of public subnet resources\"\n+ value = aws_subnet.public\n+}\n+\n output \"public_subnets\" {\n description = \"List of IDs of public subnets\"\n value = aws_subnet.public[*].id\n@@ -108,6 +118,11 @@ output \"public_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.public[*].ipv6_cidr_block\n }\n \n+output \"outpost_subnet_resources\" {\n+ description = \"List of outpost subnet resources\"\n+ value = aws_subnet.outpost\n+}\n+\n output \"outpost_subnets\" {\n description = \"List of IDs of outpost subnets\"\n value = aws_subnet.outpost[*].id\n@@ -128,6 +143,11 @@ output \"outpost_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.outpost[*].ipv6_cidr_block\n }\n \n+output \"database_subnet_resources\" {\n+ description = \"List of database subnet resources\"\n+ value = aws_subnet.database\n+}\n+\n output \"database_subnets\" {\n description = \"List of IDs of database subnets\"\n value = aws_subnet.database[*].id\n@@ -158,6 +178,11 @@ output \"database_subnet_group_name\" {\n value = try(aws_db_subnet_group.database[0].name, \"\")\n }\n \n+output \"redshift_subnet_resources\" {\n+ description = \"List of redshift subnet resources\"\n+ value = aws_subnet.redshift\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value = aws_subnet.redshift[*].id\n@@ -183,6 +208,11 @@ output \"redshift_subnet_group\" {\n value = try(aws_redshift_subnet_group.redshift[0].id, \"\")\n }\n \n+output \"elasticache_subnet_resources\" {\n+ description = \"List of elasticache subnet resources\"\n+ value = aws_subnet.elasticache\n+}\n+\n output \"elasticache_subnets\" {\n description = \"List of IDs of elasticache subnets\"\n value = aws_subnet.elasticache[*].id\n@@ -203,6 +233,11 @@ output \"elasticache_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.elasticache[*].ipv6_cidr_block\n }\n \n+output \"intra_subnet_resources\" {\n+ description = \"List of intra subnet resources\"\n+ value = aws_subnet.intra\n+}\n+\n output \"intra_subnets\" {\n description = \"List of IDs of intra subnets\"\n value = aws_subnet.intra[*].id\n---\n\n\n---\n\nChoice B:\noutputs.tf\n@@ -68,6 +68,11 @@ output \"vpc_owner_id\" {\n value = try(aws_vpc.this[0].owner_id, \"\")\n }\n \n+output \"private_subnet_resources\" {\n+ description = \"List of private subnet resources\"\n+ value = aws_subnet.private\n+}\n+\n output \"private_subnets\" {\n description = \"List of IDs of private subnets\"\n value = aws_subnet.private[*].id\n@@ -88,6 +93,11 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private[*].ipv6_cidr_block\n \n+output \"public_subnet_resources\" {\n+ description = \"List of public subnet resources\"\n+ value = aws_subnet.public\n+}\n+\n output \"public_subnets\" {\n description = \"List of IDs of public subnets\"\n value = aws_subnet.public[*].id\n@@ -108,6 +118,11 @@ output \"public_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.public[*].ipv6_cidr_block\n }\n \n+output \"outpost_subnet_resources\" {\n+ description = \"List of outpost subnet resources\"\n+ value = aws_subnet.outpost\n+}\n+\n output \"outpost_subnets\" {\n description = \"List of IDs of outpost subnets\"\n value = aws_subnet.outpost[*].id\n@@ -128,6 +143,11 @@ output \"outpost_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.outpost[*].ipv6_cidr_block\n }\n \n+output \"database_subnet_resources\" {\n+ description = \"List of database subnet resources\"\n+ value = aws_subnet.database\n+}\n+\n output \"database_subnets\" {\n description = \"List of IDs of database subnets\"\n value = aws_subnet.database[*].id\n@@ -158,6 +178,11 @@ output \"database_subnet_group_name\" {\n value = try(aws_db_subnet_group.database[0].name, \"\")\n }\n \n+output \"redshift_subnet_resources\" {\n+ description = \"List of redshift subnet resources\"\n+ value = aws_subnet.redshift\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value = aws_subnet.redshift[*].id\n@@ -183,6 +208,11 @@ output \"redshift_subnet_group\" {\n value = try(aws_redshift_subnet_group.redshift[0].id, \"\")\n }\n \n+output \"elasticache_subnet_resources\" {\n+ description = \"List of elasticache subnet resources\"\n+ value = aws_subnet.elasticache\n+}\n+\n output \"elasticache_subnets\" {\n description = \"List of IDs of elasticache subnets\"\n value = aws_subnet.elasticache[*].id\n@@ -203,6 +233,11 @@ output \"elasticache_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.elasticache[*].ipv6_cidr_block\n }\n \n+output \"intra_subnet_resources\" {\n+ description = \"List of intra subnet resources\"\n+ value = aws_subnet.intra\n+}\n+\n output \"intra_subnets\" {\n description = \"List of IDs of intra subnets\"\n value = aws_subnet.intra[*].id\n---\n\n\n---\n\nChoice C:\noutputs.tf\n@@ -68,6 +68,11 @@ output \"vpc_owner_id\" {\n value = try(aws_vpc.this[0].owner_id, \"\")\n }\n \n+output \"private_subnet_resources\" {\n+ description = \"List of private subnet resources\"\n+ value = aws_subnet.private\n+}\n+\n output \"private_subnets\" {\n description = \"List of IDs of private subnets\"\n value = aws_subnet.private[*].id\n@@ -88,6 +93,11 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private[*].ipv6_cidr_block\n }\n \n+output \"public_subnet_resources\" {\n+ description = \"List of public subnet resources\"\n+ value = aws_subnet.public\n+}\n+\n output \"public_subnets\" {\n description = \"List of IDs of public subnets\"\n value = aws_subnet.public[*].id\n@@ -108,6 +118,11 @@ output \"public_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.public[*].ipv6_cidr_block\n }\n \n+output \"outpost_subnet_resources\" {\n+ description = \"List of outpost subnet resources\"\n+ value = aws_subnet.outpost\n+}\n+\n output \"outpost_subnets\" {\n description = \"List of IDs of outpost subnets\"\n value = aws_subnet.outpost[*].id\n@@ -128,6 +143,11 @@ output \"outpost_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.outpost[*].ipv6_cidr_block\n }\n \n+output \"database_subnet_resources\" {\n+ description = \"List of database subnet resources\"\n+ value = aws_subnet.database\n+}\n+\n output \"database_subnets\" {\n description = \"List of IDs of database subnets\"\n value = aws_subnet.database[*].id\n@@ -158,6 +178,11 @@ output \"database_subnet_group_name\" {\n value = try(aws_db_subnet_group.database[0].name, \"\")\n }\n \n+output \"redshift_subnet_resources\" {\n+ description = \"List of redshift subnet resources\"\n+ value = aws_subnet.redshift\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value description = aws_subnet.redshift[*].id\n@@ -183,6 +208,11 @@ output \"redshift_subnet_group\" {\n value = try(aws_redshift_subnet_group.redshift[0].id, \"\")\n }\n \n+output \"elasticache_subnet_resources\" {\n+ description = \"List of elasticache subnet resources\"\n+ value = aws_subnet.elasticache\n+}\n+\n output \"elasticache_subnets\" {\n description = \"List of IDs of elasticache subnets\"\n value = aws_subnet.elasticache[*].id\n@@ -203,6 +233,11 @@ output \"elasticache_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.elasticache[*].ipv6_cidr_block\n }\n \n+output \"intra_subnet_resources\" {\n+ description = \"List of intra subnet resources\"\n+ value = aws_subnet.intra\n+}\n+\n output \"intra_subnets\" {\n description = \"List of IDs of intra subnets\"\n value = aws_subnet.intra[*].id\n---\n\n\n---\n\nChoice D:\noutputs.tf\n@@ -68,6 +68,11 @@ output \"vpc_owner_id\" {\n value = try(aws_vpc.this[0].owner_id, \"\")\n }\n \n+output \"private_subnet_resources\" {\n+ description = \"List of private subnet resources\"\n+ value = aws_subnet.private\n+}\n+\n output \"private_subnets\" {\n description = \"List of IDs of private subnets\"\n value = aws_subnet.private[*].id\n@@ -88,6 +93,11 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private[*].ipv6_cidr_block\n }\n \n+output \"public_subnet_resources\" {\n+ description = \"List of public subnet resources\"\n+ value = aws_subnet.public\n+}\n+\n output \"public_subnets\" {\n description = \"List of IDs of public subnets\"\n value = aws_subnet.public[*].id\n@@ -108,6 +118,11 @@ output \"public_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.public[*].ipv6_cidr_block\n }\n \n+output \"outpost_subnet_resources\" {\n+ description = \"List of outpost subnet resources\"\n+ value = aws_subnet.outpost\n+}\n+\n output \"outpost_subnets\" {\n description = \"List of IDs of outpost subnets\"\n value = aws_subnet.outpost[*].id\n@@ -128,6 +143,11 @@ output \"outpost_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.outpost[*].ipv6_cidr_block\n }\n \n+output \"database_subnet_resources\" {\n+ description = \"List of database subnet resources\"\n+ value = aws_subnet.database\n+}\n+\n output \"database_subnets\" {\n description = \"List of IDs of database subnets\"\n value = aws_subnet.database[*].id\n@@ -158,6 +178,11 @@ output \"database_subnet_group_name\" {\n value = try(aws_db_subnet_group.database[0].name, \"\")\n }\n \n+output \"redshift_subnet_resources\" {\n+ description = \"List of redshift subnet resources\"\n+ value = aws_subnet.redshift\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value = aws_subnet.redshift[*].id\n@@ +208,11 +208,11 @@ output \"redshift_subnet_group\" {\n value = try(aws_redshift_subnet_group.redshift[0].id, \"\")\n }\n \n+output \"elasticache_subnet_resources\" {\n+ description = \"List of elasticache subnet resources\"\n+ value = aws_subnet.elasticache\n+}\n+\n output \"elasticache_subnets\" {\n description = \"List of IDs of elasticache subnets\"\n value = aws_subnet.elasticache[*].id\n@@ -203,6 +233,11 @@ output \"elasticache_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.elasticache[*].ipv6_cidr_block\n }\n \n+output \"intra_subnet_resources\" {\n+ description = \"List of intra subnet resources\"\n+ value = aws_subnet.intra\n+}\n+\n output \"intra_subnets\" {\n description = \"List of IDs of intra subnets\"\n value = aws_subnet.intra[*].id\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdd a new subnet type : tgwattach. The tgwattach subnet are usually small subnet range with no route table associated with unless you set the parameter `tgwattach_associate_private_route_table` to true to benefit from the default route to NAT Gateway in case of an outbound VPC.\r\n\r\n## Motivation and Context\r\nFollowing AWS best practices for Transit Gateway attachement: https://docs.aws.amazon.com/vpc/latest/tgw/tgw-best-design-practices.html:\r\n*Use a separate subnet for each transit gateway VPC attachment. For each subnet, use a small CIDR, for example /28, so that you have more addresses for EC2 resources*\r\n\r\nThese attachement subnets does not need ACLs neither route table, unless the VPC to be attached is an outbound VPC. In this case a route to NAT Gateway must be set. This is done by associating the `private` route table to those subnets with the parameter `tgwattach_associate_private_route_table` (set it to `true`or `false`)\r\n\r\n(if ACL is required, it is possible to enhance the module and add ACLs for the tgwattach subnets)\r\n\r\n## Breaking Changes\r\nNo breaking change noticed.\r\n\r\n## How Has This Been Tested?\r\nI tested the changes with a hub and spoke architecture, using a transit Gateway, three `application VPCs` (no internet gateway and NAT Gateway) and an outbound VPC (with IGW and NAT GW)\r\nThe new module is compatible with the Transit Gateway module. Attachement is performed thanks to the `tgwattach_subnets` IDs output.\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.tgwattach_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -578,6 +579,33 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+######################################################################################\n+# Transit Gateway Attachement subnets - private subnet for Transit Gateway Attachement\n+######################################################################################\n+\n+resource \"aws_subnet\" \"tgwattach\" {\n+ count = var.create_vpc && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = var.tgwattach_subnets[count.index]\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ assign_ipv6_address_on_creation = var.tgwattach_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.tgwattach_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.tgwattach_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.intra_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${var.tgwattach_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.tgwattach_subnet_tags,\n+ )\n+}\n+\n ################################################################################\n # Default Network ACLs\n ################################################################################\n@@ -594,6 +622,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_subnet.public[*].id,\n aws_subnet.private[*].id,\n aws_subnet.intra[*].id,\n+ aws_subnet.tgwattach[*].id,\n aws_subnet.database[*].id,\n aws_subnet.redshift[*].id,\n aws_subnet.elasticache[*].id,\n@@ -603,6 +632,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_network_acl.public[*].subnet_ids,\n aws_network_acl.private[*].subnet_ids,\n aws_network_acl.intra[*].subnet_ids,\n+ # aws_network_acl.tgwattach[*].subnet_ids,\n aws_network_acl.database[*].subnet_ids,\n aws_network_acl.redshift[*].subnet_ids,\n aws_network_acl.elasticache[*].subnet_ids,\n@@ -1148,6 +1178,16 @@ resource \"aws_route_table_association\" \"intra\" {\n route_table_id = element(aws_route_table.intra[*].id, 0)\n }\n \n+resource \"aws_route_table_association\" \"tgwattach\" {\n+ count = var.create_vpc && var.tgwattach_associate_private_route_table && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.tgwattach[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"public\" {\n count = var.create_vpc && length(var.public_subnets) > 0 ? length(var.public_subnets) : 0\n \n---\noutputs.tf\n@@ -223,6 +223,26 @@ output \"intra_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.intra[*].ipv6_cidr_block\n }\n \n+output \"tgwattach_subnets\" {\n+ description = \"List of IDs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].id\n+}\n+\n+output \"tgwattach_subnet_arns\" {\n+ description = \"List of ARNs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].arn\n+}\n+\n+output \"tgwattach_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].cidr_block\n+}\n+\n+output \"tgwattach_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of TGW Attachement subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.tgwattach[*].ipv6_cidr_block\n+}\n+\n output \"elasticache_subnet_group\" {\n description = \"ID of elasticache subnet group\"\n value = try(aws_elasticache_subnet_group.elasticache[0].id, \"\")\n@@ -328,6 +348,11 @@ output {\n value = aws_route_table_association.intra[*].id\n }\n \n+output \"tgwattach_route_table_association_ids\" {\n+ description = \"List of IDs of the TGW Attachement route table association\"\n+ value = aws_route_table_association.tgwattach[*].id\n+}\n+\n output \"public_route_table_association_ids\" {\n description = \"List of IDs of the public route table association\"\n value = aws_route_table_association.public[*].id\n---\nvariables.tf\n@@ -64,6 +64,12 @@ variable \"intra_subnet_ipv6_prefixes\" {\n default = []\n }\n \n+variable \"tgwattach_subnet_ipv6_prefixes\" {\n+ description = \"Assigns IPv6 TGW Attachement subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"assign_ipv6_address_on_creation\" {\n description = \"Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n type = bool\n@@ -112,6 +118,12 @@ variable \"intra_subnet_assign_ipv6_address_on_creation\" {\n default = null\n }\n \n+variable \"tgwattach_subnet_assign_ipv6_address_on_creation\" {\n+ description = \"Assign IPv6 address on TGW Attachement subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool\"\n type = list(string)\n@@ -148,6 +160,12 @@ variable \"intra_subnet_suffix\" {\n default = \"intra\"\n }\n \n+variable \"tgwattach_subnet_suffix\" {\n+ description = \"Suffix to append to TGW Attachement subnets name\"\n+ type = string\n+ default = \"tgwattach\"\n+}\n+\n variable \"database_subnet_suffix\" {\n description = \"Suffix to append to database subnets name\"\n type = string\n@@ -208,6 +226,12 @@ variable \"intra_subnets\" {\n default = []\n }\n \n+variable \"tgwattach_subnets\" {\n+ description = \"A list of TGW Attachement subnets\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"create_database_subnet_route_table\" {\n description = \"Controls if separate route table for database should be created\"\n type = bool\n@@ -262,6 +286,12 @@ variable \"create_database_nat_gateway_route\" {\n default = false\n }\n \n+variable \"tgwattach_associate_private_route_table\" {\n+ description = \"Controls if the private route talbe should be attached to give internet access to the TGW Attachement subnets\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"azs\" {\n description = \"A list of availability zones names or ids in the region\"\n type = list(string)\n@@ -544,6 +574,12 @@ variable \"intra_subnet_tags\" {\n default = {}\n }\n \n+variable \"tgwattach_subnet_tags\" {\n+ description = \"Additional tags for the TGW Attachement subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"public_acl_tags\" {\n description = \"Additional tags for the public subnets network ACL\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.tgwattach_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -578,6 +579,33 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+######################################################################################\n+# Transit Gateway Attachement subnets - private subnet for Transit Gateway Attachement\n+######################################################################################\n+\n+resource \"aws_subnet\" \"tgwattach\" {\n+ count = var.create_vpc && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = var.tgwattach_subnets[count.index]\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ assign_ipv6_address_on_creation = var.tgwattach_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.tgwattach_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.tgwattach_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.intra_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${var.tgwattach_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.tgwattach_subnet_tags,\n+ )\n+}\n+\n ################################################################################\n # Default Network ACLs\n ################################################################################\n@@ -594,6 +622,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_subnet.public[*].id,\n aws_subnet.private[*].id,\n aws_subnet.intra[*].id,\n+ aws_subnet.tgwattach[*].id,\n aws_subnet.database[*].id,\n aws_subnet.redshift[*].id,\n aws_subnet.elasticache[*].id,\n@@ -603,6 +632,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_network_acl.public[*].subnet_ids,\n aws_network_acl.private[*].subnet_ids,\n aws_network_acl.intra[*].subnet_ids,\n+ # aws_network_acl.tgwattach[*].subnet_ids,\n aws_network_acl.database[*].subnet_ids,\n aws_network_acl.redshift[*].subnet_ids,\n aws_network_acl.elasticache[*].subnet_ids,\n@@ -1148,6 +1178,16 @@ resource \"aws_route_table_association\" \"intra\" {\n route_table_id = element(aws_route_table.intra[*].id, 0)\n }\n \n+resource \"aws_route_table_association\" \"tgwattach\" {\n+ count = var.create_vpc && var.tgwattach_associate_private_route_table && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.tgwattach[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"public\" {\n count = var.create_vpc && length(var.public_subnets) > 0 ? length(var.public_subnets) : 0\n \n---\noutputs.tf\n@@ -223,6 +223,26 @@ output \"intra_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.intra[*].ipv6_cidr_block\n }\n \n+output \"tgwattach_subnets\" {\n+ description = \"List of IDs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].id\n+}\n+\n+output \"tgwattach_subnet_arns\" {\n+ description = \"List of ARNs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].arn\n+}\n+\n+output \"tgwattach_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].cidr_block\n+}\n+\n+output \"tgwattach_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of TGW Attachement subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.tgwattach[*].ipv6_cidr_block\n+}\n+\n output \"elasticache_subnet_group\" {\n description = \"ID of elasticache subnet group\"\n value = try(aws_elasticache_subnet_group.elasticache[0].id, \"\")\n@@ -328,6 +348,11 @@ output \"intra_route_table_association_ids\" {\n value = aws_route_table_association.intra[*].id\n }\n \n+output \"tgwattach_route_table_association_ids\" {\n+ description = \"List of IDs of the TGW Attachement route table association\"\n+ value = aws_route_table_association.tgwattach[*].id\n+}\n+\n output \"public_route_table_association_ids\" {\n description = \"List of IDs of the public route table association\"\n value = aws_route_table_association.public[*].id\n---\nvariables.tf\n@@ -64,6 +64,12 @@ variable \"intra_subnet_ipv6_prefixes\" {\n default = []\n }\n \n+variable \"tgwattach_subnet_ipv6_prefixes\" {\n+ description = \"Assigns IPv6 TGW Attachement subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"assign_ipv6_address_on_creation\" {\n description = \"Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n type = bool\n@@ -112,6 +118,12 @@ variable \"intra_subnet_assign_ipv6_address_on_creation\" {\n default = null\n }\n \n+variable \"tgwattach_subnet_assign_ipv6_address_on_creation\" {\n+ description = \"Assign IPv6 address on TGW Attachement subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool\"\n type = list(string)\n@@ -148,6 +160,12 @@ variable \"intra_subnet_suffix\" {\n default = \"intra\"\n }\n \n+variable \"tgwattach_subnet_suffix\" {\n+ description = \"Suffix to append to TGW Attachement subnets name\"\n+ type = string\n+ default = \"tgwattach\"\n+}\n+\n variable \"database_subnet_suffix\" {\n description = \"Suffix to append to database subnets name\"\n type = string\n@@ -208,6 +226,12 @@ variable \"intra_subnets\" {\n default = []\n }\n \n+variable \"tgwattach_subnets\" {\n+ description = \"A list of TGW Attachement subnets\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"create_database_subnet_route_table\" {\n description = \"Controls if separate route table for database should be created\"\n type = bool\n@@ -262,6 +286,12 @@ variable \"create_database_nat_gateway_route\" {\n default = false\n }\n \n+variable \"tgwattach_associate_private_route_table\" {\n+ description = \"Controls if the private route talbe should be attached to give internet access to the TGW Attachement subnets\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"azs\" {\n description = \"A list of availability zones names or ids in the region\"\n type = list(string)\n@@ -544,6 +574,12 @@ variable \"intra_subnet_tags\" {\n default = {}\n }\n \n+variable \"tgwattach_subnet_tags\" {\n+ description = \"Additional tags for the TGW Attachement subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"public_acl_tags\" {\n description = \"Additional tags for the public subnets network ACL\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.tgwattach_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -578,6 +579,33 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+######################################################################################\n+# Transit Gateway Attachement subnets - private subnet for Transit Gateway Attachement\n+######################################################################################\n+\n+resource \"aws_subnet\" \"tgwattach\" {\n+ count = var.create_vpc && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = var.tgwattach_subnets[count.index]\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ assign_ipv6_address_on_creation = var.tgwattach_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.tgwattach_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.tgwattach_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.intra_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${var.tgwattach_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.tgwattach_subnet_tags,\n+ )\n+}\n+\n ################################################################################\n # Default Network ACLs\n ################################################################################\n@@ -594,6 +622,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_subnet.public[*].id,\n aws_subnet.private[*].id,\n aws_subnet.intra[*].id,\n+ aws_subnet.tgwattach[*].id,\n aws_subnet.database[*].id,\n aws_subnet.redshift[*].id,\n aws_subnet.elasticache[*].id,\n@@ -603,6 +632,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_network_acl.public[*].subnet_ids,\n aws_network_acl.private[*].subnet_ids,\n aws_network_acl.intra[*].subnet_ids,\n+ # aws_network_acl.tgwattach[*].subnet_ids,\n aws_network_acl.database[*].subnet_ids,\n aws_network_acl.redshift[*].subnet_ids,\n aws_network_acl.elasticache[*].subnet_ids,\n@@ -1148,6 +1178,16 @@ resource \"aws_route_table_association\" \"intra\" {\n route_table_id = element(aws_route_table.intra[*].id, 0)\n }\n \n+resource \"aws_route_table_association\" \"tgwattach\" {\n+ count = var.create_vpc && var.tgwattach_associate_private_route_table && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.tgwattach[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"public\" {\n count = ACL\"\n && length(var.public_subnets) > 0 ? length(var.public_subnets) : 0\n \n---\noutputs.tf\n@@ -223,6 +223,26 @@ output \"intra_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.intra[*].ipv6_cidr_block\n }\n \n+output \"tgwattach_subnets\" {\n+ description = \"List of IDs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].id\n+}\n+\n+output \"tgwattach_subnet_arns\" {\n+ description = \"List of ARNs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].arn\n+}\n+\n+output \"tgwattach_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].cidr_block\n+}\n+\n+output \"tgwattach_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of TGW Attachement subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.tgwattach[*].ipv6_cidr_block\n+}\n+\n output \"elasticache_subnet_group\" {\n description = \"ID of elasticache subnet group\"\n value = try(aws_elasticache_subnet_group.elasticache[0].id, \"\")\n@@ -328,6 +348,11 @@ output \"intra_route_table_association_ids\" {\n value = aws_route_table_association.intra[*].id\n }\n \n+output \"tgwattach_route_table_association_ids\" {\n+ description = \"List of IDs of the TGW Attachement route table association\"\n+ value = aws_route_table_association.tgwattach[*].id\n+}\n+\n output \"public_route_table_association_ids\" {\n description = \"List of IDs of the public route table association\"\n value = aws_route_table_association.public[*].id\n---\nvariables.tf\n@@ -64,6 +64,12 @@ variable \"intra_subnet_ipv6_prefixes\" {\n default = []\n }\n \n+variable \"tgwattach_subnet_ipv6_prefixes\" {\n+ description = \"Assigns IPv6 TGW Attachement subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"assign_ipv6_address_on_creation\" {\n description = \"Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n type = bool\n@@ -112,6 +118,12 @@ variable \"intra_subnet_assign_ipv6_address_on_creation\" {\n default = null\n }\n \n+variable \"tgwattach_subnet_assign_ipv6_address_on_creation\" {\n+ description = \"Assign IPv6 address on TGW Attachement subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool\"\n type = list(string)\n@@ -148,6 +160,12 @@ variable \"intra_subnet_suffix\" {\n default = \"intra\"\n }\n \n+variable \"tgwattach_subnet_suffix\" {\n+ description = \"Suffix to append to TGW Attachement subnets name\"\n+ type = string\n+ default = \"tgwattach\"\n+}\n+\n variable \"database_subnet_suffix\" {\n description = \"Suffix to append to database subnets name\"\n type = string\n@@ -208,6 +226,12 @@ variable \"intra_subnets\" {\n default = []\n }\n \n+variable \"tgwattach_subnets\" {\n+ description = \"A list of TGW Attachement subnets\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"create_database_subnet_route_table\" {\n description = \"Controls if separate route table for database should be created\"\n type = bool\n@@ -262,6 +286,12 @@ variable \"create_database_nat_gateway_route\" {\n default = false\n }\n \n+variable \"tgwattach_associate_private_route_table\" {\n+ description = \"Controls if the private route talbe should be attached to give internet access to the TGW Attachement subnets\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"azs\" {\n description = \"A list of availability zones names or ids in the region\"\n type = list(string)\n@@ -544,6 +574,12 @@ variable \"intra_subnet_tags\" {\n default = {}\n }\n \n+variable \"tgwattach_subnet_tags\" {\n+ description = \"Additional tags for the TGW Attachement subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"public_acl_tags\" {\n description = \"Additional tags for the public subnets network ACL\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.tgwattach_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -578,6 +579,33 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+######################################################################################\n+# Transit Gateway Attachement subnets - private subnet for Transit Gateway Attachement\n+######################################################################################\n+\n+resource \"aws_subnet\" \"tgwattach\" {\n+ count = var.create_vpc && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = var.tgwattach_subnets[count.index]\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index,\n+ : null\n+ assign_ipv6_address_on_creation = var.tgwattach_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.tgwattach_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.tgwattach_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.intra_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${var.tgwattach_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.tgwattach_subnet_tags,\n+ )\n+}\n+\n ################################################################################\n # Default Network ACLs\n ################################################################################\n@@ -594,6 +622,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_subnet.public[*].id,\n aws_subnet.private[*].id,\n aws_subnet.intra[*].id,\n+ aws_subnet.tgwattach[*].id,\n aws_subnet.database[*].id,\n aws_subnet.redshift[*].id,\n aws_subnet.elasticache[*].id,\n@@ -603,6 +632,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_network_acl.public[*].subnet_ids,\n aws_network_acl.private[*].subnet_ids,\n aws_network_acl.intra[*].subnet_ids,\n+ # aws_network_acl.tgwattach[*].subnet_ids,\n aws_network_acl.database[*].subnet_ids,\n aws_network_acl.redshift[*].subnet_ids,\n aws_network_acl.elasticache[*].subnet_ids,\n@@ -1148,6 +1178,16 @@ resource \"aws_route_table_association\" \"intra\" {\n route_table_id = element(aws_route_table.intra[*].id, 0)\n }\n \n+resource \"aws_route_table_association\" \"tgwattach\" {\n+ count = var.create_vpc && var.tgwattach_associate_private_route_table && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.tgwattach[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"public\" {\n count = var.create_vpc && length(var.public_subnets) > 0 ? length(var.public_subnets) : 0\n \n---\noutputs.tf\n@@ -223,6 +223,26 @@ output \"intra_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.intra[*].ipv6_cidr_block\n }\n \n+output \"tgwattach_subnets\" {\n+ description = \"List of IDs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].id\n+}\n+\n+output \"tgwattach_subnet_arns\" {\n+ description = \"List of ARNs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].arn\n+}\n+\n+output \"tgwattach_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].cidr_block\n+}\n+\n+output \"tgwattach_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of TGW Attachement subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.tgwattach[*].ipv6_cidr_block\n+}\n+\n output \"elasticache_subnet_group\" {\n description = \"ID of elasticache subnet group\"\n value = try(aws_elasticache_subnet_group.elasticache[0].id, \"\")\n@@ -328,6 +348,11 @@ output \"intra_route_table_association_ids\" {\n value = aws_route_table_association.intra[*].id\n }\n \n+output \"tgwattach_route_table_association_ids\" {\n+ description = \"List of IDs of the TGW Attachement route table association\"\n+ value = aws_route_table_association.tgwattach[*].id\n+}\n+\n output \"public_route_table_association_ids\" {\n description = \"List of IDs of the public route table association\"\n value = aws_route_table_association.public[*].id\n---\nvariables.tf\n@@ -64,6 +64,12 @@ variable \"intra_subnet_ipv6_prefixes\" {\n default = []\n }\n \n+variable \"tgwattach_subnet_ipv6_prefixes\" {\n+ description = \"Assigns IPv6 TGW Attachement subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"assign_ipv6_address_on_creation\" {\n description = \"Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n type = bool\n@@ -112,6 +118,12 @@ variable \"intra_subnet_assign_ipv6_address_on_creation\" {\n default = null\n }\n \n+variable \"tgwattach_subnet_assign_ipv6_address_on_creation\" {\n+ description = \"Assign IPv6 address on TGW Attachement subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool\"\n type = list(string)\n@@ -148,6 +160,12 @@ variable \"intra_subnet_suffix\" {\n default = \"intra\"\n }\n \n+variable \"tgwattach_subnet_suffix\" {\n+ description = \"Suffix to append to TGW Attachement subnets name\"\n+ type = string\n+ default = \"tgwattach\"\n+}\n+\n variable \"database_subnet_suffix\" {\n description = \"Suffix to append to database subnets name\"\n type = string\n@@ -208,6 +226,12 @@ variable \"intra_subnets\" {\n default = []\n }\n \n+variable \"tgwattach_subnets\" {\n+ description = \"A list of TGW Attachement subnets\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"create_database_subnet_route_table\" {\n description = \"Controls if separate route table for database should be created\"\n type = bool\n@@ -262,6 +286,12 @@ variable \"create_database_nat_gateway_route\" {\n default = false\n }\n \n+variable \"tgwattach_associate_private_route_table\" {\n+ description = \"Controls if the private route talbe should be attached to give internet access to the TGW Attachement subnets\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"azs\" {\n description = \"A list of availability zones names or ids in the region\"\n type = list(string)\n@@ -544,6 +574,12 @@ variable \"intra_subnet_tags\" {\n default = {}\n }\n \n+variable \"tgwattach_subnet_tags\" {\n+ description = \"Additional tags for the TGW Attachement subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"public_acl_tags\" {\n description = \"Additional tags for the public subnets network ACL\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nfix for dynamodb resource not found error in the example.\r\n\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -208,7 +208,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n test = \"StringNotEquals\"\n variable = \"aws:sourceVpce\"\n \n- values = [data.aws_vpc_endpoint.dynamodb.id]\n+ values = [data.vpc.vpc_id]\n }\n }\n }\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -208,7 +208,7 @@ data \"aws_iam_policy_document\" {\n test = \"StringNotEquals\"\n variable = \"aws:sourceVpce\"\n \n- values = [data.aws_vpc_endpoint.dynamodb.id]\n+ values = [data.vpc.vpc_id]\n }\n }\n }\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -208,7 +208,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n test = \"StringNotEquals\"\n variable = \"aws:sourceVpce\"\n \n- values = [data.aws_vpc_endpoint.dynamodb.id]\n+ values = }\n }\n }\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -208,7 +208,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n test = \"StringNotEquals\"\n -208,7 variable = \"aws:sourceVpce\"\n \n- values = [data.aws_vpc_endpoint.dynamodb.id]\n+ values = [data.vpc.vpc_id]\n }\n }\n }\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nTested, described reasoning in the following issue:\r\nhttps://github.com/terraform-aws-modules/terraform-aws-vpc/issues/740\n\n---\n\nChoice A:\nmain.tf\n@@ -1074,6 +1074,27 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n egress_only_gateway_id = element(aws_egress_only_internet_gateway.this[*].id, 0)\n }\n \n+resource \"aws_route\" \"private_route_table_routes\" {\n+ count = length(var.private_subnets) * length(var.private_route_table_routes)\n+\n+ route_table_id = element(aws_route_table.private[*].id, floor(count.index / length(var.private_route_table_routes)))\n+ destination_cidr_block = element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))).cidr_block\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"gateway_id\", null)\n+ instance_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"instance_id\", null)\n+ nat_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"nat_gateway_id\", null)\n+ network_interface_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"network_interface_id\", null)\n+ transit_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_peering_connection_id\", null)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n ################################################################################\n # Route table association\n ################################################################################\n---\nvariables.tf\n@@ -406,6 +406,12 @@ variable \"default_route_table_routes\" {\n default = []\n }\n \n+variable \"private_route_table_routes\" {\n+ description = \"Configuration block of private routes.\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"default_route_table_tags\" {\n = \"Additional tags for the default route table\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1074,6 +1074,27 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n egress_only_gateway_id = element(aws_egress_only_internet_gateway.this[*].id, 0)\n }\n \n+resource \"aws_route\" \"private_route_table_routes\" {\n+ count = length(var.private_subnets) * length(var.private_route_table_routes)\n+\n+ route_table_id = element(aws_route_table.private[*].id, floor(count.index / length(var.private_route_table_routes)))\n+ destination_cidr_block = element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))).cidr_block\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"gateway_id\", null)\n+ instance_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"instance_id\", null)\n+ nat_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"nat_gateway_id\", null)\n+ network_interface_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"network_interface_id\", null)\n+ transit_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_peering_connection_id\", null)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n ################################################################################\n # Route table association\n ################################################################################\n---\nvariables.tf\n@@ -406,6 +406,12 @@ variable \"default_route_table_routes\" {\n default = []\n }\n \n+variable \"private_route_table_routes\" {\n+ description = \"Configuration block of private routes.\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"default_route_table_tags\" {\n description = \"Additional for the default route table\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1074,6 +1074,27 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n egress_only_gateway_id = element(aws_egress_only_internet_gateway.this[*].id, 0)\n }\n \n+resource \"aws_route\" \"private_route_table_routes\" {\n+ count = length(var.private_subnets) * length(var.private_route_table_routes)\n+\n+ route_table_id = element(aws_route_table.private[*].id, floor(count.index / length(var.private_route_table_routes)))\n+ destination_cidr_block = element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))).cidr_block\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"gateway_id\", null)\n+ instance_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"instance_id\", null)\n+ nat_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"nat_gateway_id\", null)\n+ network_interface_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"network_interface_id\", null)\n+ transit_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_peering_connection_id\", null)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n ################################################################################\n # Route table association\n ################################################################################\n---\nvariables.tf\n@@ -406,6 +406,12 @@ variable \"default_route_table_routes\" {\n default = []\n }\n \n+variable \"private_route_table_routes\" {\n+ description = \"Configuration block of private routes.\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"default_route_table_tags\" {\n description = \"Additional tags for the default route table\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1074,6 +1074,27 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n egress_only_gateway_id = element(aws_egress_only_internet_gateway.this[*].id, 0)\n }\n \n+resource \"aws_route\" \"private_route_table_routes\" {\n+ count = length(var.private_subnets) * length(var.private_route_table_routes)\n+\n+ route_table_id = element(aws_route_table.private[*].id, floor(count.index / length(var.private_route_table_routes)))\n+ destination_cidr_block = element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))).cidr_block\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"gateway_id\", null)\n+ instance_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"instance_id\", null)\n+ nat_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"nat_gateway_id\", null)\n+ network_interface_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"network_interface_id\", null)\n+ transit_gateway_id lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_peering_connection_id\", null)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n ################################################################################\n # Route table association\n ################################################################################\n---\nvariables.tf\n@@ -406,6 +406,12 @@ variable \"default_route_table_routes\" {\n default = []\n }\n \n+variable \"private_route_table_routes\" {\n+ description = \"Configuration block of private routes.\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"default_route_table_tags\" {\n description = \"Additional tags for the default route table\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nFixed #738\n\n---\n\nChoice A:\noutputs.tf\n@@ -250,7 +250,7 @@ output \"database_route_table_ids\" {\n \n output \"redshift_route_table_ids\" {\n description = \"List of IDs of route tables\"\n- value = try(coalescelist(aws_route_table.redshift[*].id, aws_route_table.public[*].id, aws_route_table.private[*].id), [])\n+ value = length(aws_route_table.redshift[*].id) > 0 ? aws_route_table.redshift[*].id : (var.enable_public_redshift ? aws_route_table.public[*].id : aws_route_table.private[*].id)\n }\n \n output \"elasticache_route_table_ids\" {\n---\n\n\n---\n\nChoice B:\noutputs.tf\n@@ -250,7 +250,7 @@ output \"database_route_table_ids\" {\n \n output \"redshift_route_table_ids\" {\n description = \"List of IDs of redshift route tables\"\n- value = try(coalescelist(aws_route_table.redshift[*].id, aws_route_table.public[*].id, aws_route_table.private[*].id), [])\n+ value = length(aws_route_table.redshift[*].id) : 0 ? aws_route_table.redshift[*].id : (var.enable_public_redshift ? aws_route_table.public[*].id : aws_route_table.private[*].id)\n }\n \n output \"elasticache_route_table_ids\" {\n---\n\n\n---\n\nChoice C:\noutputs.tf\n@@ -250,7 +250,7 @@ output \"database_route_table_ids\" {\n \n output \"redshift_route_table_ids\" {\n description = \"List of IDs of redshift route tables\"\n- value = try(coalescelist(aws_route_table.redshift[*].id, aws_route_table.public[*].id, aws_route_table.private[*].id), [])\n+ of value = length(aws_route_table.redshift[*].id) > 0 ? aws_route_table.redshift[*].id : (var.enable_public_redshift ? aws_route_table.public[*].id : aws_route_table.private[*].id)\n }\n \n output \"elasticache_route_table_ids\" {\n---\n\n\n---\n\nChoice D:\noutputs.tf\n@@ -250,7 +250,7 @@ output \"database_route_table_ids\" {\n \n output \"redshift_route_table_ids\" {\n description = \"List of IDs of redshift route tables\"\n- value = try(coalescelist(aws_route_table.redshift[*].id, aws_route_table.public[*].id, aws_route_table.private[*].id), [])\n+ value = length(aws_route_table.redshift[*].id) > 0 ? aws_route_table.redshift[*].id : (var.enable_public_redshift ? aws_route_table.public[*].id : aws_route_table.private[*].id)\n }\n \n output \"elasticache_route_table_ids\" {\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nAs noted in the [terraform docs][0], subnets using the default network acl\r\nwill generate a persistent diff if they are not specified to the aws_default_network_acl\r\nresource. This module was handling subnets created by the module, but\r\nof course is not aware of subnets created externally to the module.\r\n\r\nThe docs suggest using lifecycle ignore_changes as an option to avoid\r\nthe persistent diff, which is the approach implemented in this patch.\r\n\r\nFixes #736\r\n\r\n[0]: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_network_acl#managing-subnets-in-a-default-network-acl\r\n\r\n## Breaking Changes\r\n\r\n\r\nNone\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\r\n1. cd examples/network-acls\r\n2. run terraform apply\r\n3. manually create a new subnet in the vpc\r\n4. run terraform apply\r\n5. view that no changes are planned\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/README.md\n@@ -46,7 +46,6 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n-| [aws_vpc_endpoint.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint) | data source |\n \n ## Inputs\n \n---\nexamples/complete-vpc/main.tf\n@@ -187,12 +187,6 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint\" \"dynamodb\" {\n- vpc_id = module.vpc.vpc_id\n- service_name = \"com.amazonaws.${local.region}.dynamodb\"\n-}\n-\n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -208,7 +202,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n test = \"StringNotEquals\"\n variable = \"aws:sourceVpce\"\n \n- values = [data.vpc.vpc_id]\n+ values = [module.vpc.vpc_id]\n }\n }\n---\nmain.tf\n@@ -587,28 +587,9 @@ resource \"aws_default_network_acl\" \"this\" {\n \n default_network_acl_id = aws_vpc.this[0].default_network_acl_id\n \n- # The value of subnet_ids should be any subnet IDs that are not set as subnet_ids\n- # for any of the non-default network ACLs\n- subnet_ids = setsubtract(\n- compact(flatten([\n- aws_subnet.public[*].id,\n- aws_subnet.private[*].id,\n- aws_subnet.intra[*].id,\n- aws_subnet.database[*].id,\n- aws_subnet.redshift[*].id,\n- aws_subnet.elasticache[*].id,\n- aws_subnet.outpost[*].id,\n- ])),\n- compact(flatten([\n- aws_network_acl.public[*].subnet_ids,\n- aws_network_acl.private[*].subnet_ids,\n- aws_network_acl.intra[*].subnet_ids,\n- aws_network_acl.database[*].subnet_ids,\n- aws_network_acl.redshift[*].subnet_ids,\n- aws_network_acl.elasticache[*].subnet_ids,\n- aws_network_acl.outpost[*].subnet_ids,\n- ]))\n- )\n+ # subnet_ids is using lifecycle ignore_changes, so it is not necessary to list\n+ # any explicitly. See https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/736.\n+ subnet_ids = null\n \n dynamic \"ingress\" {\n for_each = var.default_network_acl_ingress\n@@ -644,6 +625,10 @@ resource \"aws_default_network_acl\" \"this\" {\n var.tags,\n var.default_network_acl_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [subnet_ids]\n+ }\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/README.md\n@@ -46,7 +46,6 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n-| [aws_vpc_endpoint.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint) | data source |\n \n ## Inputs\n \n---\nexamples/complete-vpc/main.tf\n@@ -187,12 +187,6 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint\" \"dynamodb\" {\n- vpc_id = module.vpc.vpc_id\n- service_name = \"com.amazonaws.${local.region}.dynamodb\"\n-}\n-\n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -208,7 +202,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n test = \"StringNotEquals\"\n variable = \"aws:sourceVpce\"\n \n- values = [data.vpc.vpc_id]\n+ values = [module.vpc.vpc_id]\n }\n }\n }\n---\nmain.tf\n@@ -587,28 +587,9 @@ resource \"aws_default_network_acl\" \"this\" {\n \n default_network_acl_id = aws_vpc.this[0].default_network_acl_id\n \n- # The value of subnet_ids should be any subnet IDs that are not set as subnet_ids\n- # for any of the non-default network ACLs\n- subnet_ids = setsubtract(\n- compact(flatten([\n- aws_subnet.public[*].id,\n- aws_subnet.private[*].id,\n- aws_subnet.intra[*].id,\n- aws_subnet.database[*].id,\n- aws_subnet.redshift[*].id,\n- aws_subnet.elasticache[*].id,\n- aws_subnet.outpost[*].id,\n- ])),\n- compact(flatten([\n- aws_network_acl.public[*].subnet_ids,\n- aws_network_acl.private[*].subnet_ids,\n- aws_network_acl.intra[*].subnet_ids,\n- aws_network_acl.database[*].subnet_ids,\n- aws_network_acl.redshift[*].subnet_ids,\n- aws_network_acl.elasticache[*].subnet_ids,\n- aws_network_acl.outpost[*].subnet_ids,\n- ]))\n- )\n+ # subnet_ids is using lifecycle ignore_changes, so it is not necessary to list\n+ # any explicitly. See https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/736.\n+ {\n subnet_ids = null\n \n dynamic \"ingress\" {\n for_each = var.default_network_acl_ingress\n@@ -644,6 +625,10 @@ resource \"aws_default_network_acl\" \"this\" {\n var.tags,\n var.default_network_acl_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [subnet_ids]\n+ }\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/README.md\n@@ -46,7 +46,6 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n-| [aws_vpc_endpoint.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint) | data source |\n \n ## Inputs\n \n---\nexamples/complete-vpc/main.tf\n@@ -187,12 +187,6 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint\" \"dynamodb\" {\n- vpc_id = module.vpc.vpc_id\n- service_name = \"com.amazonaws.${local.region}.dynamodb\"\n-}\n-\n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -208,7 +202,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n test = \"StringNotEquals\"\n variable = \"aws:sourceVpce\"\n \n- values = [data.vpc.vpc_id]\n+ values = [module.vpc.vpc_id]\n }\n }\n }\n---\nmain.tf\n@@ -587,28 +587,9 @@ resource \"aws_default_network_acl\" \"this\" {\n \n default_network_acl_id = aws_vpc.this[0].default_network_acl_id\n \n- # The value of subnet_ids should be any subnet IDs that are not set as subnet_ids\n- # for any of the non-default network ACLs\n- subnet_ids = setsubtract(\n- compact(flatten([\n- aws_subnet.public[*].id,\n- aws_subnet.private[*].id,\n- aws_subnet.intra[*].id,\n- aws_subnet.database[*].id,\n- aws_subnet.redshift[*].id,\n- aws_subnet.elasticache[*].id,\n- aws_subnet.outpost[*].id,\n- ])),\n- compact(flatten([\n- aws_network_acl.public[*].subnet_ids,\n- aws_network_acl.private[*].subnet_ids,\n- aws_network_acl.intra[*].subnet_ids,\n- aws_network_acl.database[*].subnet_ids,\n- aws_network_acl.redshift[*].subnet_ids,\n- aws_network_acl.elasticache[*].subnet_ids,\n- aws_network_acl.outpost[*].subnet_ids,\n- ]))\n- )\n+ # subnet_ids is using lifecycle ignore_changes, so it is not necessary to list\n+ # any explicitly. See https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/736.\n+ subnet_ids = null\n \n dynamic \"ingress\" {\n for_each = var.default_network_acl_ingress\n@@ -644,6 +625,10 @@ resource \"aws_default_network_acl\" -587,28 {\n var.tags,\n var.default_network_acl_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [subnet_ids]\n+ }\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/README.md\n@@ -46,7 +46,6 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n-| [aws_vpc_endpoint.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint) | data source |\n \n ## Inputs\n \n---\nexamples/complete-vpc/main.tf\n@@ -187,12 +187,6 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint\" \"dynamodb\" {\n- vpc_id = module.vpc.vpc_id\n- service_name = \"com.amazonaws.${local.region}.dynamodb\"\n-}\n-\n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -208,7 +202,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n test = \"StringNotEquals\"\n variable = \"aws:sourceVpce\"\n \n- values = [data.vpc.vpc_id]\n+ values = [module.vpc.vpc_id]\n }\n }\n }\n---\nmain.tf\n@@ -587,28 +587,9 @@ resource \"aws_default_network_acl\" \"this\" {\n \n default_network_acl_id = aws_vpc.this[0].default_network_acl_id\n \n- # The value of subnet_ids should be any subnet IDs that are not set as subnet_ids\n- # for any of the non-default network ACLs\n- subnet_ids = setsubtract(\n- compact(flatten([\n- aws_subnet.public[*].id,\n- aws_subnet.private[*].id,\n- aws_subnet.intra[*].id,\n- aws_subnet.database[*].id,\n- aws_subnet.redshift[*].id,\n- aws_subnet.elasticache[*].id,\n- aws_subnet.outpost[*].id,\n- ])),\n- compact(flatten([\n- aws_network_acl.public[*].subnet_ids,\n- aws_network_acl.private[*].subnet_ids,\n- aws_network_acl.intra[*].subnet_ids,\n- aws_network_acl.database[*].subnet_ids,\n- aws_network_acl.redshift[*].subnet_ids,\n- aws_network_acl.elasticache[*].subnet_ids,\n- aws_network_acl.outpost[*].subnet_ids,\n- ]))\n- )\n+ # subnet_ids is using lifecycle ignore_changes, so it is not necessary to list\n+ # any explicitly. See https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/736.\n+ subnet_ids = null\n \n dynamic \"ingress\" {\n for_each = var.default_network_acl_ingress\n@@ -644,6 +625,10 @@ resource \"aws_default_network_acl\" \"this\" {\n var.tags,\n var.default_network_acl_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [subnet_ids]\n+ }\n }\n \n ################################################################################\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\n\n- Update `.releaserc.json` to ensure conventional-commit standards are used by semantic-releaser\n- Update `.pre-commit-config.yaml` versions to latest and ensure `end-of-file-fixer` hook is used\n- Add `pr-title.yml` GitHub workflow for ensuring PR titles follow conventional-commit standards\n- Fix `release.yml` GitHub workflow to ensure release process does not run on forks; ref https://github.com/terraform-aws-modules/meta/issues/25\n- Add `stale-actions.yaml` to ensure issues and pull requests are routinely cleaned up; copie from EKS repository\n\n## Motivation and Context\n\n- Ensure organization configurations are aligned and standardized; most of these changes are copied from the current EKS repository\n\n## Breaking Changes\n\n- No\n\n## How Has This Been Tested?\n\n- CI checks only\n\n\n---\n\nChoice A:\n.github/workflows/pr-title.yml\n@@ -0,0 +1,52 @@\n+name: 'Validate PR title'\n+\n+on:\n+ pull_request_target:\n+ types:\n+ - opened\n+ - edited\n+ - synchronize\n+\n+jobs:\n+ main:\n+ name: Validate PR title\n+ runs-on: ubuntu-latest\n+ steps:\n+ # Please look up the latest version from\n+ # https://github.com/amannn/action-semantic-pull-request/releases\n+ - uses: amannn/action-semantic-pull-request@v3.4.6\n+ env:\n+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n+ with:\n+ # Configure which types are allowed.\n+ # Default: https://github.com/commitizen/conventional-commit-types\n+ types: |\n+ fix\n+ feat\n+ docs\n+ ci\n+ chore\n+ # Configure that a scope must always be provided.\n+ requireScope: false\n+ # Configure additional validation for the subject based on a regex.\n+ # This example ensures the subject starts with an uppercase character.\n+ subjectPattern: ^[A-Z].+$\n+ # If `subjectPattern` is configured, you can use this property to override\n+ # the default error message that is shown when the pattern doesn't match.\n+ # The variables `subject` and `title` can be used within the message.\n+ subjectPatternError: |\n+ The subject \"{subject}\" found in the pull request title \"{title}\"\n+ didn't match the configured pattern. Please ensure that the subject\n+ starts with an uppercase character.\n+ # For work-in-progress PRs you can typically use draft pull requests\n+ # from Github. However, private repositories on the free plan don't have\n+ # this option and therefore this action allows you to opt-in to using the\n+ # special \"[WIP]\" prefix to indicate this state. This will avoid the\n+ # validation of the PR title and the pull request checks remain pending.\n+ # Note that a second check will be reported if this is enabled.\n+ wip: true\n+ # When using \"Squash and merge\" on a PR with only one commit, GitHub\n+ # will suggest using that commit message instead of the PR title for the\n+ # merge commit, and it's easy to commit this by mistake. Enable this option\n+ # to also validate the commit message for one commit PRs.\n+ validateSingleCommit: false\n---\n.github/workflows/release.yml\n@@ -7,13 +7,17 @@ on:\n - main\n - master\n paths:\n+ - '**/*.tpl'\n - '**/*.py'\n - '**/*.tf'\n+ - '.github/workflows/release.yml'\n \n jobs:\n release:\n name: Release\n runs-on: ubuntu-latest\n+ # Skip running release workflow on forks\n+ if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n@@ -28,5 +32,6 @@ jobs:\n extra_plugins: |\n @semantic-release/changelog@6.0.0\n @semantic-release/git@10.0.0\n+ conventional-changelog-conventionalcommits@4.6.3\n env:\n GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}\n---\n.github/workflows/stale-actions.yaml\n@@ -0,0 +1,32 @@\n+name: 'Mark or close stale issues and PRs'\n+on:\n+ schedule:\n+ - cron: '0 0 * * *'\n+\n+jobs:\n+ stale:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/stale@v4\n+ with:\n+ repo-token: ${{ secrets.GITHUB_TOKEN }}\n+ # Staling issues and PR's\n+ days-before-stale: 30\n+ stale-issue-label: stale\n+ stale-pr-label: stale\n+ stale-issue-message: |\n+ This issue has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this issue will be closed in 10 days\n+ stale-pr-message: |\n+ This PR has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this PR will be closed in 10 days\n+ # Not stale if have this labels or part of milestone\n+ exempt-issue-labels: bug,wip,on-hold\n+ exempt-pr-labels: bug,wip,on-hold\n+ exempt-all-milestones: true\n+ # Close issue operations\n+ check-merge-conflict\n+ Label will be automatically removed if the issues are no longer closed nor locked.\n+ days-before-close: 10\n+ delete-branch: true\n+ close-issue-message: This issue was automatically closed because of stale in 10 days\n+ close-pr-message: This PR was automatically closed because of stale in 10 days\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.58.0\n+ rev: v1.62.3\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,6 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.0.1\n+ rev: v4.1.0\n hooks:\n - id: check-merge-conflict\n+ - id: end-of-file-fixer\n---\n.releaserc.json\n@@ -5,13 +5,22 @@\n ],\n \"ci\": false,\n \"plugins\": [\n- \"@semantic-release/commit-analyzer\",\n- \"@semantic-release/release-notes-generator\",\n+ [\n+ \"@semantic-release/commit-analyzer\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n+ [\n+ \"@semantic-release/release-notes-generator\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n [\n \"@semantic-release/github\",\n {\n- \"successComment\":\n- \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n+ \"successComment\": \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n \"labels\": false,\n \"releasedLabels\": false\n }\n---\nexamples/manage-default-vpc/main.tf\n@@ -19,4 +19,3 @@ module \"vpc\" {\n default_vpc_name = \"default\"\n default_vpc_enable_dns_hostnames = true\n }\n-\n---\nexamples/manage-default-vpc/outputs.tf\n@@ -8,4 +8,3 @@ output \"default_vpc_cidr_block\" {\n description = \"The CIDR block of the VPC\"\n value = module.vpc.default_vpc_cidr_block\n }\n-\n---\nexamples/secondary-cidr-blocks/outputs.tf\n@@ -31,4 +31,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\nexamples/simple-vpc/outputs.tf\n@@ -32,4 +32,3 @@ output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n-\n---\nexamples/vpc-flow-logs/outputs.tf\n@@ -55,4 +55,3 @@ output \"vpc_flow_logs_s3_bucket_vpc_flow_log_destination_type\" {\n description = \"The type of the destination for VPC Flow Logs\"\n value = module.vpc_with_flow_logs_s3_bucket.vpc_flow_log_destination_type\n }\n-\n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -35,4 +35,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\n\n\n---\n\nChoice B:\n.github/workflows/pr-title.yml\n@@ -0,0 +1,52 @@\n+name: 'Validate PR title'\n+\n+on:\n+ pull_request_target:\n+ types:\n+ - opened\n+ - edited\n+ - synchronize\n+\n+jobs:\n+ main:\n+ name: Validate PR title\n+ runs-on: ubuntu-latest\n+ steps:\n+ # Please look up the latest version from\n+ # https://github.com/amannn/action-semantic-pull-request/releases\n+ - uses: amannn/action-semantic-pull-request@v3.4.6\n+ env:\n+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n+ with:\n+ # Configure which types are allowed.\n+ # Default: https://github.com/commitizen/conventional-commit-types\n+ types: |\n+ fix\n+ feat\n+ docs\n+ ci\n+ chore\n+ # Configure that a scope must always be provided.\n+ requireScope: false\n+ # Configure additional validation for the subject based on a regex.\n+ # This example ensures the subject starts with an uppercase character.\n+ subjectPattern: ^[A-Z].+$\n+ # If `subjectPattern` is configured, you can use this property to override\n+ # the default error message that is shown when the pattern doesn't match.\n+ # The variables `subject` and `title` can be used within the message.\n+ subjectPatternError: |\n+ The subject \"{subject}\" found in the pull request title \"{title}\"\n+ didn't match the configured pattern. Please ensure that the subject\n+ starts with an uppercase character.\n+ # For work-in-progress PRs you can typically use draft pull requests\n+ # from Github. However, private repositories on the free plan don't have\n+ # this option and therefore this action allows you to opt-in to using the\n+ # special \"[WIP]\" prefix to indicate this state. This will avoid the\n+ # validation of the PR title and the pull request checks remain pending.\n+ # Note that a second check will be reported if this is enabled.\n+ wip: true\n+ # When using \"Squash and merge\" on a PR with only one commit, GitHub\n+ # will suggest using that commit message instead of the PR title for the\n+ # merge commit, and it's easy to commit this by mistake. Enable this option\n+ # to also validate the commit message for one commit PRs.\n+ validateSingleCommit: false\n---\n.github/workflows/release.yml\n@@ -7,13 +7,17 @@ on:\n - main\n - master\n paths:\n+ - '**/*.tpl'\n - '**/*.py'\n - '**/*.tf'\n+ - '.github/workflows/release.yml'\n \n jobs:\n release:\n name: Release\n runs-on: ubuntu-latest\n+ # Skip running release workflow on forks\n+ if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n@@ -28,5 +32,6 @@ jobs:\n extra_plugins: |\n @semantic-release/changelog@6.0.0\n @semantic-release/git@10.0.0\n+ conventional-changelog-conventionalcommits@4.6.3\n env:\n GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}\n---\n.github/workflows/stale-actions.yaml\n@@ -0,0 +1,32 @@\n+name: 'Mark or close stale issues and PRs'\n+on:\n+ schedule:\n+ - cron: '0 0 * * *'\n+\n+jobs:\n+ stale:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/stale@v4\n+ with:\n+ repo-token: ${{ secrets.GITHUB_TOKEN }}\n+ # Staling issues and PR's\n+ days-before-stale: 30\n+ stale-issue-label: stale\n+ stale-pr-label: stale\n+ stale-issue-message: |\n+ This issue has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this issue will be closed in 10 days\n+ stale-pr-message: |\n+ This PR has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this PR will be closed in 10 days\n+ # Not stale if have this labels or part of milestone\n+ exempt-issue-labels: bug,wip,on-hold\n+ exempt-pr-labels: bug,wip,on-hold\n+ exempt-all-milestones: true\n+ # Close issue operations\n+ # Label will be automatically removed if the issues are no longer closed nor locked.\n+ days-before-close: 10\n+ delete-branch: true\n+ close-issue-message: This issue was automatically closed because of stale in 10 days\n+ close-pr-message: This PR was automatically closed because of stale in 10 days\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.58.0\n+ rev: v1.62.3\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,6 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.0.1\n+ rev: v4.1.0\n hooks:\n - id: check-merge-conflict\n+ - id: end-of-file-fixer\n---\n.releaserc.json\n@@ -5,13 +5,22 @@\n ],\n \"ci\": false,\n \"plugins\": [\n- \"@semantic-release/commit-analyzer\",\n- \"@semantic-release/release-notes-generator\",\n+ [\n+ \"@semantic-release/commit-analyzer\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n+ [\n+ \"@semantic-release/release-notes-generator\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n [\n \"@semantic-release/github\",\n {\n- \"successComment\":\n- \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n+ \"successComment\": \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n \"labels\": false,\n \"releasedLabels\": false\n }\n---\nexamples/manage-default-vpc/main.tf\n@@ -19,4 +19,3 @@ module \"vpc\" {\n default_vpc_name = \"default\"\n default_vpc_enable_dns_hostnames = true\n }\n-\n---\nexamples/manage-default-vpc/outputs.tf\n@@ -8,4 +8,3 @@ output \"default_vpc_cidr_block\" {\n description = \"The CIDR block of the VPC\"\n value = module.vpc.default_vpc_cidr_block\n }\n-\n---\nexamples/secondary-cidr-blocks/outputs.tf\n@@ -31,4 +31,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\nexamples/simple-vpc/outputs.tf\n@@ -32,4 +32,3 @@ output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n-\n---\nexamples/vpc-flow-logs/outputs.tf\n@@ -55,4 +55,3 @@ output \"vpc_flow_logs_s3_bucket_vpc_flow_log_destination_type\" {\n description = \"The type of the destination for VPC Flow Logs\"\n value = module.vpc_with_flow_logs_s3_bucket.vpc_flow_log_destination_type\n }\n-\n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -35,4 +35,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\n\n\n---\n\nChoice C:\n.github/workflows/pr-title.yml\n@@ -0,0 +1,52 @@\n+name: 'Validate PR title'\n+\n+on:\n+ pull_request_target:\n+ types:\n+ - opened\n+ - edited\n+ - synchronize\n+\n+jobs:\n+ main:\n+ name: Validate PR title\n+ runs-on: ubuntu-latest\n+ steps:\n+ # Please look up the latest version from\n+ # https://github.com/amannn/action-semantic-pull-request/releases\n+ - uses: amannn/action-semantic-pull-request@v3.4.6\n+ env:\n+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n+ with:\n+ # Configure which types are allowed.\n+ # Default: https://github.com/commitizen/conventional-commit-types\n+ types: |\n+ fix\n+ feat\n+ docs\n+ ci\n+ chore\n+ # Configure that a scope must always be provided.\n+ requireScope: false\n+ # Configure additional validation for the subject based on a regex.\n+ # This example ensures the subject starts with an uppercase character.\n+ subjectPattern: ^[A-Z].+$\n+ # If `subjectPattern` is configured, you can use this property to override\n+ # the default error message that is shown when the pattern doesn't match.\n+ # The variables `subject` and `title` can be used within the message.\n+ subjectPatternError: |\n+ The subject \"{subject}\" found in the pull request title \"{title}\"\n+ didn't match the configured pattern. Please ensure that the subject\n+ starts with an uppercase character.\n+ # For work-in-progress PRs you can typically use draft pull requests\n+ # from Github. However, private repositories on the free plan don't have\n+ # this option and therefore this action allows you to opt-in to using the\n+ # special \"[WIP]\" prefix to indicate this state. This will avoid the\n+ # validation of the PR title and the pull request checks remain pending.\n+ # Note that a second check will be reported if this is enabled.\n+ wip: true\n+ # When using \"Squash and merge\" on a PR with only one commit, GitHub\n+ # will suggest using that commit message instead of the PR title for the\n+ # merge commit, and it's easy to commit this by mistake. Enable this option\n+ # to also validate the commit message for one commit PRs.\n+ validateSingleCommit: false\n---\n.github/workflows/release.yml\n@@ -7,13 +7,17 @@ on:\n - main\n - master\n paths:\n+ - '**/*.tpl'\n - '**/*.py'\n - '**/*.tf'\n+ - '.github/workflows/release.yml'\n \n jobs:\n release:\n name: Release\n runs-on: ubuntu-latest\n+ # Skip running release workflow on forks\n+ if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n@@ -28,5 +32,6 @@ jobs:\n extra_plugins: |\n @semantic-release/changelog@6.0.0\n @semantic-release/git@10.0.0\n+ conventional-changelog-conventionalcommits@4.6.3\n env:\n GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}\n---\n.github/workflows/stale-actions.yaml\n@@ -0,0 +1,32 @@\n+name: 'Mark or close stale issues and PRs'\n+on:\n+ schedule:\n+ - cron: '0 0 * * *'\n+\n+jobs:\n+ stale:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/stale@v4\n+ with:\n+ repo-token: ${{ secrets.GITHUB_TOKEN }}\n+ # Staling issues and PR's\n+ days-before-stale: 30\n+ stale-issue-label: stale\n+ stale-pr-label: stale\n+ stale-issue-message: |\n+ This issue has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this issue will be closed in 10 days\n+ stale-pr-message: |\n+ This PR has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this PR will be closed in 10 days\n+ # Not stale if have this labels or part of milestone\n+ exempt-issue-labels: bug,wip,on-hold\n+ exempt-pr-labels: bug,wip,on-hold\n+ exempt-all-milestones: true\n+ # Close issue operations\n+ # Label will be automatically removed if the issues are no longer closed nor locked.\n+ days-before-close: 10\n+ delete-branch: true\n+ close-issue-message: This issue was automatically closed because of stale in 10 days\n+ close-pr-message: This PR was automatically closed because of stale in 10 days\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.58.0\n+ rev: v1.62.3\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,6 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.0.1\n+ rev: v4.1.0\n hooks:\n - id: check-merge-conflict\n+ - id: end-of-file-fixer\n---\n.releaserc.json\n@@ -5,13 +5,22 @@\n ],\n \"ci\": false,\n \"plugins\": [\n- \"@semantic-release/commit-analyzer\",\n- \"@semantic-release/release-notes-generator\",\n+ [\n+ \"@semantic-release/commit-analyzer\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n+ [\n+ \"@semantic-release/release-notes-generator\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n [\n \"@semantic-release/github\",\n {\n- \"successComment\":\n- \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n+ \"successComment\": \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n \"labels\": false,\n \"releasedLabels\": false\n }\n---\nexamples/manage-default-vpc/main.tf\n@@ -19,4 +19,3 @@ module \"vpc\" {\n default_vpc_name = \"default\"\n default_vpc_enable_dns_hostnames = true\n }\n-\n---\nexamples/manage-default-vpc/outputs.tf\n@@ -8,4 +8,3 @@ output \"default_vpc_cidr_block\" {\n description = \"The CIDR block of the VPC\"\n value = module.vpc.default_vpc_cidr_block\n }\n-\n---\nexamples/secondary-cidr-blocks/outputs.tf\n@@ -31,4 +31,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\nexamples/simple-vpc/outputs.tf\n@@ -32,4 +32,3 @@ output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n-\n---\nexamples/vpc-flow-logs/outputs.tf\n@@ -55,4 +55,3 @@ output \"vpc_flow_logs_s3_bucket_vpc_flow_log_destination_type\" {\n description = \"The type of the destination for VPC Flow Logs\"\n value = module.vpc_with_flow_logs_s3_bucket.vpc_flow_log_destination_type\n }\n-\n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -35,4 +35,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\n\n\n---\n\nChoice D:\n.github/workflows/pr-title.yml\n@@ -0,0 +1,52 @@\n+name: 'Validate PR title'\n+\n+on:\n+ pull_request_target:\n+ types:\n+ - opened\n+ - edited\n+ - synchronize\n+\n+jobs:\n+ main:\n+ name: Validate PR title\n+ runs-on: ubuntu-latest\n+ steps:\n+ # Please look up the latest version from\n+ # https://github.com/amannn/action-semantic-pull-request/releases\n+ - uses: amannn/action-semantic-pull-request@v3.4.6\n+ env:\n+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n+ with:\n+ # Configure which types are allowed.\n+ # Default: https://github.com/commitizen/conventional-commit-types\n+ types: |\n+ fix\n+ feat\n+ docs\n+ ci\n+ chore\n+ # Configure that a scope must always be provided.\n+ requireScope: false\n+ # Configure additional validation for the subject based on a regex.\n+ # This example ensures the subject starts with an uppercase character.\n+ subjectPattern: ^[A-Z].+$\n+ # If `subjectPattern` is configured, you can use this property to override\n+ # the default error message that is shown when the pattern doesn't match.\n+ # The variables `subject` and `title` can be used within the message.\n+ subjectPatternError: |\n+ The subject \"{subject}\" found in the pull request title \"{title}\"\n+ didn't match the configured pattern. Please ensure that the subject\n+ starts with an uppercase character.\n+ # For work-in-progress PRs you can typically use draft pull requests\n+ # from Github. However, private repositories on the free plan don't have\n+ # this option and therefore this action allows you to opt-in to using the\n+ # special \"[WIP]\" prefix to indicate this state. This will avoid the\n+ # validation of the PR title and the pull request checks remain pending.\n+ # Note that a second check will be reported if this is enabled.\n+ wip: true\n+ # When using \"Squash and merge\" on a PR with only one commit, GitHub\n+ # will suggest using that commit message instead of the PR title for the\n+ # merge commit, and it's easy to commit this by mistake. Enable this option\n+ # to also validate the commit message for one commit PRs.\n+ validateSingleCommit: false\n---\n.github/workflows/release.yml\n@@ -7,13 +7,17 @@ on:\n - main\n - master\n paths:\n+ - '**/*.tpl'\n - '**/*.py'\n - '**/*.tf'\n+ - '.github/workflows/release.yml'\n \n jobs:\n release:\n name: Release\n runs-on: ubuntu-latest\n+ # Skip running release workflow on forks\n+ if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n@@ -28,5 +32,6 @@ jobs:\n extra_plugins: |\n @semantic-release/changelog@6.0.0\n @semantic-release/git@10.0.0\n+ conventional-changelog-conventionalcommits@4.6.3\n env:\n GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}\n---\n.github/workflows/stale-actions.yaml\n@@ -0,0 +1,32 @@\n+name: 'Mark or close stale issues and PRs'\n+on:\n+ schedule:\n+ - cron: '0 0 * * *'\n+\n+jobs:\n+ stale:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/stale@v4\n+ with:\n+ repo-token: ${{ secrets.GITHUB_TOKEN }}\n+ # Staling issues and PR's\n+ days-before-stale: 30\n+ stale-issue-label: stale\n+ stale-pr-label: stale\n+ stale-issue-message: |\n+ This issue has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this issue will be closed in 10 days\n+ stale-pr-message: |\n+ This PR has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this PR will be closed in 10 days\n+ # Not stale if have this labels or part of milestone\n+ exempt-issue-labels: bug,wip,on-hold\n+ exempt-pr-labels: bug,wip,on-hold\n+ exempt-all-milestones: true\n+ # Close issue operations\n+ # Label will be automatically removed if the issues are no longer closed nor locked.\n+ days-before-close: 10\n+ delete-branch: true\n+ close-issue-message: This issue was automatically closed because of stale in 10 days\n+ close-pr-message: This PR was automatically closed because of stale in 10 days\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.58.0\n+ rev: v1.62.3\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,6 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.0.1\n+ rev: v4.1.0\n hooks:\n - id: check-merge-conflict\n+ - id: end-of-file-fixer\n---\n.releaserc.json\n@@ -5,13 +5,22 @@\n ],\n \"ci\": false,\n \"plugins\": [\n- \"@semantic-release/commit-analyzer\",\n- \"@semantic-release/release-notes-generator\",\n+ [\n+ \"@semantic-release/commit-analyzer\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n+ [\n+ \"@semantic-release/release-notes-generator\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n [\n \"@semantic-release/github\",\n {\n- \"successComment\":\n- \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n+ \"successComment\": \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n \"labels\": false,\n \"releasedLabels\": false\n }\n---\nexamples/manage-default-vpc/main.tf\n@@ -19,4 +19,3 @@ module \"vpc\" {\n default_vpc_name = \"default\"\n default_vpc_enable_dns_hostnames = true\n }\n-\n---\nexamples/manage-default-vpc/outputs.tf\n@@ -8,4 +8,3 @@ output \"default_vpc_cidr_block\" {\n description = \"The CIDR block of the VPC\"\n value = module.vpc.default_vpc_cidr_block\n }\n-\n---\nexamples/secondary-cidr-blocks/outputs.tf\n@@ -31,4 +31,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\nexamples/simple-vpc/outputs.tf\n@@ -32,4 +32,3 @@ output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n-\n---\nexamples/vpc-flow-logs/outputs.tf\n@@ -55,4 +55,3 @@ output \"vpc_flow_logs_s3_bucket_vpc_flow_log_destination_type\" {\n description = \"The type of the destination for VPC Flow Logs\"\n value = module.vpc_with_flow_logs_s3_bucket.vpc_flow_log_destination_type\n }\n-\n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -35,4 +35,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nthis is new moudle\r\n\r\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nnewmodule\n@@ -0,0 +1 @@\n+this is module\n---\n module\n---\n\n\n---\n\nChoice B:\nnewmodule\n@@ -0,0 +1 @@\n+this is new module\n---\n\n\n---\n\nChoice C:\nnewmodule\n@@ -0,0 +1 is is new module\n---\n\n\n---\n\nChoice D:\nnewmodule\n@@ -0,0 +1 @@\n+this newmodule\n@@ new module\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nnewmoudle\n@@ -0,0 +1,2 @@\n+adding @@\n+adding module\n+\n---\n\n\n---\n\nChoice B:\nnewmoudle\n@@ -0,0 +1,2 @@\n+adding new module\n+\n---\n\n\n---\n\nChoice C:\n-0,0 -0,0 +1,2 @@\n+adding new module\n+\n---\n\n\n---\n\nChoice D:\nnewmoudle\n@@ -0,0 newmoudle\n@@ @@\n+adding new module\n+\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThis PR adds a minimal but complete example for an S3 Gateway VPC Endpoint. I would've loved to add a more complex example (ECR + S3), but the example was getting overwhelming.\r\n\r\n## Motivation and Context\r\nThis PR is motivated by 2 reasons:\r\n- the previous S3 example did not create a (free) Gateway Endpoint, which led to an embarrassing NAT Gateway bill for me\r\n- it took me longer than I would've liked to figure out how to use the resulting VPC Endpoints\r\n\r\n## Breaking Changes\r\nN/A\r\n\r\n## How Has This Been Tested?\r\nI ran a `terraform fmt` and `terraform validate` on the `examples/complete-vpc` code. The VPC Endpoint definition was copied from a private project where everything seems to be working fine.\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/README.md\n@@ -44,6 +44,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n |------|------|\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_iam_policy_document.s3_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n---\nexamples/complete-vpc/main.tf\n@@ -87,9 +87,22 @@ module \"vpc_endpoints\" {\n security_group_ids = [data.aws_security_group.default.id]\n \n endpoints = {\n+ # S3 Interface Endpoint\n+ # s3 = {\n+ # service = \"s3\"\n+ # tags = { Name = \"s3-vpc-endpoint\" }\n+ # },\n+ # S3 Gateway Endpoint, which is free\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([\n+ module.vpc.default_route_table_id,\n+ module.vpc.private_route_table_ids,\n+ module.vpc.public_route_table_ids,\n+ ])\n+ policy = data.aws_iam_policy_document.s3_endpoint_policy.json\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n@@ -232,3 +245,31 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n }\n }\n }\n+\n+# Example VPC Endpoint Policy for the S3 VPC Endpoint that only allows 1 action on 1 bucket.\n+# The S3 bucket policy can then be modified to only allow requests coming from the VPC Endpoint:\n+# condition {\n+# test = \"StringEquals\"\n+# variable = \"aws:sourceVpce\"\n+# values = [\n+# module.vpc_endpoints.endpoints[\"s3\"].id,\n+# ]\n+# }\n+data \"aws_iam_policy_document\" \"s3_endpoint_policy\" {\n+ statement {\n+ effect = \"Allow\"\n+\n+ actions = [\n+ \"s3:GetObject\",\n+ ]\n+\n+ resources = [\n+ \"arn:aws:s3:::example-bucket/*\",\n+ ]\n+\n+ principals {\n+ type = \"*\"\n+ identifiers = [\"*\"]\n+ }\n+ }\n+}\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/README.md\n@@ -44,6 +44,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n |------|------|\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_iam_policy_document.s3_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n---\nexamples/complete-vpc/main.tf\n@@ -87,9 +87,22 @@ module \"vpc_endpoints\" {\n security_group_ids = [data.aws_security_group.default.id]\n \n endpoints = {\n+ # S3 Interface Endpoint\n+ # s3 = {\n+ # service = \"s3\"\n+ # tags = { Name = \"s3-vpc-endpoint\" }\n+ # },\n+ # S3 Gateway Endpoint, which is free\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([\n+ module.vpc.default_route_table_id,\n+ module.vpc.private_route_table_ids,\n+ module.vpc.public_route_table_ids,\n+ ])\n+ policy = data.aws_iam_policy_document.s3_endpoint_policy.json\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n@@ -232,3 +245,31 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n }\n }\n }\n+\n+# Example VPC Endpoint Policy for the S3 VPC Endpoint that only allows 1 action on 1 bucket.\n+# The S3 bucket policy can then be modified to only allow requests coming from the VPC Endpoint:\n+# condition {\n+# test = \"StringEquals\"\n+# variable = \"aws:sourceVpce\"\n+# values = [\n+# module.vpc_endpoints.endpoints[\"s3\"].id,\n+# ]\n+# }\n+data \"aws_iam_policy_document\" \"s3_endpoint_policy\" {\n+ statement {\n+ effect = \"Allow\"\n+\n+ actions = [\n+ allows \"s3:GetObject\",\n+ ]\n+\n+ resources = [\n+ \"arn:aws:s3:::example-bucket/*\",\n+ ]\n+\n+ principals {\n+ type = \"*\"\n+ identifiers = [\"*\"]\n+ }\n+ }\n+}\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/README.md\n@@ -44,6 +44,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n |------|------|\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_iam_policy_document.s3_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n---\nexamples/complete-vpc/main.tf\n@@ -87,9 +87,22 @@ module \"vpc_endpoints\" {\n security_group_ids = [data.aws_security_group.default.id]\n \n endpoints = {\n+ # S3 Interface Endpoint\n+ # s3 = {\n+ # service = \"s3\"\n+ # tags = { Name = \"s3-vpc-endpoint\" }\n+ # },\n+ # S3 Gateway Endpoint, which is free\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([\n+ module.vpc.default_route_table_id,\n+ module.vpc.private_route_table_ids,\n+ module.vpc.public_route_table_ids,\n+ ])\n+ policy = data.aws_iam_policy_document.s3_endpoint_policy.json\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n@@ -232,3 +245,31 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n }\n }\n }\n+\n+# Example VPC Endpoint Policy for the S3 VPC Endpoint that only allows 1 action on 1 bucket.\n+# The S3 bucket policy can then be modified to only [\n+# requests coming from the VPC Endpoint:\n+# condition {\n+# test = \"StringEquals\"\n+# variable = \"aws:sourceVpce\"\n+# values = [\n+# module.vpc_endpoints.endpoints[\"s3\"].id,\n+# ]\n+# }\n+data \"aws_iam_policy_document\" \"s3_endpoint_policy\" {\n+ statement {\n+ effect = \"Allow\"\n+\n+ actions = [\n+ \"s3:GetObject\",\n+ ]\n+\n+ resources = [\n+ \"arn:aws:s3:::example-bucket/*\",\n+ ]\n+\n+ principals {\n+ type = \"*\"\n+ identifiers = [\"*\"]\n+ }\n+ }\n+}\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/README.md\n@@ -44,6 +44,7 @@ Note that this example may create resources which can cost (AWS Elastic IP\n |------|------|\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_iam_policy_document.s3_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n---\nexamples/complete-vpc/main.tf\n@@ -87,9 +87,22 @@ module \"vpc_endpoints\" {\n security_group_ids = [data.aws_security_group.default.id]\n \n endpoints = {\n+ # S3 Interface Endpoint\n+ # s3 = {\n+ # service = \"s3\"\n+ # tags = { Name = \"s3-vpc-endpoint\" }\n+ # },\n+ # S3 Gateway Endpoint, which is free\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([\n+ module.vpc.default_route_table_id,\n+ module.vpc.private_route_table_ids,\n+ module.vpc.public_route_table_ids,\n+ ])\n+ policy = data.aws_iam_policy_document.s3_endpoint_policy.json\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n@@ -232,3 +245,31 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n }\n }\n }\n+\n+# Example VPC Endpoint Policy for the S3 VPC Endpoint that only allows 1 action on 1 bucket.\n+# The S3 bucket policy can then be modified to only allow requests coming from the VPC Endpoint:\n+# condition {\n+# test = \"StringEquals\"\n+# variable = \"aws:sourceVpce\"\n+# values = [\n+# module.vpc_endpoints.endpoints[\"s3\"].id,\n+# ]\n+# }\n+data \"aws_iam_policy_document\" \"s3_endpoint_policy\" {\n+ statement {\n+ effect = \"Allow\"\n+\n+ actions = [\n+ \"s3:GetObject\",\n+ ]\n+\n+ resources = [\n+ \"arn:aws:s3:::example-bucket/*\",\n+ ]\n+\n+ principals {\n+ type = \"*\"\n+ identifiers = [\"*\"]\n+ }\n+ }\n+}\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\nRather than adding an internet gateway and route table to the private database subnets, this will create a public subnet database group. This way, private databases can still be created in the database subnet. If there's a need for a public database, it can be created in the public DB subnet group, which will put in the public subnets.\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\nAllows the databse subnet to still be kept private without public ingress, while also allowing the creation of public databases if the need arises.\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\nNo breaking changes, instead a couple new variables are added to create a new resource: `aws_db_subnet_group.database_public[0]` if `create_database_public_subnet_group` is set to `true`.\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\r\nTested with `examples/complete-vpc` by added `create_database_public_subnet_group = true` to the module. As expected, the additional resource was created.\r\n\r\nTruncated output from `terraform plan` when `create_database_public_subnet_group = true`:\r\n```hcl\r\n # aws_db_subnet_group.database_public[0] will be created\r\n + resource \"aws_db_subnet_group\" \"database_public\" {\r\n + arn = (known after apply)\r\n + description = \"Database public subnet group for test-vpc\"\r\n + id = (known after apply)\r\n + name = \"test-vpc-public\"\r\n + name_prefix = (known after apply)\r\n + subnet_ids = [\r\n + \"subnet-publicsubnet-1\",\r\n + \"subnet-publicsubnet-2\",\r\n + \"subnet-publicsubnet-3\",\r\n ]\r\n + tags = {\r\n + \"Name\" = \"test-vpc-public\"\r\n + \"Service\" = \"test VPC\"\r\n }\r\n + tags_all = {\r\n + \"Name\" = \"test-vpc-public\"\r\n + \"Role\" = \"Dev\"\r\n + \"Service\" = \"test VPC\"\r\n }\r\n }\r\n```\r\n\r\nI have also tested with an existing VPC where a db public subnet group exists. I was able to import that subnet group into the state file and run Terraform against that resource.\n\n---\n\nChoice A:\nREADME.md\n@@ -159,6 +159,15 @@ Sometimes it is handy to have public access to RDS instances (it is not recommen\n enable_dns_support = true\n ```\n \n+Alternatively, rather than creating an internet gateway to the entire database subnets, the following can be set:\n+\n+```hcl\n+create_database_public_subnet_group = true\n+```\n+\n+Setting this value to `true` will create a database subnet group within the public subnets. Any database created in this subnet group will have public access (in most cases, this is not recommended).\n+\n+\n ## Network Access Control Lists (ACL or NACL)\n \n This module can manage network ACL and rules. Once VPC is created, AWS creates the default network ACL, which can be controlled using this module (`manage_default_network_acl = true`).\n---\nmain.tf\n@@ -499,6 +499,22 @@ resource \"aws_db_subnet_group\" \"database\" {\n )\n }\n \n+resource \"aws_db_subnet_group\" \"database_public\" {\n+ count = var.create_vpc && length(var.public_subnets) > 0 && var.create_database_public_subnet_group ? 1 : 0\n+\n+ name = lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\"))\n+ description = \"Database public subnet group for ${var.name}\"\n+ subnet_ids = aws_subnet.public.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\")))\n+ },\n+ var.tags,\n+ var.database_public_subnet_group_tags,\n+ )\n+}\n+\n ################################################################################\n # Redshift subnet\n ################################################################################\n---\nvariables.tf\n@@ -238,6 +238,12 @@ variable \"create_database_subnet_group\" {\n default = true\n }\n \n+variable \"create_database_public_subnet_group\" {\n+ description = \"Controls if database public subnet group should be created (n.b. public_subnets must also be set). This will allow databases to be created for public access.\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_elasticache_subnet_group\" {\n description = \"Controls if elasticache subnet group should be created\"\n type = bool\n@@ -484,6 +490,12 @@ variable \"database_subnet_group_name\" {\n default = null\n }\n \n+variable \"database_public_subnet_group_name\" {\n+ description = \"Name of database public subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n@@ -496,6 +508,12 @@ variable \"database_subnet_group_tags\" {\n default = {}\n }\n \n+variable \"database_public_subnet_group_tags\" {\n+ description = \"Additional tags for the database public subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"redshift_subnet_tags\" {\n description = \"Additional tags for the redshift subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -159,6 +159,15 @@ Sometimes it is handy to have public access to RDS instances (it is not recommen\n enable_dns_support = true\n ```\n \n+Alternatively, rather than creating an internet gateway to the entire database subnets, the following can be set:\n+\n+```hcl\n+create_database_public_subnet_group = true\n+```\n+\n+Setting this value to `true` will create a database subnet group within the public subnets. Any database created in this subnet group will have public access (in most cases, this is not recommended).\n+\n+\n ## Network Access Control Lists (ACL or NACL)\n \n This module can manage network ACL and rules. Once = is created, AWS creates the default network ACL, which can be controlled using this module (`manage_default_network_acl = true`).\n---\nmain.tf\n@@ -499,6 +499,22 @@ resource \"aws_db_subnet_group\" \"database\" {\n )\n }\n \n+resource \"aws_db_subnet_group\" \"database_public\" {\n+ count = var.create_vpc && length(var.public_subnets) > 0 && var.create_database_public_subnet_group ? 1 : 0\n+\n+ name = lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\"))\n+ description = \"Database public subnet group for ${var.name}\"\n+ subnet_ids = aws_subnet.public.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\")))\n+ },\n+ var.tags,\n+ var.database_public_subnet_group_tags,\n+ )\n+}\n+\n ################################################################################\n # Redshift subnet\n ################################################################################\n---\nvariables.tf\n@@ -238,6 +238,12 @@ variable \"create_database_subnet_group\" {\n default = true\n }\n \n+variable \"create_database_public_subnet_group\" {\n+ description = \"Controls if database public subnet group should be created (n.b. public_subnets must also be set). This will allow databases to be created for public access.\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_elasticache_subnet_group\" {\n description = \"Controls if elasticache subnet group should be created\"\n type = bool\n@@ -484,6 +490,12 @@ variable \"database_subnet_group_name\" {\n default = null\n }\n \n+variable \"database_public_subnet_group_name\" {\n+ description = \"Name of database public subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n@@ -496,6 +508,12 @@ variable \"database_subnet_group_tags\" {\n default = {}\n }\n \n+variable \"database_public_subnet_group_tags\" {\n+ description = \"Additional tags for the database public subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"redshift_subnet_tags\" {\n description = \"Additional tags for the redshift subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -159,6 +159,15 @@ Sometimes it is handy to have public access to RDS instances (it is not recommen\n enable_dns_support = true\n ```\n \n+Alternatively, rather than creating an internet gateway to the entire database subnets, the following can be set:\n+\n+```hcl\n+create_database_public_subnet_group = true\n+```\n+\n+Setting this value to `true` will create a database subnet group within the public subnets. Any database created in this subnet group will have public access (in most cases, this is not recommended).\n+\n+\n ## Network Access Control Lists (ACL or NACL)\n \n This module can manage network ACL and rules. Once VPC is created, AWS creates the default network ACL, which can be controlled using this module (`manage_default_network_acl = true`).\n---\nmain.tf\n@@ -499,6 +499,22 @@ resource \"aws_db_subnet_group\" \"database\" {\n )\n }\n \n+resource \"aws_db_subnet_group\" \"database_public\" {\n+ count = var.create_vpc && length(var.public_subnets) > 0 && var.create_database_public_subnet_group ? 1 : 0\n+\n+ name = lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\"))\n+ description = \"Database public subnet group for ${var.name}\"\n+ subnet_ids = aws_subnet.public.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\")))\n+ },\n+ var.tags,\n+ var.database_public_subnet_group_tags,\n+ )\n+}\n+\n ################################################################################\n # Redshift subnet\n ################################################################################\n---\nvariables.tf\n@@ -238,6 +238,12 @@ variable \"create_database_subnet_group\" {\n default = true\n }\n \n+variable \"create_database_public_subnet_group\" {\n+ description = \"Controls if database public subnet group should be created (n.b. public_subnets must also be set). This will allow databases to be created for public access.\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_elasticache_subnet_group\" {\n description = \"Controls if elasticache subnet group should be created\"\n type = bool\n@@ -484,6 +490,12 @@ variable \"database_subnet_group_name\" {\n default = null\n }\n \n+variable \"database_public_subnet_group_name\" {\n+ description = \"Name of {\n public subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n@@ -496,6 +508,12 @@ variable \"database_subnet_group_tags\" {\n default = {}\n }\n \n+variable \"database_public_subnet_group_tags\" {\n+ description = \"Additional tags for the database public subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"redshift_subnet_tags\" {\n description = \"Additional tags for the redshift subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -159,6 +159,15 @@ Sometimes it is handy to have public access to RDS instances (it is not recommen\n enable_dns_support = true\n ```\n \n+Alternatively, rather than creating an internet gateway to the entire database subnets, the following can be set:\n+\n+```hcl\n+create_database_public_subnet_group = true\n+```\n+\n+Setting this value to `true` will create a database subnet group within the public subnets. Any database created in this subnet group will have public access (in most cases, this is not recommended).\n+\n+\n ## Network Access Control Lists (ACL or NACL)\n \n This module can manage network ACL and rules. Once VPC is created, AWS creates the default network ACL, which can be controlled using this module (`manage_default_network_acl = true`).\n---\nmain.tf\n@@ -499,6 +499,22 @@ resource \"aws_db_subnet_group\" \"database\" {\n )\n }\n \n+resource \"aws_db_subnet_group\" \"database_public\" {\n+ count = var.create_vpc && length(var.public_subnets) > 0 && var.create_database_public_subnet_group ? 1 : 0\n+\n+ name = lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\"))\n+ description = \"Database public subnet group for ${var.name}\"\n+ subnet_ids = aws_subnet.public.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\")))\n+ },\n+ var.tags,\n+ var.database_public_subnet_group_tags,\n+ )\n+}\n+\n ################################################################################\n # Redshift subnet\n ################################################################################\n---\nvariables.tf\n@@ -238,6 +238,12 @@ variable \"create_database_subnet_group\" {\n default = true\n }\n \n+variable \"create_database_public_subnet_group\" {\n+ description = \"Controls if database public subnet group should be created (n.b. public_subnets must also be set). This will allow databases to be created for public access.\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_elasticache_subnet_group\" {\n description = \"Controls if elasticache subnet group should be created\"\n type = bool\n@@ -484,6 +490,12 @@ variable \"database_subnet_group_name\" {\n default = null\n }\n \n+variable \"database_public_subnet_group_name\" {\n+ description = \"Name of database public subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n@@ -496,6 +508,12 @@ variable \"database_subnet_group_tags\" {\n default = {}\n }\n \n+variable \"database_public_subnet_group_tags\" {\n+ description = \"Additional tags for the database public subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n manage \"redshift_subnet_tags\" {\n description = \"Additional tags for the redshift subnets\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nAdding the user provided tags to the IAM policy created by this terraform module\r\n\r\n## Motivation and Context\r\n In order to enforce tagging requirements through Terraform Sentinel, all resources must be tagged.\r\n\r\n## Breaking Changes\r\n No\r\n\r\n\r\n## How Has This Been Tested?\r\n- [-] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\n\n---\n\nChoice A:\nvpc-flow-logs.tf\n@@ -90,6 +90,7 @@ resource \"aws_iam_policy\" \"vpc_flow_log_cloudwatch\" {\n \n name_prefix = \"vpc-flow-log-to-cloudwatch-\"\n policy = data.aws_iam_policy_document.vpc_flow_log_cloudwatch[0].json\n+ tags = merge(var.tags, }\n \n data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n---\n\n\n---\n\nChoice B:\nvpc-flow-logs.tf\n@@ -90,6 +90,7 @@ resource \"aws_iam_policy\" \"vpc_flow_log_cloudwatch\" {\n \n name_prefix = \"vpc-flow-log-to-cloudwatch-\"\n data.aws_iam_policy_document.vpc_flow_log_cloudwatch[0].json\n+ policy = data.aws_iam_policy_document.vpc_flow_log_cloudwatch[0].json\n+ tags = merge(var.tags, var.vpc_flow_log_tags)\n }\n \n data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n---\n\n\n---\n\nChoice C:\nvpc-flow-logs.tf\n@@ -90,6 +90,7 @@ resource \"aws_iam_policy\" \"vpc_flow_log_cloudwatch\" {\n \n name_prefix = \"vpc-flow-log-to-cloudwatch-\"\n policy = data.aws_iam_policy_document.vpc_flow_log_cloudwatch[0].json\n+ tags = merge(var.tags, var.vpc_flow_log_tags)\n }\n \n data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n---\n\n\n---\n\nChoice D:\nvpc-flow-logs.tf\n@@ -90,6 }\n @@ resource \"aws_iam_policy\" \"vpc_flow_log_cloudwatch\" {\n \n name_prefix = \"vpc-flow-log-to-cloudwatch-\"\n policy = data.aws_iam_policy_document.vpc_flow_log_cloudwatch[0].json\n+ tags = merge(var.tags, var.vpc_flow_log_tags)\n }\n \n data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nEnclosed `destination_options` block in `aws_flow_log` resource inside\r\n\"conditional\" dynamic block since it is needed only for `s3` destination type\r\n\r\n## Motivation and Context\r\n`destination_options` block is unnecessary for `cloud-watch-logs` destination type. I received `InvalidParameter` error while running it with `cloud-watch-logs` type. Full description of the issue is included in #702 \r\n\r\n- Closes #702 \r\n\r\n## Breaking Changes\r\nNo\r\n\r\n## How Has This Been Tested?\r\nTested on the project, where we use VPC module. Also tried to create a log in `s3` as well.\r\n\n\n---\n\nChoice A:\nvpc-flow-logs.tf\n@@ -24,10 +24,14 @@ resource \"aws_flow_log\" \"this\" {\n vpc_id = local.vpc_id\n max_aggregation_interval = var.flow_log_max_aggregation_interval\n \n- destination_options {\n- file_format = var.flow_log_file_format\n- hive_compatible_partitions = var.flow_log_hive_compatible_partitions\n- ? per_hour_partition = var.flow_log_per_hour_partition\n+ dynamic \"destination_options\" {\n+ for_each = var.flow_log_destination_type == \"s3\" ? [true] : []\n+\n+ content {\n+ file_format = var.flow_log_file_format\n+ hive_compatible_partitions = var.flow_log_hive_compatible_partitions\n+ per_hour_partition = var.flow_log_per_hour_partition\n+ }\n }\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n---\n\n\n---\n\nChoice B:\nvpc-flow-logs.tf\n@@ -24,10 +24,14 @@ resource \"aws_flow_log\" \"this\" {\n vpc_id = local.vpc_id\n max_aggregation_interval = var.flow_log_max_aggregation_interval\n \n- destination_options {\n- file_format = var.flow_log_file_format\n- hive_compatible_partitions = var.flow_log_hive_compatible_partitions\n- per_hour_partition = var.flow_log_per_hour_partition\n+ dynamic \"destination_options\" {\n+ for_each = var.flow_log_destination_type == \"s3\" ? [true] : []\n+\n+ content {\n+ file_format = var.flow_log_file_format\n+ hive_compatible_partitions = var.flow_log_hive_compatible_partitions\n+ per_hour_partition = var.flow_log_per_hour_partition\n+ }\n }\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n---\n\n\n---\n\nChoice C:\nvpc-flow-logs.tf\n@@ -24,10 +24,14 @@ resource \"aws_flow_log\" \"this\" {\n vpc_id = local.vpc_id\n max_aggregation_interval = var.flow_log_max_aggregation_interval\n \n- destination_options {\n- file_format = var.flow_log_file_format\n- hive_compatible_partitions = var.flow_log_hive_compatible_partitions\n- per_hour_partition = var.flow_log_per_hour_partition\n+ dynamic \"destination_options\" {\n+ for_each = var.flow_log_destination_type == \"s3\" ? [true] : []\n+\n+ content {\n+ file_format = var.flow_log_file_format\n+ hive_compatible_partitions = var.flow_log_hive_compatible_partitions\n+ per_hour_partition = var.flow_log_per_hour_partition\n+ }\n }\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n---\n\n\n---\n\nChoice D:\nvpc-flow-logs.tf\n@@ -24,10 +24,14 @@ resource \"aws_flow_log\" \"this\" {\n vpc_id = local.vpc_id\n max_aggregation_interval = var.flow_log_max_aggregation_interval\n \n- destination_options {\n- file_format = var.flow_log_file_format\n- hive_compatible_partitions = var.flow_log_hive_compatible_partitions\n- per_hour_partition = var.flow_log_per_hour_partition\n+ dynamic \"destination_options\" {\n+ for_each = var.flow_log_destination_type == \"s3\" ? [true] : []\n+\n+ content {\n+ file_format = var.flow_log_file_format\n+ hive_compatible_partitions var.flow_log_hive_compatible_partitions\n+ per_hour_partition = var.flow_log_per_hour_partition\n+ }\n }\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdded timeout block to the `aws_default_route_table` vpc resource .\r\n\r\n## Motivation and Context\r\nUpdates the TF VPC module with the latest aws provider release enhancements.\r\n[3.62.0](https://github.com/hashicorp/terraform-provider-aws/blob/main/CHANGELOG.md#3620-october-08-2021)\r\n\r\n> resource/aws_default_route_table: Add custom timeouts block (#21161)\r\n\r\n## Breaking Changes\r\nNo\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n*Testing*\r\n\r\nTested the example/complete_vpc terraform template.\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -184,6 +184,11 @@ resource \"aws_default_route_table\" \"default\" {\n }\n }\n \n+ timeouts {\n+ create = \"5m\"\n+ update = \"5m\"\n+ }\n+\n tags = merge(\n { \"Name\" = var.name },\n var.tags,\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -184,6 +184,11 @@ resource \"aws_default_route_table\" \"default\" {\n }\n }\n \n+ timeouts {\n+ create = \"5m\"\n+ update = \"5m\"\n+ }\n+\n tags = merge(\n { {\n+ = var.name },\n var.tags,\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -184,6 +184,11 @@ resource \"aws_default_route_table\" \"default\" {\n }\n }\n \n+ timeouts {\n+ create = \"5m\"\n+ update = \"5m\"\n+ }\n+\n tags = merge(\n { \"Name\" = var.name },\n = var.tags,\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -184,6 +184,11 @@ resource \"aws_default_route_table\" \"default\" {\n }\n }\n \n+ timeouts {\n+ create = \"5m\"\n+ update = \"5m\"\n+ }\n+\n tags = merge(\n { \"Name\" = var.name },\n var.tags,\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\n143\n@@ -0,0 +1 @@\n+\n---\n\n\n---\n\nChoice B:\n143\n@@ 143\n@@ +1 @@\n+\n---\n\n\n---\n\nChoice C:\n143\n@@ -0,0 @@\n+\n---\n @@\n+\n---\n\n\n---\n\nChoice D:\n143\n@@ -0,0 143\n@@ @@\n+\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nJust corrected a small typo in AZs\r\n\r\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nexamples/simple-vpc/outputs.tf\n@@ -29,7 +29,7 @@ output \"nat_public_ips\" {\n \n # AZs\n output \"azs\" {\n- description = \"A list of availability zones spefified as argument \n this module\"\n+ description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n \n---\n\n\n---\n\nChoice B:\nexamples/simple-vpc/outputs.tf\n@@ -29,7 +29,7 @@ output \"nat_public_ips\" {\n \n # AZs\n output \"azs\" {\n- description = \"A list of availability zones \"nat_public_ips\" as argument to this module\"\n+ description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n \n---\n\n\n---\n\nChoice C:\nexamples/simple-vpc/outputs.tf\n@@ -29,7 +29,7 @@ output \"nat_public_ips\" {\n \n # AZs\n output \"azs\" description = \"A list of availability zones spefified as argument to this module\"\n+ description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n \n---\n\n\n---\n\nChoice D:\nexamples/simple-vpc/outputs.tf\n@@ -29,7 +29,7 @@ output \"nat_public_ips\" {\n \n # AZs\n output \"azs\" {\n- description = \"A list of availability zones spefified as argument to this module\"\n+ description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n \n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdd support for elasticache_subnet_group_name, elasticache_subnet_group_tags and redshift_subnet_group_name similar to what database subnet group already has\r\n\r\n## Motivation and Context\r\nIt is expected that naming and tagging of subnet groups work similarily in each case\r\n\r\n## Breaking Changes\r\nShould not break anything\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -189,13 +189,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | [terraform](#requirement\\_terraform) | >= 0.12.31 |\n-| [aws](#requirement\\_aws) | >= 3.28 |\n+| [aws](#requirement\\_aws) | >= 3.38 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| [aws](#provider\\_aws) | >= 3.28 |\n+| [aws](#provider\\_aws) | >= 3.38 |\n \n ## Modules\n \n@@ -346,6 +346,8 @@ No modules.\n | [elasticache\\_outbound\\_acl\\_rules](#input\\_elasticache\\_outbound\\_acl\\_rules) | Elasticache subnets outbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [elasticache\\_route\\_table\\_tags](#input\\_elasticache\\_route\\_table\\_tags) | Additional tags for the elasticache route tables | `map(string)` | `{}` | no |\n | [elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on elasticache subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| [elasticache\\_subnet\\_group\\_name](#input\\_elasticache\\_subnet\\_group\\_name) | Name of elasticache subnet group | `string` | `null` | no |\n+| [elasticache\\_subnet\\_group\\_tags](#input\\_elasticache\\_subnet\\_group\\_tags) | Additional tags for the elasticache subnet group | `map(string)` | `{}` | no |\n | [elasticache\\_subnet\\_ipv6\\_prefixes](#input\\_elasticache\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 elasticache subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | [elasticache\\_subnet\\_suffix](#input\\_elasticache\\_subnet\\_suffix) | Suffix to append to elasticache subnets name | `string` | `\"elasticache\"` | no |\n | [elasticache\\_subnet\\_tags](#input\\_elasticache\\_subnet\\_tags) | Additional tags for the elasticache subnets | `map(string)` | `{}` | no |\n@@ -432,6 +434,7 @@ No modules.\n | [redshift\\_outbound\\_acl\\_rules](#input\\_redshift\\_outbound\\_acl\\_rules) | Redshift subnets outbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [redshift\\_route\\_table\\_tags](#input\\_redshift\\_route\\_table\\_tags) | Additional tags for the redshift route tables | `map(string)` | `{}` | no |\n | [redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on redshift subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| [redshift\\_subnet\\_group\\_name](#input\\_redshift\\_subnet\\_group\\_name) | Name of redshift subnet group | `string` | `null` | no |\n | [redshift\\_subnet\\_group\\_tags](#input\\_redshift\\_subnet\\_group\\_tags) | Additional tags for the redshift subnet group | `map(string)` | `{}` | no |\n | [redshift\\_subnet\\_ipv6\\_prefixes](#input\\_redshift\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 redshift subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | [redshift\\_subnet\\_suffix](#input\\_redshift\\_subnet\\_suffix) | Suffix to append to redshift subnets name | `string` | `\"redshift\"` | no |\n---\nmain.tf\n@@ -525,13 +525,13 @@ resource \"aws_subnet\" \"redshift\" {\n resource \"aws_redshift_subnet_group\" \"redshift\" {\n count = var.create_vpc && length(var.redshift_subnets) > 0 && var.create_redshift_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.redshift_subnet_group_name, var.name))\n description = \"Redshift subnet group for ${var.name}\"\n subnet_ids = aws_subnet.redshift.*.id\n \n tags = merge(\n {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = format(\"%s\", coalesce(var.redshift_subnet_group_name, var.name))\n },\n var.tags,\n var.redshift_subnet_group_tags,\n@@ -569,9 +569,17 @@ resource \"aws_subnet\" \"elasticache\" {\n resource \"aws_elasticache_subnet_group\" \"elasticache\" {\n count = var.create_vpc && length(var.elasticache_subnets) > 0 && var.create_elasticache_subnet_group ? 1 : 0\n \n- name = var.name\n+ name = coalesce(var.elasticache_subnet_group_name, var.name)\n description = \"ElastiCache subnet group for ${var.name}\"\n subnet_ids = aws_subnet.elasticache.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", coalesce(var.elasticache_subnet_group_name, var.name))\n+ },\n+ var.tags,\n+ var.elasticache_subnet_group_tags,\n+ )\n }\n \n ################################################################################\n---\nvariables.tf\n@@ -502,12 +502,30 @@ variable \"redshift_subnet_tags\" {\n default = {}\n }\n \n+variable \"redshift_subnet_group_name\" {\n+ description = \"Name of redshift subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"redshift_subnet_group_tags\" {\n description = \"Additional tags for the redshift subnet group\"\n type = map(string)\n default = {}\n }\n \n+variable \"elasticache_subnet_group_name\" {\n+ description = \"Name of elasticache subnet group\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"elasticache_subnet_group_tags\" {\n+ description = \"Additional tags for the elasticache subnet group\"\n+ subnet, = map(string)\n+ default = {}\n+}\n+\n variable \"elasticache_subnet_tags\" {\n description = \"Additional tags for the elasticache subnets\"\n type = map(string)\n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.28\"\n+ version = \">= 3.38\"\n }\n }\n }\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -189,13 +189,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | [terraform](#requirement\\_terraform) | >= 0.12.31 |\n-| [aws](#requirement\\_aws) | >= 3.28 |\n+| [aws](#requirement\\_aws) | >= 3.38 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| [aws](#provider\\_aws) | >= 3.28 |\n+| [aws](#provider\\_aws) | >= 3.38 |\n \n ## Modules\n \n@@ -346,6 +346,8 @@ No modules.\n | [elasticache\\_outbound\\_acl\\_rules](#input\\_elasticache\\_outbound\\_acl\\_rules) | Elasticache subnets outbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [elasticache\\_route\\_table\\_tags](#input\\_elasticache\\_route\\_table\\_tags) | Additional tags for the elasticache route tables | `map(string)` | `{}` | no |\n | [elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on elasticache subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| [elasticache\\_subnet\\_group\\_name](#input\\_elasticache\\_subnet\\_group\\_name) | Name of elasticache subnet group | `string` | `null` | no |\n+| [elasticache\\_subnet\\_group\\_tags](#input\\_elasticache\\_subnet\\_group\\_tags) | Additional tags for the elasticache subnet group | `map(string)` | `{}` | no |\n | [elasticache\\_subnet\\_ipv6\\_prefixes](#input\\_elasticache\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 elasticache subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | [elasticache\\_subnet\\_suffix](#input\\_elasticache\\_subnet\\_suffix) | Suffix to append to elasticache subnets name | `string` | `\"elasticache\"` | no |\n | [elasticache\\_subnet\\_tags](#input\\_elasticache\\_subnet\\_tags) | Additional tags for the elasticache subnets | `map(string)` | `{}` | no |\n@@ -432,6 +434,7 @@ No modules.\n | [redshift\\_outbound\\_acl\\_rules](#input\\_redshift\\_outbound\\_acl\\_rules) | Redshift subnets outbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [redshift\\_route\\_table\\_tags](#input\\_redshift\\_route\\_table\\_tags) | Additional tags for the redshift route tables | `map(string)` | `{}` | no |\n | [redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on redshift subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| [redshift\\_subnet\\_group\\_name](#input\\_redshift\\_subnet\\_group\\_name) | Name of redshift subnet group | `string` | `null` | no |\n | [redshift\\_subnet\\_group\\_tags](#input\\_redshift\\_subnet\\_group\\_tags) | Additional tags for the redshift subnet group | `map(string)` | `{}` | no |\n | [redshift\\_subnet\\_ipv6\\_prefixes](#input\\_redshift\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 redshift subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | [redshift\\_subnet\\_suffix](#input\\_redshift\\_subnet\\_suffix) | Suffix to append to redshift subnets name | `string` | `\"redshift\"` | no |\n---\nmain.tf\n@@ -525,13 +525,13 @@ resource \"aws_subnet\" \"redshift\" {\n resource \"aws_redshift_subnet_group\" \"redshift\" count = var.create_vpc && length(var.redshift_subnets) > 0 && var.create_redshift_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.redshift_subnet_group_name, var.name))\n description = \"Redshift subnet group for ${var.name}\"\n subnet_ids = aws_subnet.redshift.*.id\n \n tags = merge(\n {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = format(\"%s\", coalesce(var.redshift_subnet_group_name, var.name))\n },\n var.tags,\n var.redshift_subnet_group_tags,\n@@ -569,9 +569,17 @@ resource \"aws_subnet\" \"elasticache\" {\n resource \"aws_elasticache_subnet_group\" \"elasticache\" {\n count = var.create_vpc && length(var.elasticache_subnets) > 0 && var.create_elasticache_subnet_group ? 1 : 0\n \n- name = var.name\n+ name = coalesce(var.elasticache_subnet_group_name, var.name)\n description = \"ElastiCache subnet group for ${var.name}\"\n subnet_ids = aws_subnet.elasticache.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", coalesce(var.elasticache_subnet_group_name, var.name))\n+ },\n+ var.tags,\n+ var.elasticache_subnet_group_tags,\n+ )\n }\n \n ################################################################################\n---\nvariables.tf\n@@ -502,12 +502,30 @@ variable \"redshift_subnet_tags\" {\n default = {}\n }\n \n+variable \"redshift_subnet_group_name\" {\n+ description = \"Name of redshift subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"redshift_subnet_group_tags\" {\n description = \"Additional tags for the redshift subnet group\"\n type = map(string)\n default = {}\n }\n \n+variable \"elasticache_subnet_group_name\" {\n+ description = \"Name of elasticache subnet group\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"elasticache_subnet_group_tags\" {\n+ description = \"Additional tags for the elasticache subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"elasticache_subnet_tags\" {\n description = \"Additional tags for the elasticache subnets\"\n type = map(string)\n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.28\"\n+ version = \">= 3.38\"\n }\n }\n }\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -189,13 +189,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | [terraform](#requirement\\_terraform) | >= 0.12.31 |\n-| [aws](#requirement\\_aws) | >= 3.28 |\n+| [aws](#requirement\\_aws) | >= 3.38 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| [aws](#provider\\_aws) | >= 3.28 |\n+| [aws](#provider\\_aws) | >= 3.38 |\n \n ## Modules\n \n@@ -346,6 +346,8 @@ No modules.\n | [elasticache\\_outbound\\_acl\\_rules](#input\\_elasticache\\_outbound\\_acl\\_rules) | Elasticache subnets outbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [elasticache\\_route\\_table\\_tags](#input\\_elasticache\\_route\\_table\\_tags) | Additional tags for the elasticache route tables | `map(string)` | `{}` | no |\n | [elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on elasticache subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| [elasticache\\_subnet\\_group\\_name](#input\\_elasticache\\_subnet\\_group\\_name) | Name of elasticache subnet group | `string` | `null` | no |\n+| [elasticache\\_subnet\\_group\\_tags](#input\\_elasticache\\_subnet\\_group\\_tags) | Additional tags for the elasticache subnet group | `map(string)` | `{}` | no |\n | [elasticache\\_subnet\\_ipv6\\_prefixes](#input\\_elasticache\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 elasticache subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | [elasticache\\_subnet\\_suffix](#input\\_elasticache\\_subnet\\_suffix) | Suffix to append to elasticache subnets name | `string` | `\"elasticache\"` | no |\n | [elasticache\\_subnet\\_tags](#input\\_elasticache\\_subnet\\_tags) | Additional tags for the elasticache subnets | `map(string)` | `{}` | no |\n@@ -432,6 +434,7 @@ No modules.\n | [redshift\\_outbound\\_acl\\_rules](#input\\_redshift\\_outbound\\_acl\\_rules) | Redshift subnets outbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [redshift\\_route\\_table\\_tags](#input\\_redshift\\_route\\_table\\_tags) | Additional tags for the redshift route tables | `map(string)` | `{}` | no |\n | [redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on redshift subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| [redshift\\_subnet\\_group\\_name](#input\\_redshift\\_subnet\\_group\\_name) | Name of redshift subnet group | `string` | `null` | no |\n | [redshift\\_subnet\\_group\\_tags](#input\\_redshift\\_subnet\\_group\\_tags) | Additional tags for the redshift subnet group | `map(string)` | `{}` | no |\n | [redshift\\_subnet\\_ipv6\\_prefixes](#input\\_redshift\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 redshift subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | [redshift\\_subnet\\_suffix](#input\\_redshift\\_subnet\\_suffix) | Suffix to append to redshift subnets name | `string` | `\"redshift\"` | no |\n---\nmain.tf\n@@ -525,13 +525,13 @@ resource \"aws_subnet\" \"redshift\" {\n resource \"aws_redshift_subnet_group\" \"redshift\" {\n count = var.create_vpc && length(var.redshift_subnets) > 0 && var.create_redshift_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.redshift_subnet_group_name, var.name))\n description = \"Redshift subnet group for ${var.name}\"\n subnet_ids = aws_subnet.redshift.*.id\n \n tags = merge(\n {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = format(\"%s\", coalesce(var.redshift_subnet_group_name, var.name))\n },\n var.tags,\n var.redshift_subnet_group_tags,\n@@ -569,9 +569,17 @@ resource \"aws_subnet\" \"elasticache\" {\n resource \"aws_elasticache_subnet_group\" \"elasticache\" {\n count = var.create_vpc && length(var.elasticache_subnets) > 0 && var.create_elasticache_subnet_group ? 1 : 0\n \n- name = var.name\n+ name = coalesce(var.elasticache_subnet_group_name, var.name)\n description = \"ElastiCache subnet group for ${var.name}\"\n subnet_ids = aws_subnet.elasticache.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", coalesce(var.elasticache_subnet_group_name, var.name))\n+ },\n+ var.tags,\n+ var.elasticache_subnet_group_tags,\n+ )\n }\n \n ################################################################################\n---\nvariables.tf\n@@ -502,12 +502,30 @@ variable \"redshift_subnet_tags\" {\n default = {}\n }\n \n+variable \"redshift_subnet_group_name\" {\n+ description = \"Name of redshift subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"redshift_subnet_group_tags\" {\n description = \"Additional tags for the redshift subnet group\"\n type = map(string)\n default = {}\n }\n \n+variable \"elasticache_subnet_group_name\" {\n+ description = \"Name of elasticache subnet group\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"elasticache_subnet_group_tags\" {\n+ description = \"Additional tags for the elasticache subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"elasticache_subnet_tags\" {\n description = \"Additional tags for the elasticache subnets\"\n type = map(string)\n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.28\"\n+ version = \">= 3.38\"\n }\n }\n }\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -189,13 +189,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | [terraform](#requirement\\_terraform) | >= 0.12.31 |\n-| [aws](#requirement\\_aws) | >= 3.28 |\n+| [aws](#requirement\\_aws) | >= 3.38 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| [aws](#provider\\_aws) | >= 3.28 |\n+| [aws](#provider\\_aws) | >= 3.38 |\n \n ## Modules\n \n@@ -346,6 +346,8 @@ No modules.\n | [elasticache\\_outbound\\_acl\\_rules](#input\\_elasticache\\_outbound\\_acl\\_rules) | Elasticache subnets outbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [elasticache\\_route\\_table\\_tags](#input\\_elasticache\\_route\\_table\\_tags) | Additional tags for the elasticache route tables | `map(string)` | `{}` | no |\n | [elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on elasticache subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| [elasticache\\_subnet\\_group\\_name](#input\\_elasticache\\_subnet\\_group\\_name) | Name of elasticache subnet group | `string` | `null` | no |\n+| [elasticache\\_subnet\\_group\\_tags](#input\\_elasticache\\_subnet\\_group\\_tags) | Additional tags for the elasticache subnet group | `map(string)` | `{}` | no |\n | [elasticache\\_subnet\\_ipv6\\_prefixes](#input\\_elasticache\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 elasticache subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | [elasticache\\_subnet\\_suffix](#input\\_elasticache\\_subnet\\_suffix) | Suffix to append to elasticache subnets name | `string` | `\"elasticache\"` | no |\n | [elasticache\\_subnet\\_tags](#input\\_elasticache\\_subnet\\_tags) | Additional tags for the elasticache subnets | `map(string)` | `{}` | no |\n@@ -432,6 +434,7 @@ No modules.\n | [redshift\\_outbound\\_acl\\_rules](#input\\_redshift\\_outbound\\_acl\\_rules) | Redshift subnets outbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [redshift\\_route\\_table\\_tags](#input\\_redshift\\_route\\_table\\_tags) | Additional tags for the redshift route tables | `map(string)` | `{}` | no |\n | [redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on redshift subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| [redshift\\_subnet\\_group\\_name](#input\\_redshift\\_subnet\\_group\\_name) | Name of redshift subnet group | `string` | `null` | no |\n | [redshift\\_subnet\\_group\\_tags](#input\\_redshift\\_subnet\\_group\\_tags) | Additional tags for the redshift subnet group | `map(string)` | `{}` | no |\n | [redshift\\_subnet\\_ipv6\\_prefixes](#input\\_redshift\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 redshift subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | [redshift\\_subnet\\_suffix](#input\\_redshift\\_subnet\\_suffix) | Suffix to append to redshift subnets name | `string` | `\"redshift\"` | no |\n---\nmain.tf\n@@ -525,13 +525,13 @@ resource \"aws_subnet\" \"redshift\" {\n resource \"aws_redshift_subnet_group\" \"redshift\" {\n count = var.create_vpc && length(var.redshift_subnets) > 0 && var.create_redshift_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.redshift_subnet_group_name, var.name))\n description = \"Redshift subnet group for ${var.name}\"\n subnet_ids = aws_subnet.redshift.*.id\n \n tags = merge(\n {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = coalesce(var.redshift_subnet_group_name, var.name))\n },\n var.tags,\n var.redshift_subnet_group_tags,\n@@ -569,9 +569,17 @@ resource \"aws_subnet\" \"elasticache\" {\n resource \"aws_elasticache_subnet_group\" \"elasticache\" {\n count = var.create_vpc && length(var.elasticache_subnets) > 0 && var.create_elasticache_subnet_group ? 1 : 0\n \n- name = var.name\n+ name = coalesce(var.elasticache_subnet_group_name, var.name)\n description = \"ElastiCache subnet group for ${var.name}\"\n subnet_ids = aws_subnet.elasticache.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", coalesce(var.elasticache_subnet_group_name, var.name))\n+ },\n+ var.tags,\n+ var.elasticache_subnet_group_tags,\n+ )\n }\n \n ################################################################################\n---\nvariables.tf\n@@ -502,12 +502,30 @@ variable \"redshift_subnet_tags\" {\n default = {}\n }\n \n+variable \"redshift_subnet_group_name\" {\n+ description = \"Name of redshift subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"redshift_subnet_group_tags\" {\n description = \"Additional tags for the redshift subnet group\"\n type = map(string)\n default = {}\n }\n \n+variable \"elasticache_subnet_group_name\" {\n+ description = \"Name of elasticache subnet group\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"elasticache_subnet_group_tags\" {\n+ description = \"Additional tags for the elasticache subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"elasticache_subnet_tags\" {\n description = \"Additional tags for the elasticache subnets\"\n type = map(string)\n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.28\"\n+ version = \">= 3.38\"\n }\n }\n }\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nDHCP option sets should default to AWS provided NTP servers\r\n\r\n## Motivation and Context\r\nJust as DHCP option sets default to `AmazonProvidedDNS`, they should also default to Amazon provided NTP, served by the [Amazon Time Sync Service](https://aws.amazon.com/blogs/mt/manage-amazon-ec2-instance-clock-accuracy-using-amazon-time-sync-service-and-amazon-cloudwatch-part-1/).\r\nSince AWS inexplicably provides no analogous symbol `AmazonProvidedNTP`, we serve the link-local IPv4 address `169.254.169.123` for use by DHCP clients that don't configure it statically (e.g. recent AWS [Linux](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html) or [Windows](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/windows-set-time.html) AMIs).\r\n\r\n## Breaking Changes\r\nnone\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n```\r\n$ git checkout use-amazon-time-sync-service\r\n$ cd examples/simple-vpc\r\n$ terraform -version\r\nTerraform v1.0.4\r\non darwin_amd64\r\n+ provider registry.terraform.io/hashicorp/aws v3.54.0\r\n$ terraform -chdir=../.. init\r\n(...)\r\n$ terraform -chdir=../.. plan -var 'enable_dhcp_options=true' -var 'cidr=172.16.0.0/20'\r\nprovider.aws.region\r\n The region where AWS operations will take place. Examples\r\n are us-east-1, us-west-2, etc.\r\n\r\n Enter a value: us-west-2\r\n(...)\r\n # aws_vpc_dhcp_options.this[0] will be created\r\n + resource \"aws_vpc_dhcp_options\" \"this\" {\r\n + arn = (known after apply)\r\n + domain_name_servers = [\r\n + \"AmazonProvidedDNS\",\r\n ]\r\n + id = (known after apply)\r\n + netbios_name_servers = []\r\n + ntp_servers = [\r\n + \"169.254.169.123\",\r\n ]\r\n + owner_id = (known after apply)\r\n + tags = {\r\n + \"Name\" = \"\"\r\n }\r\n + tags_all = {\r\n + \"Name\" = (known after apply)\r\n }\r\n }\r\n(...)\r\n$ \r\n```\n\n---\n\nChoice A:\nvariables.tf\n@@ -623,9 +623,9 @@ variable \"dhcp_options_domain_name_servers\" {\n }\n \n variable \"dhcp_options_ntp_servers\" {\n- description = \"Specify a list of NTP servers for DHCP options set (requires enable_dhcp_options for to true)\"\n+ description = \"Specify a list of NTP server addresses for DHCP options set, default to AWS provided (requires enable_dhcp_options set to true)\"\n type = list(string)\n- default = []\n+ default = [\"169.254.169.123\"]\n }\n \n variable \"dhcp_options_netbios_name_servers\" {\n---\n\n\n---\n\nChoice B:\nvariables.tf\n@@ -623,9 +623,9 @@ variable \"dhcp_options_domain_name_servers\" {\n }\n \n variable \"dhcp_options_ntp_servers\" {\n- description = \"Specify a list of NTP servers for DHCP options set (requires enable_dhcp_options set to set description = \"Specify a list of NTP server addresses for DHCP options set, default to AWS provided (requires enable_dhcp_options set to true)\"\n type = list(string)\n- default = []\n+ default = [\"169.254.169.123\"]\n }\n \n variable \"dhcp_options_netbios_name_servers\" {\n---\n\n\n---\n\nChoice C:\nvariables.tf\n@@ -623,9 +623,9 @@ variable \"dhcp_options_domain_name_servers\" {\n }\n \n variable \"dhcp_options_ntp_servers\" {\n- description = \"Specify a list of NTP servers for DHCP options set (requires enable_dhcp_options set to true)\"\n+ description = \"Specify a list of NTP server addresses for DHCP options set, default to AWS provided (requires enable_dhcp_options set to true)\"\n type = list(string)\n- default = = default = [\"169.254.169.123\"]\n }\n \n variable \"dhcp_options_netbios_name_servers\" {\n---\n\n\n---\n\nChoice D:\nvariables.tf\n@@ -623,9 +623,9 @@ variable \"dhcp_options_domain_name_servers\" {\n }\n \n variable \"dhcp_options_ntp_servers\" {\n- description = \"Specify a list of NTP servers for DHCP options set (requires enable_dhcp_options set to true)\"\n+ description = \"Specify a list of NTP server addresses for DHCP options set, default to AWS provided (requires enable_dhcp_options set to true)\"\n type = list(string)\n- default = []\n+ default = [\"169.254.169.123\"]\n }\n \n variable \"dhcp_options_netbios_name_servers\" {\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nFixes #679 \r\n\r\nUpdates the minimum terraform version to 0.12.31 to support the new HashiCorp Signatures\r\n\r\n## Motivation and Context\r\nTerraform versions before 0.12.31 only support the AWS Provider version up to 3.37.0 because the GPG key used to create the signatures was changed at this point.\r\n\r\n## Breaking Changes\r\nNone. This change only increments the terraform version to the latest minor version of the same release version.\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n- Verified that for each of the examples fails init when the module's aws provider version is set to 3.38 and the terraform version is 0.12.26\r\n- Verified that it inits as expected when the terraform version is set to 0.12.31.\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -188,7 +188,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/ipv6/README.md\n@@ -19,7 +19,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/ipv6/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/issues/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/issues/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/manage-default-vpc/README.md\n@@ -21,7 +21,7 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/network-acls/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/network-acls/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/outpost/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which -1,5 cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/outpost/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/simple-vpc/README.md\n@@ -25,7 +25,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/simple-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n | [random](#requirement\\_random) | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nmodules/vpc-endpoints/README.md\n@@ -55,7 +55,7 @@ module \"endpoints\" {\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nmodules/vpc-endpoints/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nversions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -188,7 +188,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/ipv6/README.md\n@@ -19,7 +19,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/ipv6/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/issues/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/issues/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/manage-default-vpc/README.md\n@@ -21,7 +21,7 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/network-acls/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/network-acls/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/outpost/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/outpost/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/simple-vpc/README.md\n@@ -25,7 +25,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/simple-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n | [random](#requirement\\_random) | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nmodules/vpc-endpoints/README.md\n@@ -55,7 +55,7 @@ module \"endpoints\" {\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nmodules/vpc-endpoints/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nversions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -188,7 +188,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/ipv6/README.md\n@@ -19,7 +19,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/ipv6/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = destroy` -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/issues/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/manage-default-vpc/README.md\n@@ -21,7 +21,7 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/network-acls/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/network-acls/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/outpost/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/outpost/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/simple-vpc/README.md\n@@ -25,7 +25,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/simple-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n | [random](#requirement\\_random) | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nmodules/vpc-endpoints/README.md\n@@ -55,7 +55,7 @@ module \"endpoints\" {\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nmodules/vpc-endpoints/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nversions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -188,7 +188,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n 0.12.31 aws = {\n---\nexamples/ipv6/README.md\n@@ -19,7 +19,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/ipv6/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/issues/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/issues/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/manage-default-vpc/README.md\n@@ -21,7 +21,7 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/network-acls/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/network-acls/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/outpost/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/outpost/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/simple-vpc/README.md\n@@ -25,7 +25,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/simple-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n | [random](#requirement\\_random) | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nmodules/vpc-endpoints/README.md\n@@ -55,7 +55,7 @@ module \"endpoints\" {\n \n | Name | Version |\n |------|---------|\n-| [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nmodules/vpc-endpoints/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nversions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nUpdating vpc S3 enpoint\r\n\r\n## Motivation and Context\r\nbreaking in s3 service type for name change\r\n\r\n## Breaking Changes\r\ndoes not break changes\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\ncreated new tag and tested in local environment and works\r\nran tf init, plan and tested ok\r\n\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", ? \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -1,17 +1,23 @@\n ######################\n # VPC Endpoint for S3\n ######################\n-data \"aws_vpc_endpoint_service\" \"s3\" {\n- count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n-\n- service = \"s3\"\n-}\n+#data \"aws_vpc_endpoint_service\" \"s3\" {\n+# count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n+#\n+# service = \"s3\"\n+# filter {\n+# name = \"tag-type\"\n+# values = [\"gateway\"]\n+# }\n+#}\n+data \"aws_region\" \"current\" {}\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ #service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.s3\"\n tags = local.vpce_tags\n }\n \n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -1,17 +1,23 @@\n ######################\n # VPC Endpoint for S3\n ######################\n-data \"aws_vpc_endpoint_service\" \"s3\" {\n- count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n-\n- service = \"s3\"\n-}\n+#data \"aws_vpc_endpoint_service\" \"s3\" {\n+# count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n+#\n+# service = \"s3\"\n+# filter {\n+# name = \"tag-type\"\n+# values = [\"gateway\"]\n+# }\n+#}\n+data \"aws_region\" \"current\" {}\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ #service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.s3\"\n tags = local.vpce_tags\n }\n \n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets [\"10.10.11.0/24\", [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -1,17 +1,23 @@\n ######################\n # VPC Endpoint for S3\n ######################\n-data \"aws_vpc_endpoint_service\" \"s3\" {\n- count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n-\n- service = \"s3\"\n-}\n+#data \"aws_vpc_endpoint_service\" \"s3\" {\n+# count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n+#\n+# service = \"s3\"\n+# filter {\n+# name = \"tag-type\"\n+# values = [\"gateway\"]\n+# }\n+#}\n+data \"aws_region\" \"current\" {}\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ #service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.s3\"\n tags = local.vpce_tags\n }\n \n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -1,17 +1,23 @@\n ######################\n # VPC Endpoint for S3\n ######################\n-data \"aws_vpc_endpoint_service\" \"s3\" {\n- count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n-\n- service = \"s3\"\n-}\n+#data \"aws_vpc_endpoint_service\" \"s3\" {\n+# count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n+#\n+# service = \"s3\"\n+# filter {\n+# name = \"tag-type\"\n+# values = [\"gateway\"]\n+# }\n+#}\n+data \"aws_region\" \"current\" {}\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ #service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.s3\"\n tags = local.vpce_tags\n \n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n- Replace `aws:SourceVpce` conditions\r\n- Remove `aws_vpc_endpoint_service` data objects\r\n\r\n## Description\r\nFix Complete VPC example code by removing several incorrect examples.\r\n\r\n## Motivation and Context\r\n- Firstly, it makes no sense to use `aws:SourceVpce` in a VPC endpoint IAM policy; all traffic that the VPC endpoint will receive will always have its own id here. You can read more about this key [here](https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html) under the section titled \"Use IAM policies to control access to DynamoDB\", in which the document states (emphasis mine):\r\n\r\n\"You can create an IAM policy for your **IAM users, groups, or roles** to restrict access to DynamoDB tables from a specific VPC endpoint only. To do this, you can use the aws:sourceVpce condition key for the table resource in your IAM policy.\"\r\n\r\n- Secondly, at some point there was a change from the data `aws_vpc_endpoint` to `aws_vpc_endpoint_service`. It's important to note this because previously the code used `data.aws_vpc_endpoint.dynamodb.id` which does exist and provides an id like `vpce-12345` but was later replaced by `data.aws_vpc_endpoint_service.dynamodb.id`. You can see [here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) that `id` is not a valid attribute and the output of this data type was a numerical id like `1234` that seemed to have no bearing to vpc, vpc endpoint or any other active resource.\r\n\r\nThe changes I've made continue to provide a policy for an example case, but the example now provides a somewhat more sensible value. In the new example code, the deny rule is set to reject any users who are outside of the current account.\r\n\r\n## Breaking Changes\r\nThis does not break any module code as it only affects an example\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\nI had to extensively debug why the example wasn't working and have cited all of my documentation.\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -182,16 +182,8 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n- service = \"dynamodb\"\n-\n- filter {\n- name = \"service-type\"\n- values = [\"Gateway\"]\n- }\n-}\n-\n+data \"aws_caller_identity\" \"current\" {}\n+ \n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -205,9 +197,9 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = [data.aws_vpc_endpoint_service.dynamodb.id]\n+ values = }\n }\n }\n@@ -225,9 +217,9 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = [data.aws_vpc_endpoint_service.dynamodb.id]\n+ values = [data.aws_caller_identity.current.account_id]\n }\n }\n }\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -182,16 +182,8 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n- service = \"dynamodb\"\n-\n- filter {\n- name = \"service-type\"\n- values = [\"Gateway\"]\n- }\n-}\n-\n+data \"aws_caller_identity\" \"current\" {}\n+ \n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -205,9 +197,9 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = [data.aws_vpc_endpoint_service.dynamodb.id]\n+ values = [data.aws_caller_identity.current.account_id]\n }\n }\n }\n@@ -225,9 +217,9 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = [data.aws_vpc_endpoint_service.dynamodb.id]\n+ \"aws_iam_policy_document\" = [data.aws_caller_identity.current.account_id]\n }\n }\n }\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -182,16 +182,8 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n- service = \"dynamodb\"\n-\n- filter {\n- name = \"service-type\"\n- values = [\"Gateway\"]\n- }\n-}\n-\n+data \"aws_caller_identity\" \"current\" {}\n+ \n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -205,9 +197,9 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = [data.aws_vpc_endpoint_service.dynamodb.id]\n+ values = [data.aws_caller_identity.current.account_id]\n }\n }\n }\n@@ -225,9 +217,9 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = [data.aws_vpc_endpoint_service.dynamodb.id]\n+ values = [data.aws_caller_identity.current.account_id]\n }\n }\n }\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -182,16 +182,8 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n- service = \"dynamodb\"\n-\n- filter {\n- name = \"service-type\"\n- values = [\"Gateway\"]\n- }\n-}\n-\n+data \"aws_caller_identity\" \"current\" {}\n+ \n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -205,9 +197,9 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = [data.aws_vpc_endpoint_service.dynamodb.id]\n+ values = [data.aws_caller_identity.current.account_id]\n }\n }\n }\n@@ -225,9 +217,9 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = \"aws_security_group\" values = [data.aws_caller_identity.current.account_id]\n }\n }\n }\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nMany Cloudrail users are running into this:\r\n```\r\nRule: Ensure IAM policies pass Access Analyzer policy validation without WARNING and SUGGESTION issues\r\n - 1 Resources Exposed:\r\n-----------------------------------------------\r\n - Exposed Resource: [module.vpc.aws_iam_role.vpc_flow_log_cloudwatch[0]] (../../vpc-flow-logs.tf:44)\r\n Violating Resource: [module.vpc.aws_iam_role.vpc_flow_log_cloudwatch[0]] (../../vpc-flow-logs.tf:44)\r\n\r\n Evidence:\r\n Line 5, Col 13:\r\n | Add a value to the empty string in the Sid element\r\n | See https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-reference-policy-checks.html#access-analyzer-reference-policy-checks-suggestion-empty-sid-value\r\n```\r\n\r\nSimply because there's no SID in the assume policy and it violates AWS best practices.\r\n\r\n## Motivation and Context\r\nTo avoid a Cloudrail violation for users of the vpc module.\r\n\r\n## Breaking Changes\r\nThis updates the assume role policy. It doesn't break backwards compatibility but will introduce an update in user environments that have this module deployed.\r\n\r\n```\r\nTerraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:\r\n ~ update in-place\r\n\r\nTerraform will perform the following actions:\r\n\r\n # module.vpc.aws_iam_role.vpc_flow_log_cloudwatch[0] will be updated in-place\r\n ~ resource \"aws_iam_role\" \"vpc_flow_log_cloudwatch\" {\r\n ~ assume_role_policy = jsonencode(\r\n ~ {\r\n ~ Statement = [\r\n ~ {\r\n ~ Sid = \"\" -> \"AWSVPCFlowLogsAssumeRole\"\r\n # (3 unchanged elements hidden)\r\n },\r\n ]\r\n # (1 unchanged element hidden)\r\n }\r\n )\r\n id = \"vpc-flow-log-role-20210729162754416900000002\"\r\n name = \"vpc-flow-log-role-20210729162754416900000002\"\r\n tags = {\r\n \"Environment\" = \"staging\"\r\n \"Name\" = \"complete\"\r\n \"Owner\" = \"user\"\r\n }\r\n # (9 unchanged attributes hidden)\r\n\r\n # (1 unchanged block hidden)\r\n }\r\n\r\nPlan: 0 to add, 1 to change, 0 to destroy.\r\n\r\n```\r\n\r\n## How Has This Been Tested?\r\nI have tested it using the complete-vpc example. Started with planning and applying as the code is today (and checked that Cloudrail triggers the above violation on the plan). Then I fixed the code, planned again, verified with Cloudrail, and applied (to see the change doesn't break existing deployments).\r\n\r\n\n\n---\n\nChoice A:\n\"AWSVPCFlowLogsAssumeRole\"\n+\n -55,6 +55,8 @@ data \"aws_iam_policy_document\" \"flow_log_cloudwatch_assume_role\" {\n count = local.create_flow_log_cloudwatch_iam_role ? 1 : 0\n \n statement {\n+ sid = \"AWSVPCFlowLogsAssumeRole\"\n+\n principals {\n type = \"Service\"\n identifiers = [\"vpc-flow-logs.amazonaws.com\"]\n---\n\n\n---\n\nChoice B:\nvpc-flow-logs.tf\n@@ -55,6 +55,8 @@ data \"aws_iam_policy_document\" \"flow_log_cloudwatch_assume_role\" {\n {\n count = local.create_flow_log_cloudwatch_iam_role ? 1 : 0\n \n statement {\n+ sid = \"AWSVPCFlowLogsAssumeRole\"\n+\n principals {\n type = \"Service\"\n identifiers = [\"vpc-flow-logs.amazonaws.com\"]\n---\n\n\n---\n\nChoice C:\nvpc-flow-logs.tf\n@@ -55,6 +55,8 @@ data \"aws_iam_policy_document\" \"flow_log_cloudwatch_assume_role\" {\n count = local.create_flow_log_cloudwatch_iam_role ? 1 : 0\n \n statement {\n+ sid = \"AWSVPCFlowLogsAssumeRole\"\n+\n principals {\n type = \"Service\"\n identifiers = [\"vpc-flow-logs.amazonaws.com\"]\n---\n\n\n---\n\nChoice D:\nvpc-flow-logs.tf\n@@ local.create_flow_log_cloudwatch_iam_role +55,8 @@ data \"aws_iam_policy_document\" \"flow_log_cloudwatch_assume_role\" {\n count = local.create_flow_log_cloudwatch_iam_role ? 1 : 0\n \n statement {\n+ sid = \"AWSVPCFlowLogsAssumeRole\"\n+\n principals {\n type = \"Service\"\n identifiers = [\"vpc-flow-logs.amazonaws.com\"]\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdded ID of DHCP options to outputs\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\nWe need it to put in IAM policy which allow to maintain objects which created by this module.\r\n\r\n## Breaking Changes\r\n\r\n\r\nIt has backwards compatibility to all previous versions of module which has DHCP options object.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -481,6 +481,7 @@ No modules.\n | [default\\_vpc\\_id](#output\\_default\\_vpc\\_id) | The ID of the Default VPC |\n | [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n+| [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n | [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n | [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n---\noutputs.tf\n@@ -333,6 +333,11 @@ output \"public_route_table_association_ids\" {\n value = aws_route_table_association.public.*.id\n }\n \n+output \"dhcp_options_id\" {\n+ description = \"The ID of the DHCP options\"\n+ value = concat(aws_vpc_dhcp_options.this.*.id, [\"\"])[0]\n+}\n+\n output \"nat_ids\" {\n description = \"List of allocation ID of Elastic IPs created for AWS NAT Gateway\"\n value = aws_eip.nat.*.id\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -481,6 +481,7 @@ No modules.\n | [default\\_vpc\\_id](#output\\_default\\_vpc\\_id) | The ID of the Default VPC |\n | [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n+| [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n | [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n | [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n---\noutputs.tf\n@@ -333,6 +333,11 @@ | \"public_route_table_association_ids\" {\n value = aws_route_table_association.public.*.id\n }\n \n+output \"dhcp_options_id\" {\n+ description = \"The ID of the DHCP options\"\n+ value = concat(aws_vpc_dhcp_options.this.*.id, [\"\"])[0]\n+}\n+\n output \"nat_ids\" {\n description = \"List of allocation ID of Elastic IPs created for AWS NAT Gateway\"\n value = aws_eip.nat.*.id\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -481,6 +481,7 @@ No modules.\n | [default\\_vpc\\_id](#output\\_default\\_vpc\\_id) | The ID of the Default VPC |\n | [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n+| [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n | [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n | [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n---\noutputs.tf\n@@ -333,6 +333,11 @@ [default\\_vpc\\_id](#output\\_default\\_vpc\\_id) \"public_route_table_association_ids\" {\n value = aws_route_table_association.public.*.id\n }\n \n+output \"dhcp_options_id\" {\n+ description = \"The ID of the DHCP options\"\n+ value = concat(aws_vpc_dhcp_options.this.*.id, [\"\"])[0]\n+}\n+\n output \"nat_ids\" {\n description = \"List of allocation ID of Elastic IPs created for AWS NAT Gateway\"\n value = aws_eip.nat.*.id\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -481,6 +481,7 @@ No modules.\n | [default\\_vpc\\_id](#output\\_default\\_vpc\\_id) | The ID of the Default VPC |\n | [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n+| [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n | [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n | [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n---\noutputs.tf\n@@ -333,6 +333,11 @@ output \"public_route_table_association_ids\" {\n value = aws_route_table_association.public.*.id\n }\n \n+output \"dhcp_options_id\" {\n+ description = \"The ID of the DHCP options\"\n+ of = concat(aws_vpc_dhcp_options.this.*.id, [\"\"])[0]\n+}\n+\n output \"nat_ids\" {\n description = \"List of allocation ID of Elastic IPs created for AWS NAT Gateway\"\n value = aws_eip.nat.*.id\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nFix copy/paste mistake of the outputs in VPC with separate private route tables example\r\n## Motivation and Context\r\n\r\n\r\nThis still working but maybe misleading \r\n## Breaking Changes\r\n\r\n\r\nI don't think any of these are breaking changes, just fix copy/paste mistake. No existing properties are being changed.\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nexamples/vpc-separate-private-route-tables/README.md\n@@ -51,6 +51,6 @@ No inputs.\n | [nat\\_public\\_ips](#output\\_nat\\_public\\_ips) | List of public Elastic IPs created for AWS NAT Gateway |\n | [private\\_subnets](#output\\_private\\_subnets) | List of IDs of private subnets |\n | [public\\_subnets](#output\\_public\\_subnets) | List of IDs of public subnets |\n-| [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of elasticache subnets |\n+| [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of redshift subnets |\n | \n---\n name=\"output_vpc_id\"> [vpc\\_id](#output\\_vpc\\_id) | The ID of the VPC |\n \n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -26,7 +26,7 @@ output \"elasticache_subnets\" {\n }\n \n output \"redshift_subnets\" {\n- description = \"List of IDs of elasticache subnets\"\n+ description = \"List of IDs of redshift subnets\"\n value = module.vpc.redshift_subnets\n }\n \n---\n\n\n---\n\nChoice B:\nexamples/vpc-separate-private-route-tables/README.md\n@@ -51,6 +51,6 @@ No inputs.\n | [nat\\_public\\_ips](#output\\_nat\\_public\\_ips) | List of public Elastic IPs created for AWS NAT Gateway |\n | [private\\_subnets](#output\\_private\\_subnets) | List of IDs of private subnets |\n | [public\\_subnets](#output\\_public\\_subnets) | List of IDs of public subnets |\n-| [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of elasticache subnets |\n+| [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of redshift subnets |\n | [vpc\\_id](#output\\_vpc\\_id) | The ID of the VPC |\n \n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -26,7 +26,7 @@ output \"elasticache_subnets\" {\n }\n \n output \"redshift_subnets\" {\n- description = \"List of IDs of elasticache subnets\"\n+ description = \"List of IDs of redshift subnets\"\n value = module.vpc.redshift_subnets\n }\n \n---\n\n\n---\n\nChoice C:\nexamples/vpc-separate-private-route-tables/README.md\n@@ -51,6 +51,6 @@ No inputs.\n | [nat\\_public\\_ips](#output\\_nat\\_public\\_ips) | List of public Elastic IPs created for AWS NAT Gateway |\n OF [private\\_subnets](#output\\_private\\_subnets) | List of IDs of private subnets |\n | [public\\_subnets](#output\\_public\\_subnets) | List of IDs of public subnets |\n-| [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of elasticache subnets |\n+| [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of redshift subnets |\n | [vpc\\_id](#output\\_vpc\\_id) | The ID of the VPC |\n \n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -26,7 +26,7 @@ output \"elasticache_subnets\" {\n }\n \n output \"redshift_subnets\" {\n- description = \"List of IDs of elasticache subnets\"\n+ description = \"List of IDs of redshift subnets\"\n value = module.vpc.redshift_subnets\n }\n \n---\n\n\n---\n\nChoice D:\nexamples/vpc-separate-private-route-tables/README.md\n@@ -51,6 +51,6 @@ No inputs.\n | [nat\\_public\\_ips](#output\\_nat\\_public\\_ips) | List of public Elastic IPs created for AWS NAT Gateway |\n | [private\\_subnets](#output\\_private\\_subnets) | List of IDs of private subnets |\n | [public\\_subnets](#output\\_public\\_subnets) | List of IDs of public subnets |\n-| [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of elasticache subnets |\n+| [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of redshift subnets |\n | [vpc\\_id](#output\\_vpc\\_id) | The ID of the VPC |\n \n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -26,7 +26,7 @@ output \"elasticache_subnets\" {\n }\n \n output \"redshift_subnets\" {\n- description = \"List of IDs of elasticache subnets\"\n+ description = \"List of IDs of redshift subnets\"\n value of = module.vpc.redshift_subnets\n }\n \n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\nError: multiple VPC Endpoint Services matched; use additional constraints to reduce matches to a single VPC Endpoint Service\r\n\r\n\r\n## Breaking Changes\r\n\r\nNo\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects local project\r\n\r\nUpdated VPC S3 endpoint and tested on local env which completed successfully\r\n\r\nPlan: 0 to add, 0 to change, 0 to destroy.\r\n\r\nNo\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -5,6 +5,10 @@ data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -5,6 +5,10 @@ data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n = -5,6 +5,10 @@ data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -5,6 +5,10 data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -5,6 +5,10 @@ data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets && [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -5,6 +5,10 @@ data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -5,6 +5,10 @@ data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -5,6 +5,10 @@ data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nFixed #654 \n\n---\n\nChoice A:\nREADME.md\n@@ -312,6 +312,7 @@ No modules.\n | [database\\_outbound\\_acl\\_rules](#input\\_database\\_outbound\\_acl\\_rules) | Database subnets outbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [database\\_route\\_table\\_tags](#input\\_database\\_route\\_table\\_tags) | Additional tags for the database route tables | `map(string)` | `{}` | no |\n | [database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on database subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| [database\\_subnet\\_group\\_name](#input\\_database\\_subnet\\_group\\_name) | Name of database subnet group | `string` | `null` | no |\n | [database\\_subnet\\_group\\_tags](#input\\_database\\_subnet\\_group\\_tags) | Additional tags for the database subnet group | `map(string)` | `{}` | no |\n | [database\\_subnet\\_ipv6\\_prefixes](#input\\_database\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 database subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n---\nmain.tf\n@@ -481,13 +481,13 @@ resource \"aws_subnet\" \"database\" {\n resource \"aws_db_subnet_group\" \"database\" {\n count = var.create_vpc && length(var.database_subnets) > 0 && var.create_database_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.database_subnet_group_name, var.name))\n description = \"Database subnet group for ${var.name}\"\n subnet_ids = aws_subnet.database.*.id\n \n tags = merge(\n {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_subnet_group_name, var.name)))\n },\n var.tags,\n var.database_subnet_group_tags,\n---\nvariables.tf\n@@ -478,6 +478,12 @@ variable \"intra_route_table_tags\" {\n default = {}\n }\n \n+variable \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -312,6 +312,7 @@ No modules.\n | [database\\_outbound\\_acl\\_rules](#input\\_database\\_outbound\\_acl\\_rules) | Database subnets outbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [database\\_route\\_table\\_tags](#input\\_database\\_route\\_table\\_tags) | Additional tags for the database route tables | `map(string)` | `{}` | no |\n | [database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on database subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| [database\\_subnet\\_group\\_name](#input\\_database\\_subnet\\_group\\_name) | Name of database subnet group | `string` | `null` | no |\n | [database\\_subnet\\_group\\_tags](#input\\_database\\_subnet\\_group\\_tags) | Additional tags for the database subnet group | `map(string)` | `{}` | no |\n | [database\\_subnet\\_ipv6\\_prefixes](#input\\_database\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 database subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n---\nmain.tf\n@@ -481,13 +481,13 @@ resource \"aws_subnet\" \"database\" {\n resource \"aws_db_subnet_group\" \"database\" {\n count = var.create_vpc && length(var.database_subnets) > 0 && var.create_database_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.database_subnet_group_name, var.name))\n description = \"Database subnet group for ${var.name}\"\n subnet_ids = aws_subnet.database.*.id\n \n tags = merge(\n var.create_database_subnet_group {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_subnet_group_name, var.name)))\n },\n var.tags,\n var.database_subnet_group_tags,\n---\nvariables.tf\n@@ -478,6 +478,12 @@ variable \"intra_route_table_tags\" {\n default = {}\n }\n \n+variable \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -312,6 +312,7 @@ No modules.\n | [database\\_outbound\\_acl\\_rules](#input\\_database\\_outbound\\_acl\\_rules) | Database subnets outbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [database\\_route\\_table\\_tags](#input\\_database\\_route\\_table\\_tags) | Additional tags for the database route tables | `map(string)` | `{}` | no |\n | [database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on database subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| [database\\_subnet\\_group\\_name](#input\\_database\\_subnet\\_group\\_name) | Name of database subnet group | `string` | `null` | no |\n | [database\\_subnet\\_group\\_tags](#input\\_database\\_subnet\\_group\\_tags) | Additional tags for the database subnet group | `map(string)` | `{}` | no |\n | [database\\_subnet\\_ipv6\\_prefixes](#input\\_database\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 database subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n---\nmain.tf\n@@ -481,13 +481,13 @@ resource \"aws_subnet\" \"database\" {\n resource \"aws_db_subnet_group\" \"database\" {\n count = var.create_vpc && length(var.database_subnets) > 0 && var.create_database_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.database_subnet_group_name, var.name))\n description = \"Database subnet group for ${var.name}\"\n subnet_ids = aws_subnet.database.*.id\n \n tags = merge(\n {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_subnet_group_name, var.name)))\n },\n var.tags,\n var.database_subnet_group_tags,\n---\nvariables.tf\n@@ -478,6 +478,12 @@ variable \"intra_route_table_tags\" {\n \n default = {}\n }\n \n+variable \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -312,6 +312,7 @@ No modules.\n | [database\\_outbound\\_acl\\_rules](#input\\_database\\_outbound\\_acl\\_rules) | Database subnets outbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n | [database\\_route\\_table\\_tags](#input\\_database\\_route\\_table\\_tags) | Additional tags for the database route tables | `map(string)` | `{}` | no |\n | [database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on database subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| [database\\_subnet\\_group\\_name](#input\\_database\\_subnet\\_group\\_name) | Name of database subnet group | `string` | `null` | no |\n | [database\\_subnet\\_group\\_tags](#input\\_database\\_subnet\\_group\\_tags) | Additional tags for the database subnet group | `map(string)` | `{}` | no |\n | [database\\_subnet\\_ipv6\\_prefixes](#input\\_database\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 database subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n---\nmain.tf\n@@ -481,13 +481,13 @@ resource \"aws_subnet\" \"database\" {\n resource \"aws_db_subnet_group\" \"database\" {\n count = var.create_vpc && length(var.database_subnets) > 0 && var.create_database_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.database_subnet_group_name, var.name))\n description = \"Database subnet group for ${var.name}\"\n subnet_ids = aws_subnet.database.*.id\n \n tags = merge(\n {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_subnet_group_name, var.name)))\n },\n var.tags,\n var.database_subnet_group_tags,\n---\nvariables.tf\n@@ -478,6 +478,12 @@ variable \"intra_route_table_tags\" {\n default subnet = {}\n }\n \n+variable \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nPrivate DNS is not a valid setting for the S3 interface endpoint.\r\n\r\n## Description\r\nUpdating documentation.\r\n\r\n## Motivation and Context\r\nThe documentation for this module is invalid.\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\nHave tried to run the code as provided in the documentation and it will not work.\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n tags = },\n Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n service tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nBased on the output of:\r\n\r\n```sh\r\n aws ec2 describe-vpc-endpoint-services --region us-east-1\r\n```\r\n\r\nServices names are using different naming convention, they use URL like naming with region included.\r\n\r\nHope that helps! \n\n---\n\nChoice A:\nmodules/vpc-endpoints/README.md\n@@ -7,6 +7,8 @@ Terraform sub-module which creates VPC endpoint resources on AWS.\n See [`examples`](../../examples) directory for working examples to reference:\n \n ```hcl\n+data \"aws_region\" \"current\" {}\n+\n module \"endpoints\" {\n source = \"terraform-aws-modules/vpc/aws//modules/vpc-endpoints\"\n \n@@ -22,17 +24,18 @@ module \"endpoints\" {\n },\n dynamodb = {\n # gateway endpoint\n- service = \"dynamodb\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sns\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n- service = \"sqs\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sqs\"\n private_dns_enabled = true\n security_group_ids = [\"sg-987654321\"]\n subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/README.md\n@@ -7,6 +7,8 @@ Terraform sub-module which creates VPC endpoint resources on AWS.\n See [`examples`](../../examples) directory for working examples to reference:\n \n ```hcl\n+data \"aws_region\" \"current\" {}\n+\n module \"endpoints\" {\n source = \"terraform-aws-modules/vpc/aws//modules/vpc-endpoints\"\n \n@@ -22,17 +24,18 @@ module \"endpoints\" {\n },\n dynamodb = {\n # gateway endpoint\n- service = \"dynamodb\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sns\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n- service = \"sqs\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sqs\"\n private_dns_enabled = true\n security_group_ids = [\"sg-987654321\"]\n subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/README.md\n@@ -7,6 +7,8 @@ Terraform sub-module which creates VPC endpoint resources on AWS.\n See [`examples`](../../examples) directory for working examples to reference:\n \n ```hcl\n+data \"aws_region\" \"current\" {}\n+\n module \"endpoints\" {\n source = \"terraform-aws-modules/vpc/aws//modules/vpc-endpoints\"\n \n@@ -22,17 +24,18 @@ module \"endpoints\" {\n },\n dynamodb = {\n # gateway endpoint\n- service = \"dynamodb\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.dynamodb\"\n+ service_type \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sns\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n- service = \"sqs\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sqs\"\n private_dns_enabled = true\n security_group_ids = [\"sg-987654321\"]\n subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/README.md\n@@ -7,6 +7,8 @@ Terraform sub-module which creates VPC endpoint resources on AWS.\n See [`examples`](../../examples) directory for working examples to reference:\n \n ```hcl\n+data \"aws_region\" \"current\" {}\n+\n module \"endpoints\" {\n source = \"terraform-aws-modules/vpc/aws//modules/vpc-endpoints\"\n \n@@ -22,17 +24,18 @@ module \"endpoints\" {\n },\n dynamodb = {\n # gateway endpoint\n- service = \"dynamodb\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n dynamodb tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sns\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n- service = \"sqs\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sqs\"\n private_dns_enabled = true\n security_group_ids = [\"sg-987654321\"]\n subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n- update README of sub-module `vpc-endpoints`.\r\n\r\n## Motivation and Context\r\n- `private_dns_enabled` cannot be specified for S3 endpoint.\r\n\r\n## Breaking Changes\r\n- no\r\n\r\n## How Has This Been Tested?\r\n- README change only.\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n tags = { = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdd output for `dns_entry` of S3 endpoint.\r\n\r\n## Motivation and Context\r\nI was missing the output for my use case.\r\n\r\n## Breaking Changes\r\nI have not found anything broken. It is a simple addition in outputs, it **should** not break anything.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [X] I have tested the change against my own VPC. The output is correctly shown as shown below (details omitted), and I can use it in other resources in my Terragrunt code, as a dependency.\r\n\r\n```\r\nvpc_endpoint_s3_dns_entry = [\r\n {\r\n \"dns_name\" = \"*.vpce-XXX-YYY.s3.eu-west-1.vpce.amazonaws.com\"\r\n \"hosted_zone_id\" = \"ZZZ\"\r\n },\r\n {\r\n \"dns_name\" = \"*.vpce-XXX-YYY-eu-west-1b.s3.eu-west-1.vpce.amazonaws.com\"\r\n \"hosted_zone_id\" = \"ZZZ\"\r\n },\r\n {\r\n \"dns_name\" = \"*.vpce-XXX-YYY-eu-west-1a.s3.eu-west-1.vpce.amazonaws.com\"\r\n \"hosted_zone_id\" = \"ZZZ\"\r\n },\r\n {\r\n \"dns_name\" = \"*.vpce-XXX-YYY-eu-west-1c.s3.eu-west-1.vpce.amazonaws.com\"\r\n \"hosted_zone_id\" = \"ZZZ\"\r\n },\r\n]\r\n```\r\n\r\nThank you.\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -1182,6 +1182,7 @@ No modules.\n | [vpc\\_endpoint\\_rekognition\\_dns\\_entry](#output\\_vpc\\_endpoint\\_rekognition\\_dns\\_entry) | The DNS entries for the VPC Endpoint for Rekognition. |\n | [vpc\\_endpoint\\_rekognition\\_id](#output\\_vpc\\_endpoint\\_rekognition\\_id) | The ID of VPC endpoint for Rekognition |\n | [vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids](#output\\_vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids) | One or more network interfaces for the VPC Endpoint for Rekognition. |\n+| [vpc\\_endpoint\\_s3\\_dns\\_entry](#output\\_vpc\\_endpoint\\_s3\\_dns\\_entry) | The DNS entries for the VPC endpoint for S3. |\n | [vpc\\_endpoint\\_s3\\_id](#output\\_vpc\\_endpoint\\_s3\\_id) | The ID of VPC endpoint for S3 |\n | [vpc\\_endpoint\\_s3\\_pl\\_id](#output\\_vpc\\_endpoint\\_s3\\_pl\\_id) | The prefix list for the S3 VPC endpoint. |\n | [vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry](#output\\_vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry) | The DNS entries for the VPC Endpoint for SageMaker API. |\n---\noutputs.tf\n@@ -523,6 +523,11 @@ output \"vpc_endpoint_s3_pl_id\" {\n value = concat(aws_vpc_endpoint.s3.*.prefix_list_id, [\"\"])[0]\n }\n \n+output \"vpc_endpoint_s3_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for S3.\"\n+ value = flatten(aws_vpc_endpoint.s3.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_dynamodb_id\" {\n description = \"The ID of VPC endpoint for DynamoDB\"\n for = concat(aws_vpc_endpoint.dynamodb.*.id, [\"\"])[0]\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -1182,6 +1182,7 @@ No modules.\n | [vpc\\_endpoint\\_rekognition\\_dns\\_entry](#output\\_vpc\\_endpoint\\_rekognition\\_dns\\_entry) | The DNS entries for the VPC Endpoint for Rekognition. |\n | [vpc\\_endpoint\\_rekognition\\_id](#output\\_vpc\\_endpoint\\_rekognition\\_id) | The ID of VPC endpoint for Rekognition |\n | [vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids](#output\\_vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids) | One or more network interfaces for the VPC Endpoint for Rekognition. |\n+| [vpc\\_endpoint\\_s3\\_dns\\_entry](#output\\_vpc\\_endpoint\\_s3\\_dns\\_entry) | The DNS entries for the VPC endpoint for S3. |\n | [vpc\\_endpoint\\_s3\\_id](#output\\_vpc\\_endpoint\\_s3\\_id) | The ID of VPC endpoint for S3 |\n | [vpc\\_endpoint\\_s3\\_pl\\_id](#output\\_vpc\\_endpoint\\_s3\\_pl\\_id) | The prefix list for the S3 VPC endpoint. |\n | [vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry](#output\\_vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry) | The DNS entries for the VPC Endpoint for SageMaker API. |\n---\noutputs.tf\n@@ -523,6 +523,11 @@ output \"vpc_endpoint_s3_pl_id\" {\n value = concat(aws_vpc_endpoint.s3.*.prefix_list_id, [\"\"])[0]\n }\n \n+output \"vpc_endpoint_s3_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for S3.\"\n+ value description = flatten(aws_vpc_endpoint.s3.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_dynamodb_id\" {\n description = \"The ID of VPC endpoint for DynamoDB\"\n value = concat(aws_vpc_endpoint.dynamodb.*.id, [\"\"])[0]\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -1182,6 +1182,7 @@ No modules.\n | [vpc\\_endpoint\\_rekognition\\_dns\\_entry](#output\\_vpc\\_endpoint\\_rekognition\\_dns\\_entry) | The DNS entries for the VPC Endpoint for Rekognition. |\n | [vpc\\_endpoint\\_rekognition\\_id](#output\\_vpc\\_endpoint\\_rekognition\\_id) | The ID of VPC endpoint for Rekognition |\n | [vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids](#output\\_vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids) | One or more network interfaces for the VPC Endpoint for Rekognition. |\n+| [vpc\\_endpoint\\_s3\\_dns\\_entry](#output\\_vpc\\_endpoint\\_s3\\_dns\\_entry) | The DNS entries for the VPC endpoint for S3. |\n | [vpc\\_endpoint\\_s3\\_id](#output\\_vpc\\_endpoint\\_s3\\_id) | The ID of VPC endpoint for S3 |\n | [vpc\\_endpoint\\_s3\\_pl\\_id](#output\\_vpc\\_endpoint\\_s3\\_pl\\_id) | The prefix list for the S3 VPC endpoint. |\n | [vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry](#output\\_vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry) | The DNS entries for the VPC Endpoint for SageMaker API. |\n---\noutputs.tf\n@@ -523,6 +523,11 @@ output \"vpc_endpoint_s3_pl_id\" {\n value = concat(aws_vpc_endpoint.s3.*.prefix_list_id, [\"\"])[0]\n }\n \n+output \"vpc_endpoint_s3_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for S3.\"\n+ value = flatten(aws_vpc_endpoint.s3.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_dynamodb_id\" {\n description = \"The ID of VPC endpoint for DynamoDB\"\n value = concat(aws_vpc_endpoint.dynamodb.*.id, [\"\"])[0]\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -1182,6 +1182,7 @@ No modules.\n | [vpc\\_endpoint\\_rekognition\\_dns\\_entry](#output\\_vpc\\_endpoint\\_rekognition\\_dns\\_entry) | The DNS entries for the VPC Endpoint for Rekognition. |\n | [vpc\\_endpoint\\_rekognition\\_id](#output\\_vpc\\_endpoint\\_rekognition\\_id) | The ID of VPC endpoint for Rekognition |\n | [vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids](#output\\_vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids) | One or more network interfaces for the VPC Endpoint for Rekognition. |\n+| [vpc\\_endpoint\\_s3\\_dns\\_entry](#output\\_vpc\\_endpoint\\_s3\\_dns\\_entry) | The DNS entries for the VPC endpoint for S3. |\n | [vpc\\_endpoint\\_s3\\_id](#output\\_vpc\\_endpoint\\_s3\\_id) | The ID of VPC endpoint for S3 |\n | [vpc\\_endpoint\\_s3\\_pl\\_id](#output\\_vpc\\_endpoint\\_s3\\_pl\\_id) | The prefix list for the S3 VPC endpoint. |\n | [vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry](#output\\_vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry) | The DNS entries for the VPC Endpoint for SageMaker API. |\n---\noutputs.tf\n@@ -523,6 +523,11 @@ output \"vpc_endpoint_s3_pl_id\" {\n value = concat(aws_vpc_endpoint.s3.*.prefix_list_id, [\"\"])[0]\n }\n \n+output \"vpc_endpoint_s3_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint [vpc\\_endpoint\\_s3\\_pl\\_id](#output\\_vpc\\_endpoint\\_s3\\_pl\\_id) S3.\"\n+ value = flatten(aws_vpc_endpoint.s3.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_dynamodb_id\" {\n description = \"The ID of VPC endpoint for DynamoDB\"\n value = concat(aws_vpc_endpoint.dynamodb.*.id, [\"\"])[0]\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdd the availability of the rds-data api endpoint inside vpc\r\n\r\n## Motivation and Context\r\nI really need rds-data api in my projects\r\n\r\n## Breaking Changes\r\nNo breaking changes\r\n\r\n## How Has This Been Tested?\r\nTested locally\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -363,6 +363,7 @@ No modules.\n | [aws_vpc_endpoint.monitoring](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.qldb_session](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rds](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_vpc_endpoint.rds_data](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rekognition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.s3](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.sagemaker_api](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n@@ -719,6 +720,7 @@ No modules.\n | [enable\\_public\\_s3\\_endpoint](#input\\_enable\\_public\\_s3\\_endpoint) | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | [enable\\_qldb\\_session\\_endpoint](#input\\_enable\\_qldb\\_session\\_endpoint) | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_rds\\_endpoint](#input\\_enable\\_rds\\_endpoint) | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| [enable\\_rds\\_data\\_endpoint](#input\\_enable\\_rds\\_data\\_endpoint) | Should be true if you want to provision an RDS-DATA endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_rekognition\\_endpoint](#input\\_enable\\_rekognition\\_endpoint) | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_s3\\_endpoint](#input\\_enable\\_s3\\_endpoint) | Should be true if you want to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_sagemaker\\_api\\_endpoint](#input\\_enable\\_sagemaker\\_api\\_endpoint) | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -845,6 +847,9 @@ No modules.\n | [rds\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | [rds\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | [rds\\_endpoint\\_subnet\\_ids](#input\\_rds\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| [rds\\_data\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_data\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint | `bool` | `false` | no |\n+| [rds\\_data\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_data\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint | `list(string)` | `[]` | no |\n+| [rds\\_data\\_endpoint\\_subnet\\_ids](#input\\_rds\\_data\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | [redshift\\_acl\\_tags](#input\\_redshift\\_acl\\_tags) | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` omitted, no |\n | [redshift\\_dedicated\\_network\\_acl](#input\\_redshift\\_dedicated\\_network\\_acl) | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | [redshift\\_inbound\\_acl\\_rules](#input\\_redshift\\_inbound\\_acl\\_rules) | Redshift subnets inbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n---\nvariables.tf\n@@ -2081,6 +2081,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1456,6 +1456,28 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+###########################\n+# VPC Endpoint for RDS-DATA\n+###########################\n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -363,6 +363,7 @@ No modules.\n | [aws_vpc_endpoint.monitoring](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.qldb_session](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rds](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_vpc_endpoint.rds_data](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rekognition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.s3](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.sagemaker_api](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n@@ -719,6 +720,7 @@ No modules.\n | [enable\\_public\\_s3\\_endpoint](#input\\_enable\\_public\\_s3\\_endpoint) | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | [enable\\_qldb\\_session\\_endpoint](#input\\_enable\\_qldb\\_session\\_endpoint) | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_rds\\_endpoint](#input\\_enable\\_rds\\_endpoint) | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| [enable\\_rds\\_data\\_endpoint](#input\\_enable\\_rds\\_data\\_endpoint) | Should be true if you want to provision an RDS-DATA endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_rekognition\\_endpoint](#input\\_enable\\_rekognition\\_endpoint) | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_s3\\_endpoint](#input\\_enable\\_s3\\_endpoint) | Should be true if you in to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_sagemaker\\_api\\_endpoint](#input\\_enable\\_sagemaker\\_api\\_endpoint) | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -845,6 +847,9 @@ No modules.\n | [rds\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | [rds\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | [rds\\_endpoint\\_subnet\\_ids](#input\\_rds\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| [rds\\_data\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_data\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint | `bool` | `false` | no |\n+| [rds\\_data\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_data\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint | `list(string)` | `[]` | no |\n+| [rds\\_data\\_endpoint\\_subnet\\_ids](#input\\_rds\\_data\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | [redshift\\_acl\\_tags](#input\\_redshift\\_acl\\_tags) | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n | [redshift\\_dedicated\\_network\\_acl](#input\\_redshift\\_dedicated\\_network\\_acl) | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | [redshift\\_inbound\\_acl\\_rules](#input\\_redshift\\_inbound\\_acl\\_rules) | Redshift subnets inbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n---\nvariables.tf\n@@ -2081,6 +2081,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1456,6 +1456,28 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+###########################\n+# VPC Endpoint for RDS-DATA\n+###########################\n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -363,6 +363,7 @@ No modules.\n | [aws_vpc_endpoint.monitoring](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.qldb_session](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rds](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_vpc_endpoint.rds_data](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rekognition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.s3](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.sagemaker_api](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n@@ -719,6 +720,7 @@ No modules.\n | [enable\\_public\\_s3\\_endpoint](#input\\_enable\\_public\\_s3\\_endpoint) | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | [enable\\_qldb\\_session\\_endpoint](#input\\_enable\\_qldb\\_session\\_endpoint) | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_rds\\_endpoint](#input\\_enable\\_rds\\_endpoint) | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| [enable\\_rds\\_data\\_endpoint](#input\\_enable\\_rds\\_data\\_endpoint) | Should be true if more want to provision an RDS-DATA endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_rekognition\\_endpoint](#input\\_enable\\_rekognition\\_endpoint) | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_s3\\_endpoint](#input\\_enable\\_s3\\_endpoint) | Should be true if you want to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_sagemaker\\_api\\_endpoint](#input\\_enable\\_sagemaker\\_api\\_endpoint) | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -845,6 +847,9 @@ No modules.\n | [rds\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | [rds\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | [rds\\_endpoint\\_subnet\\_ids](#input\\_rds\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| [rds\\_data\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_data\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint | `bool` | `false` | no |\n+| [rds\\_data\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_data\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint | `list(string)` | `[]` | no |\n+| [rds\\_data\\_endpoint\\_subnet\\_ids](#input\\_rds\\_data\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | [redshift\\_acl\\_tags](#input\\_redshift\\_acl\\_tags) | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n | [redshift\\_dedicated\\_network\\_acl](#input\\_redshift\\_dedicated\\_network\\_acl) | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | [redshift\\_inbound\\_acl\\_rules](#input\\_redshift\\_inbound\\_acl\\_rules) | Redshift subnets inbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n---\nvariables.tf\n@@ -2081,6 +2081,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1456,6 +1456,28 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+###########################\n+# VPC Endpoint for RDS-DATA\n+###########################\n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -363,6 +363,7 @@ No modules.\n | [aws_vpc_endpoint.monitoring](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.qldb_session](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rds](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_vpc_endpoint.rds_data](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rekognition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.s3](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.sagemaker_api](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n@@ -719,6 +720,7 @@ No modules.\n | [enable\\_public\\_s3\\_endpoint](#input\\_enable\\_public\\_s3\\_endpoint) | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | [enable\\_qldb\\_session\\_endpoint](#input\\_enable\\_qldb\\_session\\_endpoint) | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_rds\\_endpoint](#input\\_enable\\_rds\\_endpoint) | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| [enable\\_rds\\_data\\_endpoint](#input\\_enable\\_rds\\_data\\_endpoint) | Should be true if you want to provision an RDS-DATA endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_rekognition\\_endpoint](#input\\_enable\\_rekognition\\_endpoint) | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_s3\\_endpoint](#input\\_enable\\_s3\\_endpoint) | Should be true if you want to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | [enable\\_sagemaker\\_api\\_endpoint](#input\\_enable\\_sagemaker\\_api\\_endpoint) | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -845,6 +847,9 @@ No modules.\n | [rds\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | [rds\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | [rds\\_endpoint\\_subnet\\_ids](#input\\_rds\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| [rds\\_data\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_data\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint | `bool` | `false` | no |\n+| [rds\\_data\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_data\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint | `list(string)` | `[]` | no |\n+| [rds\\_data\\_endpoint\\_subnet\\_ids](#input\\_rds\\_data\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | [redshift\\_acl\\_tags](#input\\_redshift\\_acl\\_tags) | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n | [redshift\\_dedicated\\_network\\_acl](#input\\_redshift\\_dedicated\\_network\\_acl) | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | [redshift\\_inbound\\_acl\\_rules](#input\\_redshift\\_inbound\\_acl\\_rules) | Redshift subnets inbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n---\nvariables.tf\n@@ -2081,6 +2081,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1456,6 +1456,28 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+###########################\n+# VPC Endpoint for RDS-DATA\n+###########################\n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nWhen the change of endpoint type was added to s3 and ddb - the routing was configured for most other subnet types but not database.\r\n\r\n## Motivation and Context\r\nAllows database instances to access S3 directly w/o going over egress paths \r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\nWe have tested this in a 500+ account deployment\r\n\r\n\n\n---\n\nChoice A:\nvpc-endpoints.tf\n@@ -35,6 +35,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n route_table_id = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_s3\" {\n count = var.create_vpc && var.enable_s3_endpoint && length(var.intra_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? 1 : 0\n \n@@ -86,6 +93,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n route_table_id = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_dynamodb\" {\n+ count = var.create_vpc && var.enable_dynamodb_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? && || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.dynamodb[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint && length(var.intra_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? 1 : 0\n \n---\n\n\n---\n\nChoice B:\nvpc-endpoints.tf\n@@ -35,6 +35,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n route_table_id = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_s3\" {\n count = var.create_vpc && var.enable_s3_endpoint && length(var.intra_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? 1 : 0\n \n@@ -86,6 +93,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n route_table_id = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_dynamodb\" {\n+ count = var.create_vpc && var.enable_dynamodb_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.dynamodb[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint && length(var.intra_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? 1 : 0\n \n---\n\n\n---\n\nChoice C:\nvpc-endpoints.tf\n@@ -35,6 +35,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_s3\" {\n count = var.create_vpc && var.enable_s3_endpoint && length(var.intra_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? 1 : 0\n \n@@ -86,6 +93,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n route_table_id = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_dynamodb\" {\n+ count = var.create_vpc && var.enable_dynamodb_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.dynamodb[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint && length(var.intra_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? 1 : 0\n \n---\n\n\n---\n\nChoice D:\nvpc-endpoints.tf\n@@ -35,6 0\n+\n+ @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n route_table_id = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_s3\" {\n count = var.create_vpc && var.enable_s3_endpoint && length(var.intra_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? 1 : 0\n \n@@ -86,6 +93,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n route_table_id = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_dynamodb\" {\n+ count = var.create_vpc && var.enable_dynamodb_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.dynamodb[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint && length(var.intra_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? 1 : 0\n \n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdding feature for configuring SSM VPC Endpoint policy.\r\n\r\n## Motivation and Context\r\nNeeded to manage SSM VPC Endpoint policy.\r\n\r\n## Breaking Changes\r\nNone.\r\n\r\n## How Has This Been Tested?\r\nTested locally.\n\n---\n\nChoice A:\nREADME.md\n@@ -705,6 +705,7 @@ No Modules.\n | sqs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SQS endpoint | `bool` | `false` | no |\n | sqs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SQS endpoint | `list(string)` | `[]` | no |\n | sqs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SQS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| ssm\\_endpoint\\_policy | A policy to attach to the endpoint that controls access to the service. Defaults to full access | `string` | `null` | no |\n | ssm\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint | `bool` | `false` | no |\n | ssm\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SSM endpoint | `list(string)` | `[]` | no |\n | ssm\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SSM endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nvariables.tf\n@@ -610,6 +610,12 @@ variable \"ssm_endpoint_subnet_ids\" {\n default = []\n }\n \n+variable \"ssm_endpoint_policy\" {\n+ description = \"A policy to attach to the endpoint that controls access to the service. Defaults to full access\"\n+ type = string\n+ default = null\n+}\n+\n variable \"ssm_endpoint_private_dns_enabled\" {\n description = \"Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -276,6 +276,7 @@ resource \"aws_vpc_endpoint\" \"ssm\" {\n \n security_group_ids = var.ssm_endpoint_security_group_ids\n subnet_ids = coalescelist(var.ssm_endpoint_subnet_ids, that policy = var.ssm_endpoint_policy\n private_dns_enabled = var.ssm_endpoint_private_dns_enabled\n tags = local.vpce_tags\n }\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -705,6 +705,7 @@ No Modules.\n | sqs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SQS endpoint | `bool` | `false` | no |\n | sqs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SQS endpoint | `list(string)` | `[]` | no |\n | sqs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SQS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| ssm\\_endpoint\\_policy | A policy to attach to the endpoint that controls access to the service. Defaults to full access | `string` | `null` | no |\n | ssm\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified for SSM endpoint | `bool` | `false` | no |\n | ssm\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SSM endpoint | `list(string)` | `[]` | no |\n | ssm\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SSM endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nvariables.tf\n@@ -610,6 +610,12 @@ variable \"ssm_endpoint_subnet_ids\" {\n default = []\n }\n \n+variable \"ssm_endpoint_policy\" {\n+ description = \"A policy to attach to the endpoint that controls access to the service. Defaults to full access\"\n+ type = string\n+ default = null\n+}\n+\n variable \"ssm_endpoint_private_dns_enabled\" {\n description = \"Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -276,6 +276,7 @@ resource \"aws_vpc_endpoint\" \"ssm\" {\n \n security_group_ids = var.ssm_endpoint_security_group_ids\n subnet_ids = coalescelist(var.ssm_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ policy = var.ssm_endpoint_policy\n private_dns_enabled = var.ssm_endpoint_private_dns_enabled\n tags = local.vpce_tags\n }\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -705,6 +705,7 @@ No Modules.\n | sqs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SQS endpoint | `bool` | `false` | no |\n | sqs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SQS endpoint | `list(string)` | `[]` | no |\n | sqs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SQS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| ssm\\_endpoint\\_policy | A policy to attach to the endpoint that controls access to the service. Defaults to full access | `string` | `null` | no |\n | ssm\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint | `bool` | `false` | no |\n | ssm\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SSM endpoint | `list(string)` | `[]` | no |\n | ssm\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SSM endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nvariables.tf\n@@ -610,6 +610,12 @@ variable \"ssm_endpoint_subnet_ids\" {\n default = []\n }\n \n+variable \"ssm_endpoint_policy\" {\n+ description = \"A policy to attach to the endpoint that controls access to the service. Defaults to full access\"\n+ type = string\n+ default = null\n+}\n+\n variable \"ssm_endpoint_private_dns_enabled\" {\n description = \"Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -276,6 +276,7 @@ resource | \"ssm\" {\n \n security_group_ids = var.ssm_endpoint_security_group_ids\n subnet_ids = coalescelist(var.ssm_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ policy = var.ssm_endpoint_policy\n private_dns_enabled = var.ssm_endpoint_private_dns_enabled\n tags = local.vpce_tags\n }\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -705,6 +705,7 @@ No Modules.\n | sqs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SQS endpoint | `bool` | `false` | no |\n | sqs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SQS endpoint | `list(string)` | `[]` | no |\n | sqs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SQS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| ssm\\_endpoint\\_policy | A policy to attach to the endpoint that controls access to the service. Defaults to full access | `string` | `null` | no |\n | ssm\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint | `bool` | `false` | no |\n | ssm\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SSM endpoint | `list(string)` | `[]` | no |\n | ssm\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SSM endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nvariables.tf\n@@ -610,6 +610,12 @@ variable \"ssm_endpoint_subnet_ids\" {\n default = []\n }\n \n+variable \"ssm_endpoint_policy\" {\n+ description = \"A policy to attach to the endpoint that controls access to the service. Defaults to full access\"\n+ type = string\n+ default = null\n+}\n+\n variable \"ssm_endpoint_private_dns_enabled\" {\n description = \"Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -276,6 +276,7 @@ resource \"aws_vpc_endpoint\" \"ssm\" {\n \n security_group_ids = var.ssm_endpoint_security_group_ids\n subnet_ids = coalescelist(var.ssm_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ policy = var.ssm_endpoint_policy\n private_dns_enabled = var.ssm_endpoint_private_dns_enabled\n tags = local.vpce_tags\n }\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThis PR adds optional S3 endpoint association with DB subnets route table.\r\n\r\n## Motivation and Context\r\nThis would help to enable communication from RDS placed in database subnets to S3 via S3 endpoint.\r\n\r\n## Breaking Changes\r\nN/A\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\nTested by creating VPC and validating changes. \r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -496,6 +496,7 @@ No Modules.\n | enable\\_codedeploy\\_endpoint | Should be true if you want to provision an CodeDeploy endpoint to the VPC | `bool` | `false` | no |\n | enable\\_codepipeline\\_endpoint | Should be true if you want to provision a CodePipeline endpoint to the VPC | `bool` | `false` | no |\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_database\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for database subnets | `bool` | `false` | to |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n | enable\\_dms\\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n---\nvariables.tf\n@@ -310,6 +310,12 @@ variable \"enable_public_s3_endpoint\" {\n type = bool\n }\n \n+variable \"enable_database_s3_endpoint\" {\n+ description = \"Whether to enable S3 VPC Endpoint for database subnets\"\n+ default = false\n+ type = bool\n+}\n+\n variable \"enable_dynamodb_endpoint\" {\n description = \"Should be true if you want to provision a DynamoDB endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -49,6 +49,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n route_table_id = aws_route_table.public[0].id\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.enable_database_s3_endpoint && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? local.nat_gateway_count : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, count.index)\n+}\n+\n ############################\n # VPC Endpoint for DynamoDB\n ############################\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -496,6 +496,7 @@ No Modules.\n | enable\\_codedeploy\\_endpoint | Should be true if you want to provision an CodeDeploy endpoint to the VPC | `bool` | `false` | no |\n | enable\\_codepipeline\\_endpoint | Should be true if you want to provision a CodePipeline endpoint to the VPC | `bool` | `false` | no |\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_database\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for database subnets | `bool` | `false` | no |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n | enable\\_dms\\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n---\nvariables.tf\n@@ -310,6 +310,12 @@ variable \"enable_public_s3_endpoint\" {\n type = bool\n }\n \n+variable \"enable_database_s3_endpoint\" {\n+ description = \"Whether to enable S3 VPC Endpoint for database subnets\"\n+ default = false\n+ type = bool\n+}\n+\n variable \"enable_dynamodb_endpoint\" {\n description = \"Should be true if you want to provision a DynamoDB endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -49,6 +49,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n route_table_id = aws_route_table.public[0].id\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.enable_database_s3_endpoint && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? local.nat_gateway_count : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, count.index)\n+}\n+\n ############################\n # VPC Endpoint for DynamoDB\n ############################\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -496,6 +496,7 @@ No Modules.\n | enable\\_codedeploy\\_endpoint | Should be true if you want to provision an CodeDeploy endpoint to the VPC | `bool` | `false` | no |\n | enable\\_codepipeline\\_endpoint | Should be true if you want to provision a CodePipeline endpoint to the VPC | `bool` | `false` | no |\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_database\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for database subnets | `bool` | `false` | no |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n | enable\\_dms\\_endpoint | Should be to if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n---\nvariables.tf\n@@ -310,6 +310,12 @@ variable \"enable_public_s3_endpoint\" {\n type = bool\n }\n \n+variable \"enable_database_s3_endpoint\" {\n+ description = \"Whether to enable S3 VPC Endpoint for database subnets\"\n+ default = false\n+ type = bool\n+}\n+\n variable \"enable_dynamodb_endpoint\" {\n description = \"Should be true if you want to provision a DynamoDB endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -49,6 +49,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n route_table_id = aws_route_table.public[0].id\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.enable_database_s3_endpoint && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? local.nat_gateway_count : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, count.index)\n+}\n+\n ############################\n # VPC Endpoint for DynamoDB\n ############################\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -496,6 +496,7 @@ No Modules.\n | enable\\_codedeploy\\_endpoint | Should be true if you want to provision an CodeDeploy endpoint to the VPC | `bool` | `false` | no |\n | enable\\_codepipeline\\_endpoint | Should be true if you want to provision a CodePipeline endpoint to the VPC | `bool` | `false` | no |\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_database\\_s3\\_endpoint | Whether var.enable_s3_endpoint enable S3 VPC Endpoint for database subnets | `bool` | `false` | no |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n | enable\\_dms\\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n---\nvariables.tf\n@@ -310,6 +310,12 @@ variable \"enable_public_s3_endpoint\" {\n type = bool\n }\n \n+variable \"enable_database_s3_endpoint\" {\n+ description = \"Whether to enable S3 VPC Endpoint for database subnets\"\n+ default = false\n+ type = bool\n+}\n+\n variable \"enable_dynamodb_endpoint\" {\n description = \"Should be true if you want to provision a DynamoDB endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -49,6 +49,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n route_table_id = aws_route_table.public[0].id\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.enable_database_s3_endpoint && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? local.nat_gateway_count : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, count.index)\n+}\n+\n ############################\n # VPC Endpoint for DynamoDB\n ############################\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n- align ci-cd static checks to use individual minimum Terraform versions\r\n\r\n## Motivation and Context\r\n- ensure that the modules are all following a similar workflow and the static checks that performed\r\n\r\n## Breaking Changes\r\n- No\r\n\r\n## How Has This Been Tested?\r\n- ci-cd static checks\n\n---\n\nChoice A:\n.github/workflows/pre-commit.yml\n@@ -7,55 +7,95 @@ on:\n - master\n \n jobs:\n- getBaseVersion:\n- name: Get min/max versions\n- runs-on: ubuntu-latest\n+# Min Terraform version(s)\n+ getDirectories:\n+ name: Get root directories\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Build matrix\n+ id: matrix\n+ run: |\n+ DIRS=$(python -c \"import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))\")\n+ echo \"::set-output name=directories::$DIRS\"\n+ outputs:\n+ directories: ${{ steps.matrix.outputs.directories }}\n \n+ preCommitMinVersions:\n+ name: Min TF validate\n+ needs: getDirectories\n+ runs-on: ubuntu-latest\n+ strategy:\n+ matrix:\n+ directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/terraform-min-max@v1.0.1\n+ with:\n+ directory: ${{ matrix.directory }}\n+ - name: Install Terraform v${{ steps.minMax.outputs.minVersion }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ steps.minMax.outputs.minVersion }}\n+ - name: Install pre-commit dependencies\n+ run: pip install pre-commit\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory != '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory == '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)\n+\n \n+# Max Terraform version\n+ getBaseVersion:\n+ name: Module max TF version\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/terraform-min-max@v1.0.1\n outputs:\n minVersion: ${{ steps.minMax.outputs.minVersion }}\n maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n \n- preCommit:\n- name: Pre-commit check\n+ preCommitMaxVersion:\n+ name: Max TF pre-commit\n runs-on: ubuntu-latest\n needs: getBaseVersion\n strategy:\n fail-fast: false\n matrix:\n version:\n- - ${{ needs.getBaseVersion.outputs.minVersion }}\n - ${{ needs.getBaseVersion.outputs.maxVersion }}\n-\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n-\n - name: Install Python\n uses: actions/setup-python@v2\n-\n - name: Install Terraform v${{ matrix.version }}\n uses: hashicorp/setup-terraform@v1\n with:\n terraform_version: ${{ matrix.version }}\n-\n - name: Install pre-commit dependencies\n run: |\n pip install pre-commit\n curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n-\n- - name: Execute pre-commit\n- # Run only validate pre-commit check on min version supported\n- if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n- run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n-\n - name: Execute pre-commit\n # Run all pre-commit checks on max version supported\n if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: git://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.46.0\n+ rev: v1.47.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.21 |\n+| terraform | >= 0.12.26 |\n | aws | >= 2.70 |\n | random | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.21\"\n+ required_version = \">= 0.12.26\"\n \n required_providers {\n aws = {\n---\n\n\n---\n\nChoice B:\n.github/workflows/pre-commit.yml\n@@ -7,55 +7,95 @@ on:\n - master\n \n jobs:\n- getBaseVersion:\n- name: Get min/max versions\n- runs-on: ubuntu-latest\n+# Min Terraform version(s)\n+ getDirectories:\n+ name: Get root directories\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Build matrix\n+ id: matrix\n+ run: |\n+ DIRS=$(python -c \"import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))\")\n+ echo \"::set-output name=directories::$DIRS\"\n+ outputs:\n+ directories: ${{ steps.matrix.outputs.directories }}\n \n+ preCommitMinVersions:\n+ name: Min TF validate\n+ needs: getDirectories\n+ runs-on: ubuntu-latest\n+ strategy:\n+ matrix:\n+ directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/terraform-min-max@v1.0.1\n+ with:\n+ directory: ${{ matrix.directory }}\n+ - name: Install Terraform v${{ steps.minMax.outputs.minVersion }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ steps.minMax.outputs.minVersion }}\n+ - name: Install pre-commit dependencies\n+ run: pip install pre-commit\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory != '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory == '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)\n+\n \n+# Max Terraform version\n+ getBaseVersion:\n+ name: Module max TF version\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/terraform-min-max@v1.0.1\n outputs:\n minVersion: ${{ steps.minMax.outputs.minVersion }}\n maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n \n- preCommit:\n- name: Pre-commit check\n+ preCommitMaxVersion:\n+ name: Max TF pre-commit\n runs-on: ubuntu-latest\n needs: getBaseVersion\n strategy:\n fail-fast: false\n matrix:\n version:\n- - ${{ needs.getBaseVersion.outputs.minVersion }}\n - ${{ needs.getBaseVersion.outputs.maxVersion }}\n-\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n-\n - name: Install Python\n uses: actions/setup-python@v2\n-\n - name: Install Terraform v${{ matrix.version }}\n uses: hashicorp/setup-terraform@v1\n with:\n terraform_version: ${{ matrix.version }}\n-\n - name: Install pre-commit dependencies\n run: |\n pip install pre-commit\n curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n-\n- - name: Execute pre-commit\n- # Run only validate pre-commit check on min version supported\n- if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n- run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n-\n - name: Execute pre-commit\n # Run all pre-commit checks on max version supported\n if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: git://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.46.0\n+ rev: v1.47.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.21 |\n+| terraform | >= 0.12.26 |\n | aws | >= 2.70 |\n | random | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.21\"\n+ required_version = \">= 0.12.26\"\n \n required_providers {\n aws = {\n---\n\n\n---\n\nChoice C:\n.github/workflows/pre-commit.yml\n@@ -7,55 +7,95 @@ on:\n - master\n \n jobs:\n- getBaseVersion:\n- name: Get min/max versions\n- runs-on: ubuntu-latest\n+# Min Terraform version(s)\n+ getDirectories:\n+ name: Get root directories\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Build matrix\n+ id: matrix\n+ run: |\n+ DIRS=$(python -c \"import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))\")\n+ echo \"::set-output name=directories::$DIRS\"\n+ outputs:\n+ directories: ${{ steps.matrix.outputs.directories }}\n \n+ preCommitMinVersions:\n+ name: Min TF validate\n+ needs: getDirectories\n+ runs-on: ubuntu-latest\n+ strategy:\n+ matrix:\n+ directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/terraform-min-max@v1.0.1\n+ with:\n+ directory: ${{ matrix.directory }}\n+ - name: Install Terraform v${{ steps.minMax.outputs.minVersion }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ steps.minMax.outputs.minVersion }}\n+ - name: Install pre-commit dependencies\n+ run: pip install pre-commit\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory != '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory == '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)\n+\n \n+# Max Terraform version\n+ getBaseVersion:\n+ name: Module max TF version\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/terraform-min-max@v1.0.1\n outputs:\n minVersion: ${{ steps.minMax.outputs.minVersion }}\n maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n \n- preCommit:\n- name: Pre-commit check\n+ preCommitMaxVersion:\n+ name: Max TF pre-commit\n runs-on: ubuntu-latest\n needs: getBaseVersion\n strategy:\n fail-fast: false\n matrix:\n version:\n- - ${{ needs.getBaseVersion.outputs.minVersion }}\n - ${{ needs.getBaseVersion.outputs.maxVersion }}\n-\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n-\n - name: Install Python\n uses: actions/setup-python@v2\n-\n - name: Install Terraform v${{ matrix.version }}\n uses: hashicorp/setup-terraform@v1\n with:\n terraform_version: ${{ matrix.version }}\n-\n - name: Install pre-commit dependencies\n run: |\n pip install pre-commit\n curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n-\n- - name: Execute pre-commit\n- # Run only validate pre-commit check on min version supported\n- if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n- run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n-\n - name: Execute pre-commit\n # Run all pre-commit checks on max version supported\n if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: git://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.46.0\n+ rev: v1.47.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.21 |\n+| terraform | >= 0.12.26 |\n | aws | >= 2.70 |\n | random | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.21\"\n+ required_version = \">= 0.12.26\"\n \n required_providers {\n aws = {\n---\n\n\n---\n\nChoice D:\n.github/workflows/pre-commit.yml\n@@ -7,55 +7,95 @@ on:\n - master\n \n jobs:\n- getBaseVersion:\n- name: Get min/max versions\n- runs-on: ubuntu-latest\n+# Min Terraform version(s)\n+ getDirectories:\n+ name: Get root directories\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Build matrix\n+ id: matrix\n+ run: |\n+ DIRS=$(python -c \"import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))\")\n+ echo \"::set-output name=directories::$DIRS\"\n+ outputs:\n+ directories: ${{ steps.matrix.outputs.directories }}\n \n+ preCommitMinVersions:\n+ name: Min TF validate\n+ needs: getDirectories\n+ runs-on: ubuntu-latest\n+ strategy:\n+ matrix:\n+ directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/terraform-min-max@v1.0.1\n+ with:\n+ directory: ${{ matrix.directory }}\n+ - name: Install Terraform v${{ steps.minMax.outputs.minVersion }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ steps.minMax.outputs.minVersion }}\n+ - name: Install pre-commit dependencies\n+ run: pip install pre-commit\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory != '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*\n+ json; - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory == '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)\n+\n \n+# Max Terraform version\n+ getBaseVersion:\n+ name: Module max TF version\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/terraform-min-max@v1.0.1\n outputs:\n minVersion: ${{ steps.minMax.outputs.minVersion }}\n maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n \n- preCommit:\n- name: Pre-commit check\n+ preCommitMaxVersion:\n+ name: Max TF pre-commit\n runs-on: ubuntu-latest\n needs: getBaseVersion\n strategy:\n fail-fast: false\n matrix:\n version:\n- - ${{ needs.getBaseVersion.outputs.minVersion }}\n - ${{ needs.getBaseVersion.outputs.maxVersion }}\n-\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n-\n - name: Install Python\n uses: actions/setup-python@v2\n-\n - name: Install Terraform v${{ matrix.version }}\n uses: hashicorp/setup-terraform@v1\n with:\n terraform_version: ${{ matrix.version }}\n-\n - name: Install pre-commit dependencies\n run: |\n pip install pre-commit\n curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n-\n- - name: Execute pre-commit\n- # Run only validate pre-commit check on min version supported\n- if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n- run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n-\n - name: Execute pre-commit\n # Run all pre-commit checks on max version supported\n if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: git://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.46.0\n+ rev: v1.47.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.21 |\n+| terraform | >= 0.12.26 |\n | aws | >= 2.70 |\n | random | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.21\"\n+ required_version = \">= 0.12.26\"\n \n required_providers {\n aws = {\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n- add default route table resource to manage default route table, its tags, routes, etc.\r\n- update complete vpc example to show/validate changes here for managing the default route table \r\n- `vpc_endpoint_id` was left out of the `route` config block because it was only recently added in v3.15.0 of the AWS provider and it will throw errors if the min version is not set to that. we can re-enable this later on when the min version bump is justified\r\n\r\n## Motivation and Context\r\n- adds the ability to tag and manage the default (`main`) route table of the VPC created\r\n\r\nThese changes supersedes the following PRs:\r\nCloses #545 \r\nCloses #147\r\n\r\n## Breaking Changes\r\n- No\r\n\r\n## How Has This Been Tested?\r\n- Checkout `master` locally and ensure its up to date/current\r\n- `cd examples/complete-vpc && terraform init && terraform apply` -> sets baseline\r\n- Checkout these changes locally\r\n- `terraform apply` -> manages default route table and sets the tags, etc.\r\n\r\nNote - I also tested going from `master` to this change set without any changes added to the example project and the plan came back clean meaning backwards compatibility is preserved\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -249,6 +249,7 @@ No Modules.\n | [aws_customer_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/customer_gateway) |\n | [aws_db_subnet_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_subnet_group) |\n | [aws_default_network_acl](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_network_acl) |\n+| [aws_default_route_table](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table) |\n | [aws_default_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group) |\n | [aws_default_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) |\n | [aws_egress_only_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/egress_only_internet_gateway) |\n@@ -385,6 +386,9 @@ No Modules.\n | default\\_network\\_acl\\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | default\\_network\\_acl\\_name | Name to be used on the Default Network ACL | `string` | `\"\"` | no |\n | default\\_network\\_acl\\_tags | Additional tags for the Default Network ACL | `map(string)` | `{}` | no |\n+| default\\_route\\_table\\_propagating\\_vgws | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n+| default\\_route\\_table\\_routes | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| default\\_route\\_table\\_tags | Additional tags for the default route table | `map(string)` | `{}` | no |\n | default\\_security\\_group\\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_name | Name to be used on the default security group | `string` | `\"default\"` | no |\n@@ -603,6 +607,7 @@ No Modules.\n | logs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for CloudWatch Logs endpoint | `list(string)` | `[]` | no |\n | logs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for CloudWatch Logs endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | manage\\_default\\_network\\_acl | Should be true to adopt and manage Default Network ACL | `bool` | `false` | no |\n+| manage\\_default\\_route\\_table | Should be true to manage default route table | `bool` | `false` | no |\n | manage\\_default\\_security\\_group | Should be true to adopt and manage default security group | `bool` | `false` | no |\n | manage\\_default\\_vpc | Should be true to adopt and manage Default VPC | `bool` | `false` | no |\n | map\\_public\\_ip\\_on\\_launch | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -24,6 +24,9 @@ module \"vpc\" {\n \n create_database_subnet_group = false\n \n+ manage_default_route_table = true\n+ default_route_table_tags = { DefaultRouteTable = true }\n+\n enable_dns_hostnames = true\n enable_dns_support = true\n \n---\nmain.tf\n@@ -160,6 +160,43 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n )\n }\n \n+###############\n+# Default route\n+###############\n+\n+resource \"aws_default_route_table\" \"default\" {\n+ count = var.create_vpc && var.manage_default_route_table ? 1 : 0\n+\n+ default_route_table_id = aws_vpc.this[0].default_route_table_id\n+ propagating_vgws = var.default_route_table_propagating_vgws\n+\n+ dynamic \"route\" {\n+ for_each = var.default_route_table_routes\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id `list(map(string))` = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ # `vpc_endpoint_id` was recently added in v3.15.0\n+ # vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n+ tags = merge(\n+ { \"Name\" = var.name },\n+ var.tags,\n+ var.default_route_table_tags,\n+ )\n+}\n+\n ################\n # Publi\u0441 routes\n ################\n---\nvariables.tf\n@@ -2213,6 +2213,30 @@ variable \"propagate_public_route_tables_vgw\" {\n default = false\n }\n \n+variable \"manage_default_route_table\" {\n+ description = \"Should be true to manage default route table\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"default_route_table_propagating_vgws\" {\n+ description = \"List of virtual gateways for propagation\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"default_route_table_routes\" {\n+ description = \"Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"default_route_table_tags\" {\n+ description = \"Additional tags for the default route table\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add to all resources\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -249,6 +249,7 @@ No Modules.\n | [aws_customer_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/customer_gateway) |\n | [aws_db_subnet_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_subnet_group) |\n | [aws_default_network_acl](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_network_acl) |\n+| [aws_default_route_table](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table) |\n | [aws_default_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group) |\n | [aws_default_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) |\n | [aws_egress_only_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/egress_only_internet_gateway) |\n@@ -385,6 +386,9 @@ No Modules.\n | default\\_network\\_acl\\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | default\\_network\\_acl\\_name | Name to be used on the Default Network ACL | `string` | `\"\"` | no |\n | default\\_network\\_acl\\_tags | Additional tags for the Default Network ACL | `map(string)` | `{}` | no |\n+| default\\_route\\_table\\_propagating\\_vgws | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n+| default\\_route\\_table\\_routes | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| default\\_route\\_table\\_tags | Additional tags for the default route table | `map(string)` | `{}` | no |\n | default\\_security\\_group\\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_name | Name to be used on the default security group | `string` | `\"default\"` | no |\n@@ -603,6 +607,7 @@ No Modules.\n | logs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for CloudWatch Logs endpoint | `list(string)` | `[]` | no |\n | logs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for CloudWatch Logs endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | manage\\_default\\_network\\_acl | Should be true to adopt and manage Default Network ACL | `bool` | `false` | no |\n+| manage\\_default\\_route\\_table | Should be true to manage default route table | `bool` | `false` | no |\n | manage\\_default\\_security\\_group | Should be true to adopt and manage default security group | `bool` | `false` | no |\n | manage\\_default\\_vpc | Should be true to adopt and manage Default VPC | `bool` | `false` | no |\n | map\\_public\\_ip\\_on\\_launch | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -24,6 +24,9 @@ module \"vpc\" {\n \n create_database_subnet_group = false\n \n+ manage_default_route_table = true\n+ default_route_table_tags = { DefaultRouteTable = true }\n+\n enable_dns_hostnames = true\n enable_dns_support = true\n \n---\nmain.tf\n@@ -160,6 +160,43 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n )\n }\n \n+###############\n+# Default route\n+###############\n+\n+resource \"aws_default_route_table\" \"default\" {\n+ count = var.create_vpc && var.manage_default_route_table ? 1 : 0\n+\n+ default_route_table_id = aws_vpc.this[0].default_route_table_id\n+ propagating_vgws = var.default_route_table_propagating_vgws\n+\n+ dynamic \"route\" {\n+ for_each = var.default_route_table_routes\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ # `vpc_endpoint_id` was recently added in v3.15.0\n+ # vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n+ tags = merge(\n+ { \"Name\" = var.name },\n+ var.tags,\n+ var.default_route_table_tags,\n+ )\n+}\n+\n ################\n # Publi\u0441 routes\n ################\n---\nvariables.tf\n@@ -2213,6 +2213,30 @@ variable \"propagate_public_route_tables_vgw\" {\n default = false\n }\n \n+variable \"manage_default_route_table\" {\n+ description = \"Should be true to manage default route table\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"default_route_table_propagating_vgws\" {\n+ description = \"List of virtual gateways for propagation\"\n+ the type = list(string)\n+ default = []\n+}\n+\n+variable \"default_route_table_routes\" {\n+ description = \"Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"default_route_table_tags\" {\n+ description = \"Additional tags for the default route table\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add to all resources\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -249,6 +249,7 @@ No Modules.\n | [aws_customer_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/customer_gateway) |\n | [aws_db_subnet_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_subnet_group) |\n | [aws_default_network_acl](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_network_acl) |\n+| [aws_default_route_table](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table) |\n | [aws_default_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group) |\n | [aws_default_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) |\n | [aws_egress_only_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/egress_only_internet_gateway) |\n@@ -385,6 +386,9 @@ No Modules.\n | default\\_network\\_acl\\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | default\\_network\\_acl\\_name | Name to be used on the Default Network ACL | `string` | `\"\"` | no |\n | default\\_network\\_acl\\_tags | Additional tags for the Default Network ACL | `map(string)` | `{}` | no |\n+| default\\_route\\_table\\_propagating\\_vgws | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n+| default\\_route\\_table\\_routes | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| default\\_route\\_table\\_tags | Additional tags for the default route table | `map(string)` | `{}` | no |\n | default\\_security\\_group\\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_name | Name to be used on the default security group | `string` | `\"default\"` | no |\n@@ -603,6 +607,7 @@ No Modules.\n | logs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for CloudWatch Logs endpoint | `list(string)` | `[]` | no |\n | logs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for CloudWatch Logs endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | manage\\_default\\_network\\_acl | Should be true to adopt and manage Default Network ACL | `bool` | `false` | no |\n+| manage\\_default\\_route\\_table | Should be true to manage default route table | `bool` | `false` | no |\n | manage\\_default\\_security\\_group | Should be true to adopt and manage default security group | `bool` | `false` | no |\n | manage\\_default\\_vpc | Should be true to adopt and manage Default VPC | `bool` | `false` | no |\n | map\\_public\\_ip\\_on\\_launch | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -24,6 +24,9 @@ module \"vpc\" {\n \n create_database_subnet_group = false\n \n+ manage_default_route_table = true\n+ default_route_table_tags = { DefaultRouteTable = true }\n+\n enable_dns_hostnames = true\n enable_dns_support = true\n \n---\nmain.tf\n@@ -160,6 +160,43 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n )\n }\n \n+###############\n+# Default route\n+###############\n+\n+resource \"aws_default_route_table\" \"default\" {\n+ count = var.create_vpc && var.manage_default_route_table ? 1 : 0\n+\n+ default_route_table_id = aws_vpc.this[0].default_route_table_id\n+ propagating_vgws = var.default_route_table_propagating_vgws\n+\n+ dynamic \"route\" {\n+ for_each = var.default_route_table_routes\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ # `vpc_endpoint_id` was recently added in v3.15.0\n+ # vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n+ tags = merge(\n+ { \"Name\" = var.name },\n+ var.tags,\n+ var.default_route_table_tags,\n+ )\n+}\n+\n ################\n # Publi\u0441 routes\n ################\n---\nvariables.tf\n@@ -2213,6 +2213,30 @@ variable \"propagate_public_route_tables_vgw\" {\n default = false\n }\n \n+variable \"manage_default_route_table\" {\n+ description = \"Should be true to manage default route table\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"default_route_table_propagating_vgws\" {\n+ description = \"List of virtual gateways for propagation\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"default_route_table_routes\" {\n+ description = \"Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"default_route_table_tags\" {\n+ description = \"Additional tags for the default route table\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add to all resources\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -249,6 +249,7 @@ No Modules.\n | [aws_customer_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/customer_gateway) |\n | [aws_db_subnet_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_subnet_group) |\n | [aws_default_network_acl](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_network_acl) |\n+| [aws_default_route_table](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table) |\n | [aws_default_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group) |\n | [aws_default_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) |\n | [aws_egress_only_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/egress_only_internet_gateway) |\n@@ -385,6 +386,9 @@ No Modules.\n | default\\_network\\_acl\\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | default\\_network\\_acl\\_name | Name to be used on the Default Network ACL | `string` | `\"\"` | no |\n | default\\_network\\_acl\\_tags | Additional tags for the Default Network ACL {}\n+}\n+\n `map(string)` | `{}` | no |\n+| default\\_route\\_table\\_propagating\\_vgws | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n+| default\\_route\\_table\\_routes | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| default\\_route\\_table\\_tags | Additional tags for the default route table | `map(string)` | `{}` | no |\n | default\\_security\\_group\\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_name | Name to be used on the default security group | `string` | `\"default\"` | no |\n@@ -603,6 +607,7 @@ No Modules.\n | logs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for CloudWatch Logs endpoint | `list(string)` | `[]` | no |\n | logs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for CloudWatch Logs endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | manage\\_default\\_network\\_acl | Should be true to adopt and manage Default Network ACL | `bool` | `false` | no |\n+| manage\\_default\\_route\\_table | Should be true to manage default route table | `bool` | `false` | no |\n | manage\\_default\\_security\\_group | Should be true to adopt and manage default security group | `bool` | `false` | no |\n | manage\\_default\\_vpc | Should be true to adopt and manage Default VPC | `bool` | `false` | no |\n | map\\_public\\_ip\\_on\\_launch | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -24,6 +24,9 @@ module \"vpc\" {\n \n create_database_subnet_group = false\n \n+ manage_default_route_table = true\n+ default_route_table_tags = { DefaultRouteTable = true }\n+\n enable_dns_hostnames = true\n enable_dns_support = true\n \n---\nmain.tf\n@@ -160,6 +160,43 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n )\n }\n \n+###############\n+# Default route\n+###############\n+\n+resource \"aws_default_route_table\" \"default\" {\n+ count = var.create_vpc && var.manage_default_route_table ? 1 : 0\n+\n+ default_route_table_id = aws_vpc.this[0].default_route_table_id\n+ propagating_vgws = var.default_route_table_propagating_vgws\n+\n+ dynamic \"route\" {\n+ for_each = var.default_route_table_routes\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ # `vpc_endpoint_id` was recently added in v3.15.0\n+ # vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n+ tags = merge(\n+ { \"Name\" = var.name },\n+ var.tags,\n+ var.default_route_table_tags,\n+ )\n+}\n+\n ################\n # Publi\u0441 routes\n ################\n---\nvariables.tf\n@@ -2213,6 +2213,30 @@ variable \"propagate_public_route_tables_vgw\" {\n default = false\n }\n \n+variable \"manage_default_route_table\" {\n+ description = \"Should be true to manage default route table\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"default_route_table_propagating_vgws\" {\n+ description = \"List of virtual gateways for propagation\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"default_route_table_routes\" {\n+ description = \"Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"default_route_table_tags\" {\n+ description = \"Additional tags for the default route table\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add to all resources\"\n type = map(string)\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n- add ci-cd workflow for pre-commit checks; replacing ci-cd configuration files for CircleCI \r\n\r\n## Motivation and Context\r\n- provide static checks for pull requests\r\n\r\n## Breaking Changes\r\n- no\r\n\r\n## How Has This Been Tested?\r\n- copy of what is implemented in SQS module repository\r\n\n\n---\n\nChoice A:\n.circleci/config.yml\n@@ -1,44 +0,0 @@\n-version: 2\n-\n-terraform: &terraform\n- docker:\n- - image: hashicorp/terraform:0.12.21\n- working_directory: /tmp/workspace/terraform\n-\n-jobs:\n- validate:\n- <<: *terraform\n- steps:\n- - checkout\n-# - run:\n-# name: Add github.com to ~/.ssh/known_hosts\n-# command: mkdir ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts\n- - run:\n- name: terraform init\n- command: find . -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform init -input=false -backend=false) || exit 1; done\n- - run:\n- name: Validate Terraform configurations\n- command: find . -name \".terraform\" -prune -o -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform validate && echo \"\u221a $m\") || exit 1 ; done\n- environment:\n- AWS_DEFAULT_REGION: us-east-1\n- - run:\n- name: Check if Terraform configurations are properly formatted\n- command: if [[ -n \"$(terraform fmt -write=false)\" ]]; then echo \"Some terraform files need be formatted, run 'terraform fmt' to fix\"; exit 1; fi\n- - run:\n- name: Install tflint\n- command: wget -O /tmp/tflint.zip https://github.com/wata727/tflint/releases/download/v0.20.2/tflint_linux_amd64.zip && unzip /tmp/tflint.zip -d /usr/local/bin\n- - run:\n- name: Check Terraform configurations with tflint\n- command: tflint\n- - persist_to_workspace:\n- root: .\n- paths: .\n-\n-workflows:\n- version: 2\n- build:\n- jobs:\n- - validate\n-# - plan_examples\n-# - approve\n-# - release\n---\n.github/workflows/pre-commit.yml\n@@ -0,0 +1,62 @@\n+name: Pre-Commit\n+\n+on:\n+ terraform pull_request:\n+ push:\n+ branches:\n+ - master\n+\n+jobs:\n+ getBaseVersion:\n+ name: Get min/max versions\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/terraform-min-max@v1.0.1\n+ outputs:\n+ minVersion: ${{ steps.minMax.outputs.minVersion }}\n+ maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n+\n+ preCommit:\n+ name: Pre-commit check\n+ runs-on: ubuntu-latest\n+ needs: getBaseVersion\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ version:\n+ - ${{ needs.getBaseVersion.outputs.minVersion }}\n+ - ${{ needs.getBaseVersion.outputs.maxVersion }}\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+\n+ - name: Install Terraform v${{ matrix.version }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ matrix.version }}\n+\n+ - name: Install pre-commit dependencies\n+ run: |\n+ pip install pre-commit\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n+\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n+\n+ - name: Execute pre-commit\n+ # Run all pre-commit checks on max version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files\n---\n\n\n---\n\nChoice B:\n.circleci/config.yml\n@@ -1,44 +0,0 @@\n-version: 2\n-\n-terraform: &terraform\n- docker:\n- - image: hashicorp/terraform:0.12.21\n- working_directory: /tmp/workspace/terraform\n-\n-jobs:\n- validate:\n- <<: *terraform\n- steps:\n- - checkout\n-# - run:\n-# name: Add github.com to ~/.ssh/known_hosts\n-# command: mkdir ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts\n- - run:\n- name: terraform init\n- command: find . -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform init -input=false -backend=false) || exit 1; done\n- - run:\n- name: Validate Terraform configurations\n- command: find . -name \".terraform\" -prune -o -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform validate && echo \"\u221a $m\") || exit 1 ; done\n- environment:\n- AWS_DEFAULT_REGION: us-east-1\n- - run:\n- name: Check if Terraform configurations are properly formatted\n- command: if [[ -n \"$(terraform fmt -write=false)\" ]]; then echo \"Some terraform files need be formatted, run 'terraform fmt' to fix\"; exit 1; fi\n- - run:\n- name: Install tflint\n- command: wget -O /tmp/tflint.zip https://github.com/wata727/tflint/releases/download/v0.20.2/tflint_linux_amd64.zip && unzip /tmp/tflint.zip -d /usr/local/bin\n- - run:\n- name: Check Terraform configurations with tflint\n- command: tflint\n- - persist_to_workspace:\n- root: .\n- paths: .\n-\n-workflows:\n- version: 2\n- build:\n- jobs:\n- - validate\n-# - plan_examples\n-# - approve\n-# - release\n---\n.github/workflows/pre-commit.yml\n@@ -0,0 +1,62 @@\n+name: Pre-Commit\n+\n+on:\n+ pull_request:\n+ push:\n+ branches:\n+ - master\n+\n+jobs:\n+ getBaseVersion:\n+ name: Get min/max versions\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/terraform-min-max@v1.0.1\n+ outputs:\n+ minVersion: ${{ steps.minMax.outputs.minVersion }}\n+ maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n+\n+ preCommit:\n+ name: Pre-commit check\n+ runs-on: ubuntu-latest\n+ needs: getBaseVersion\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ version:\n+ - ${{ needs.getBaseVersion.outputs.minVersion }}\n+ - ${{ needs.getBaseVersion.outputs.maxVersion }}\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+\n+ - name: Install Terraform v${{ matrix.version }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ matrix.version }}\n+\n+ - name: Install pre-commit dependencies\n+ run: |\n+ pip install pre-commit\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n+\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n+\n+ - name: Execute pre-commit\n+ # Run all pre-commit checks on max version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files\n---\n\n\n---\n\nChoice C:\n.circleci/config.yml\n@@ -1,44 +0,0 @@\n-version: 2\n-\n-terraform: &terraform\n- docker:\n- - image: hashicorp/terraform:0.12.21\n- working_directory: /tmp/workspace/terraform\n-\n-jobs:\n- validate:\n- <<: *terraform\n- steps:\n- - checkout\n-# - run:\n-# name: Add github.com to ~/.ssh/known_hosts\n-# command: mkdir ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts\n- - run:\n- name: terraform init\n- command: find . -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform init -input=false -backend=false) || exit 1; done\n- - run:\n- name: Validate Terraform configurations\n- command: find . -name \".terraform\" -prune -o -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform validate && echo \"\u221a $m\") || exit 1 ; done\n- environment:\n- AWS_DEFAULT_REGION: us-east-1\n- - run:\n- name: Check if Terraform configurations are properly formatted\n- command: if [[ -n \"$(terraform fmt -write=false)\" ]]; then echo \"Some terraform files need be formatted, run 'terraform fmt' to fix\"; exit 1; fi\n- - run:\n- name: Install tflint\n- command: wget -O /tmp/tflint.zip https://github.com/wata727/tflint/releases/download/v0.20.2/tflint_linux_amd64.zip && unzip /tmp/tflint.zip -d /usr/local/bin\n- - run:\n- name: Check Terraform configurations with tflint\n- command: tflint\n- - persist_to_workspace:\n- root: .\n- paths: .\n-\n-workflows:\n- version: 2\n- build:\n- jobs:\n- - validate\n-# - plan_examples\n-# - approve\n-# - release\n---\n.github/workflows/pre-commit.yml\n@@ -0,0 +1,62 @@\n+name: Pre-Commit\n+\n+on:\n+ pull_request:\n+ push:\n+ branches:\n+ - master\n+\n+jobs:\n+ getBaseVersion:\n+ name: Get min/max versions\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/terraform-min-max@v1.0.1\n+ outputs:\n+ minVersion: ${{ steps.minMax.outputs.minVersion }}\n+ maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n+\n+ preCommit:\n+ name: Pre-commit check\n+ runs-on: ubuntu-latest\n+ needs: getBaseVersion\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ version:\n+ - ${{ needs.getBaseVersion.outputs.minVersion }}\n+ - ${{ needs.getBaseVersion.outputs.maxVersion }}\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+\n+ - name: Install Terraform v${{ matrix.version }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ matrix.version }}\n+\n+ - name: Install pre-commit dependencies\n+ run: |\n+ pip install pre-commit\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n+\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n+\n+ - name: Execute pre-commit\n+ # Run all pre-commit checks on max version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files\n---\n\n\n---\n\nChoice D:\n.circleci/config.yml\n@@ -1,44 +0,0 @@\n-version: 2\n-\n-terraform: &terraform\n- docker:\n- - image: hashicorp/terraform:0.12.21\n- working_directory: /tmp/workspace/terraform\n-\n-jobs:\n- validate:\n- <<: *terraform\n- steps:\n- - checkout\n-# - run:\n-# name: Add github.com to ~/.ssh/known_hosts\n-# command: mkdir ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts\n- - run:\n- name: terraform init\n- command: find . -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform init -input=false -backend=false) || exit 1; done\n- - run:\n- name: Validate Terraform configurations\n- command: find . -name \".terraform\" -prune -o -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform validate && echo \"\u221a $m\") || exit 1 ; done\n- environment:\n- AWS_DEFAULT_REGION: us-east-1\n- - run:\n- name: Check if Terraform configurations are properly formatted\n- command: if [[ -n \"$(terraform fmt -write=false)\" ]]; then echo \"Some terraform files need be formatted, run 'terraform fmt' to fix\"; exit 1; fi\n- - run:\n- name: Install tflint\n- command: wget -O /tmp/tflint.zip https://github.com/wata727/tflint/releases/download/v0.20.2/tflint_linux_amd64.zip && unzip /tmp/tflint.zip -d /usr/local/bin\n- - run:\n- name: Check Terraform configurations with tflint\n- command: tflint\n- - persist_to_workspace:\n- root: .\n- paths: .\n-\n-workflows:\n- version: 2\n- -d build:\n- jobs:\n- - validate\n-# - plan_examples\n-# - approve\n-# - release\n---\n.github/workflows/pre-commit.yml\n@@ -0,0 +1,62 @@\n+name: Pre-Commit\n+\n+on:\n+ pull_request:\n+ push:\n+ branches:\n+ - master\n+\n+jobs:\n+ getBaseVersion:\n+ name: Get min/max versions\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/terraform-min-max@v1.0.1\n+ outputs:\n+ minVersion: ${{ steps.minMax.outputs.minVersion }}\n+ maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n+\n+ preCommit:\n+ name: Pre-commit check\n+ runs-on: ubuntu-latest\n+ needs: getBaseVersion\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ version:\n+ - ${{ needs.getBaseVersion.outputs.minVersion }}\n+ - ${{ needs.getBaseVersion.outputs.maxVersion }}\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+\n+ - name: Install Terraform v${{ matrix.version }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ matrix.version }}\n+\n+ - name: Install pre-commit dependencies\n+ run: |\n+ pip install pre-commit\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n+\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n+\n+ - name: Execute pre-commit\n+ # Run all pre-commit checks on max version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nThis PR adds an output variable which points to the name of the database subnet group name\r\n\r\n## Motivation and Context\r\nWe need to access this variable since the [terraform-aws-modules/rds/aws](https://registry.terraform.io/modules/terraform-aws-modules/rds/aws/latest) modules needs the name of the database subnet group when it already exists (and not its ID). Although I would prefer that this module use the ID as input, it's much more simpler to add an output to the VPC module.\r\n\r\nAt the moment, we can't just assume the database subnet group name with the `name` input parameter since a `lower()` function is applied, and may change it the future.\r\n\r\n## Breaking Changes\r\nNo breaking changes\r\n\r\n## How Has This Been Tested?\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -715,6 +715,7 @@ No Modules.\n | database\\_route\\_table\\_ids | List of IDs of database route tables |\n | database\\_subnet\\_arns | List of ARNs of database subnets |\n | database\\_subnet\\_group | ID of database subnet group |\n+| database\\_subnet\\_group\\_name | Name of database subnet group |\n | database\\_subnets | List of IDs of database subnets |\n | database\\_subnets\\_cidr\\_blocks | List of cidr\\_blocks of database subnets |\n | database\\_subnets\\_ipv6\\_cidr\\_blocks | List of IPv6 cidr\\_blocks of database subnets in an IPv6 enabled VPC |\n---\noutputs.tf\n@@ -133,6 +133,11 @@ output \"database_subnet_group\" {\n value = concat(aws_db_subnet_group.database.*.id, [\"\"])[0]\n }\n \n+output \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ value = concat(aws_db_subnet_group.database.*.name, [\"\"])[0]\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value = aws_subnet.redshift.*.id\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -715,6 +715,7 @@ No Modules.\n | database\\_route\\_table\\_ids | List of IDs of database route tables |\n | database\\_subnet\\_arns | List of ARNs of database subnets |\n | database\\_subnet\\_group | ID of database subnet group |\n+| database\\_subnet\\_group\\_name | Name of database subnet group |\n | database\\_subnets | List of IDs of database subnets |\n of database\\_subnets\\_cidr\\_blocks | List of cidr\\_blocks of database subnets |\n | database\\_subnets\\_ipv6\\_cidr\\_blocks | List of IPv6 cidr\\_blocks of database subnets in an IPv6 enabled VPC |\n---\noutputs.tf\n@@ -133,6 +133,11 @@ output \"database_subnet_group\" {\n value = concat(aws_db_subnet_group.database.*.id, [\"\"])[0]\n }\n \n+output \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ value = concat(aws_db_subnet_group.database.*.name, [\"\"])[0]\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value = aws_subnet.redshift.*.id\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -715,6 +715,7 @@ No Modules.\n | database\\_route\\_table\\_ids | List of IDs of database route tables |\n | database\\_subnet\\_arns | List of ARNs of database subnets |\n | database\\_subnet\\_group | ID of database subnet group |\n+| database\\_subnet\\_group\\_name | Name of database subnet group |\n | database\\_subnets | List of IDs of database subnets |\n | database\\_subnets\\_cidr\\_blocks | List of cidr\\_blocks of database subnets |\n | database\\_subnets\\_ipv6\\_cidr\\_blocks | List of IPv6 cidr\\_blocks of database subnets in an IPv6 enabled VPC |\n---\noutputs.tf\n@@ -133,6 +133,11 @@ output \"database_subnet_group\" {\n value = concat(aws_db_subnet_group.database.*.id, [\"\"])[0]\n }\n \n+output \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ value = concat(aws_db_subnet_group.database.*.name, [\"\"])[0]\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value of = aws_subnet.redshift.*.id\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -715,6 +715,7 @@ No Modules.\n | database\\_route\\_table\\_ids | List of IDs of database route tables |\n | database\\_subnet\\_arns | List of ARNs of database subnets |\n | database\\_subnet\\_group | ID of database subnet group |\n+| database\\_subnet\\_group\\_name | Name of database subnet group |\n | database\\_subnets | List of IDs of database subnets |\n | database\\_subnets\\_cidr\\_blocks | List of cidr\\_blocks of database subnets |\n | database\\_subnets\\_ipv6\\_cidr\\_blocks | List of IPv6 cidr\\_blocks of of subnets in an IPv6 enabled VPC |\n---\noutputs.tf\n@@ -133,6 +133,11 @@ output \"database_subnet_group\" {\n value = concat(aws_db_subnet_group.database.*.id, [\"\"])[0]\n }\n \n+output \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ value = concat(aws_db_subnet_group.database.*.name, [\"\"])[0]\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value = aws_subnet.redshift.*.id\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nThe example uses `[{}]` for the `default_security_group_ingress` and `default_security_group_egress` which causes the issue described in #477. The solution described there has worked for me and several others so this pull request fixes the example so others don't waste time having to figure this out. \r\n\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -118,8 +118,8 @@ \"vpc\" {\n \n # Default security group - ingress/egress rules cleared to deny all\n manage_default_security_group = true\n- default_security_group_ingress = [{}]\n- default_security_group_egress = [{}]\n+ default_security_group_ingress = []\n+ default_security_group_egress = []\n \n # VPC Flow Logs (Cloudwatch log group and IAM role will be created)\n enable_flow_log = true\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -118,8 +118,8 @@ module \"vpc\" {\n \n # Default security group - ingress/egress rules cleared to deny all\n manage_default_security_group = true\n- default_security_group_ingress = [{}]\n- default_security_group_egress = [{}]\n+ default_security_group_ingress = []\n+ default_security_group_egress = []\n \n # VPC Flow Logs (Cloudwatch log group and IAM role will be created)\n enable_flow_log = true\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -118,8 +118,8 @@ module \"vpc\" {\n \n # Default security group - ingress/egress rules cleared to deny all\n manage_default_security_group = true\n- default_security_group_ingress = [{}]\n- default_security_group_egress = [{}]\n+ default_security_group_ingress = []\n+ default_security_group_egress = []\n \n # VPC Flow Logs (Cloudwatch log group and IAM role will be created)\n enable_flow_log [{}]\n+ = true\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -118,8 +118,8 @@ module \"vpc\" {\n \n # Default group - ingress/egress rules cleared to deny all\n manage_default_security_group = true\n- default_security_group_ingress = [{}]\n- default_security_group_egress = [{}]\n+ default_security_group_ingress = []\n+ default_security_group_egress = []\n \n # VPC Flow Logs (Cloudwatch log group and IAM role will be created)\n enable_flow_log = true\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n- Remove s3/dynamodb service endpoint data sources due to incompatible `service_type` parameter.\r\n- Replace dynamic service name from data sources with template strings\r\n\r\n## Motivation and Context\r\n\r\nAfter this week's release of privatelink for s3, the fixes implemented in v2.69.0 and v2.70.0 don't mitigate errors when using the AWS Terraform provider `v2.X.X`\r\n\r\nAddresses:\r\n\r\n- #582\r\n- #585 \r\n\r\n## Breaking Changes\r\n\r\nThis is a proposed patch release for `v2.69.` which did not resolve the original issue.\r\n\r\n## How Has This Been Tested?\r\n\r\nThis was tested by creating vpc endpoint services with AWS Terraform Provider `2.70.0` and that no error occurred.\r\n\r\n/cc @tbugfinder \r\n\n\n---\n\nChoice A:\nvpc-endpoints.tf\n@@ -1,11 +1,15 @@\n ######################\n # VPC Endpoint for S3\n ######################\n+\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service_type = var.s3_endpoint_type\n- service = \"s3\"\n+ service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [var.s3_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n@@ -45,8 +49,11 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service_type = var.dynamodb_endpoint_type\n- service = \"dynamodb\"\n+ service = \"dynamodb\"\n+ filter {\n+ name = \"service-type\"\n+ values = [var.dynamodb_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n---\n\n\n---\n\nChoice B:\nvpc-endpoints.tf\n@@ -1,11 +1,15 @@\n ######################\n # VPC Endpoint for S3\n ######################\n+\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service_type = var.s3_endpoint_type\n- service = \"s3\"\n+ service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [var.s3_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n@@ -45,8 +49,11 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service_type = var.dynamodb_endpoint_type\n- service = \"dynamodb\"\n+ service = \"dynamodb\"\n+ filter {\n+ = \"service-type\"\n+ values = [var.dynamodb_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n---\n\n\n---\n\nChoice C:\nvpc-endpoints.tf\n@@ -1,11 +1,15 @@\n ######################\n # VPC Endpoint for S3\n ######################\n+\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service_type = var.s3_endpoint_type\n- service = \"s3\"\n+ service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ \"aws_vpc_endpoint\" = [var.s3_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n@@ -45,8 +49,11 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service_type = var.dynamodb_endpoint_type\n- service = \"dynamodb\"\n+ service = \"dynamodb\"\n+ filter {\n+ name = \"service-type\"\n+ values = [var.dynamodb_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n---\n\n\n---\n\nChoice D:\nvpc-endpoints.tf\n@@ -1,11 +1,15 @@\n ######################\n # VPC Endpoint for S3\n ######################\n+\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service_type = var.s3_endpoint_type\n- service = \"s3\"\n+ service = \"s3\"\n+ filter {\n+ name = values = [var.s3_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n@@ -45,8 +49,11 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service_type = var.dynamodb_endpoint_type\n- service = \"dynamodb\"\n+ service = \"dynamodb\"\n+ filter {\n+ name = \"service-type\"\n+ values = [var.dynamodb_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n\u2026hat modules support the 'count' argument (as of Terraform 0.13).\r\n\r\n## Description\r\nUpdated the 'Conditional Creation' section of the documentation to reflect the fact that Terraform 0.13+ supports the count argument in module blocks (https://www.terraform.io/docs/language/meta-arguments/count.html).\r\n\r\n## Motivation and Context\r\nThe documentation was outdated and didn't fully apply to newer versions of Terraform.\r\n\r\n## Breaking Changes\r\nNo breaking changes.\r\n\r\n## How Has This Been Tested?\r\nI read it, and my IDE has a spellchecker?\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -167,7 +167,7 @@ If your organization requires a permissions boundary to be attached to the VPC F\n \n ## Conditional creation\n \n-Sometimes you need to have a way to create VPC resources conditionally but Terraform does not allow to use `count` inside wish block, so the solution is to specify argument `create_vpc`.\n+Prior to Terraform 0.13, you were unable to specify `count` in a module block. If you wish to toggle the creation of the module's resources in an older (pre 0.13) version of Terraform, you can use the `create_vpc` argument.\n \n ```hcl\n # This VPC will not be created\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -167,7 +167,7 @@ If your organization requires a permissions boundary to be attached to the VPC F\n \n ## Conditional creation\n \n-Sometimes you need to have a way to create VPC resources conditionally but Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_vpc`.\n+Prior to Terraform 0.13, you were unable to specify `count` in a module block. If you wish to toggle the creation of the module's resources in an older (pre 0.13) version of Terraform, you can use the `create_vpc` argument.\n will ```hcl\n # This VPC will not be created\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -167,7 +167,7 @@ If your organization requires a permissions boundary to be attached to the VPC F\n \n ## Conditional creation\n \n-Sometimes you need to have a way to create VPC resources conditionally you Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_vpc`.\n+Prior to Terraform 0.13, you were unable to specify `count` in a module block. If you wish to toggle the creation of the module's resources in an older (pre 0.13) version of Terraform, you can use the `create_vpc` argument.\n \n ```hcl\n # This VPC will not be created\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -167,7 +167,7 @@ If your organization requires a permissions boundary to be attached to the VPC F\n \n ## Conditional creation\n \n-Sometimes you need to have a way to create VPC resources conditionally but Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_vpc`.\n+Prior to Terraform 0.13, you were unable to specify `count` in a module block. If you wish to toggle the creation of the module's resources in an older (pre 0.13) version of Terraform, you can use the `create_vpc` argument.\n \n ```hcl\n # This VPC will not be created\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nEnable RDS-DATA endpoint for rds calls via http api \r\n\r\n## Motivation and Context\r\nBecause i needed it\r\n\r\n## Breaking Changes\r\nNo breaking\r\n\r\n## How Has This Been Tested?\r\nYes on my own project\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -467,6 +467,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_public\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | enable\\_qldb\\_session\\_endpoint | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rds\\_endpoint | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_rds\\_data\\_endpoint | Should be true if you want to provision an RDS-Data endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rekognition\\_endpoint | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | enable\\_s3\\_endpoint | Should be true if you want to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | enable\\_sagemaker\\_api\\_endpoint | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -575,6 +576,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rds\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | rds\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | rds\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for RDS-Data endpoint | `bool` | `false` | no |\n+| rds\\_data\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for RDS-Data endpoint | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS-Data endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | redshift\\_acl\\_tags | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n | redshift\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | redshift\\_inbound\\_acl\\_rules | Redshift subnets inbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n---\nvariables.tf\n@@ -1829,6 +1829,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1421,6 +1421,26 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -467,6 +467,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_public\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | enable\\_qldb\\_session\\_endpoint | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rds\\_endpoint | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_rds\\_data\\_endpoint | Should be true if you want to provision an RDS-Data endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rekognition\\_endpoint | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | enable\\_s3\\_endpoint | Should be true if you want to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | enable\\_sagemaker\\_api\\_endpoint | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -575,6 +576,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rds\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | rds\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | rds\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for RDS-Data endpoint | `bool` | `false` | no |\n+| rds\\_data\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for RDS-Data endpoint | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS-Data endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | redshift\\_acl\\_tags | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n | redshift\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | redshift\\_inbound\\_acl\\_rules | Redshift subnets inbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n---\nvariables.tf\n@@ -1829,6 +1829,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1421,6 +1421,26 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids |\n+| = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -467,6 +467,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_public\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | enable\\_qldb\\_session\\_endpoint | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rds\\_endpoint | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_rds\\_data\\_endpoint | Should be true if you want to provision an RDS-Data endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rekognition\\_endpoint | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | enable\\_s3\\_endpoint | Should be true if you want to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | enable\\_sagemaker\\_api\\_endpoint | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -575,6 +576,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rds\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | rds\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | rds\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for RDS-Data endpoint | `bool` | `false` | no |\n+| rds\\_data\\_endpoint\\_security\\_group\\_ids | an ID of one or more security groups to associate with the network interface for RDS-Data endpoint | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS-Data endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | redshift\\_acl\\_tags | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n | redshift\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | redshift\\_inbound\\_acl\\_rules | Redshift subnets inbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n---\nvariables.tf\n@@ -1829,6 +1829,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1421,6 +1421,26 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -467,6 +467,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_public\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | enable\\_qldb\\_session\\_endpoint | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rds\\_endpoint | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_rds\\_data\\_endpoint | Should be true if you want to provision an RDS-Data endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rekognition\\_endpoint | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | enable\\_s3\\_endpoint | Should be true if you want to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | enable\\_sagemaker\\_api\\_endpoint | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -575,6 +576,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rds\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | rds\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | rds\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC false\n RDS-Data endpoint | `bool` | `false` | no |\n+| rds\\_data\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for RDS-Data endpoint | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS-Data endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | redshift\\_acl\\_tags | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n | redshift\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | redshift\\_inbound\\_acl\\_rules | Redshift subnets inbound network ACL rules | `list(map(string))` |
[
{
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_action\": \"allow\",
\"rule_number\": 100,
\"to_port\": 0
}
]
| no |\n---\nvariables.tf\n@@ -1829,6 +1829,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1421,6 +1421,26 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nRelated to #573 since VPC endpoint service_type became available in AWS provider version 3.10.\n\n---\n\nChoice A:\nREADME.md\n@@ -229,13 +229,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/README.md\n@@ -22,13 +22,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= that }\n }\n }\n---\nexamples/ipv6/README.md\n@@ -20,13 +20,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/ipv6/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-44-asymmetric-private-subnets/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/manage-default-vpc/README.md\n@@ -22,7 +22,7 @@ Run `terraform destroy` when you don't need these resources.\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/manage-default-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/network-acls/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/network-acls/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/simple-vpc/README.md\n@@ -26,7 +26,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/simple-vpc/main.tf\n@@ -15,7 +15,7 @@ module \"vpc\" {\n \n enable_ipv6 = true\n \n- enable_nat_gateway = true\n+ enable_nat_gateway = false\n single_nat_gateway = true\n \n # s3_endpoint_type = \"Interface\"\n---\nexamples/simple-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,14 +24,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Inputs\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -2,7 +2,14 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n- random = \">= 2\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n+\n+ random = {\n+ source = \"hashicorp/random\"\n+ version = \">= 2\"\n+ }\n }\n }\n---\nversions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -229,13 +229,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/README.md\n@@ -22,13 +22,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/ipv6/README.md\n@@ -20,13 +20,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/ipv6/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ \"hashicorp/aws\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-44-asymmetric-private-subnets/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/manage-default-vpc/README.md\n@@ -22,7 +22,7 @@ Run `terraform destroy` when you don't need these resources.\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/manage-default-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/network-acls/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/network-acls/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/simple-vpc/README.md\n@@ -26,7 +26,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/simple-vpc/main.tf\n@@ -15,7 +15,7 @@ module \"vpc\" {\n \n enable_ipv6 = true\n \n- enable_nat_gateway = true\n+ enable_nat_gateway = false\n single_nat_gateway = true\n \n # s3_endpoint_type = \"Interface\"\n---\nexamples/simple-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,14 +24,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Inputs\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -2,7 +2,14 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n- random = \">= 2\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n+\n+ random = {\n+ source = \"hashicorp/random\"\n+ version = \">= 2\"\n+ }\n }\n }\n---\nversions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -229,13 +229,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/README.md\n@@ -22,13 +22,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/ipv6/README.md\n@@ -20,13 +20,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/ipv6/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n >= -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/manage-default-vpc/README.md\n@@ -22,7 +22,7 @@ Run `terraform destroy` when you don't need these resources.\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/manage-default-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/network-acls/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/network-acls/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/simple-vpc/README.md\n@@ -26,7 +26,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/simple-vpc/main.tf\n@@ -15,7 +15,7 @@ module \"vpc\" {\n \n enable_ipv6 = true\n \n- enable_nat_gateway = true\n+ enable_nat_gateway = false\n single_nat_gateway = true\n \n # s3_endpoint_type = \"Interface\"\n---\nexamples/simple-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,14 +24,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Inputs\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -2,7 +2,14 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n- random = \">= 2\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n+\n+ random = {\n+ source = \"hashicorp/random\"\n+ version = \">= 2\"\n+ }\n }\n }\n---\nversions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -229,13 +229,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/README.md\n@@ -22,13 +22,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/ipv6/README.md\n@@ -20,13 +20,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/ipv6/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-44-asymmetric-private-subnets/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/manage-default-vpc/README.md\n@@ -22,7 +22,7 @@ Run `terraform destroy` when you don't need these resources.\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/manage-default-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/network-acls/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/network-acls/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/simple-vpc/README.md\n@@ -26,7 +26,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/simple-vpc/main.tf\n@@ -15,7 +15,7 @@ module \"vpc\" {\n \n enable_ipv6 = true\n \n- enable_nat_gateway = true\n+ enable_nat_gateway = false\n single_nat_gateway = true\n \n # s3_endpoint_type = \"Interface\"\n---\nexamples/simple-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,14 +24,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Inputs\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -2,7 +2,14 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n- random = \">= 2\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n+\n+ random = {\n+ source = \"hashicorp/random\"\n+ version = \">= 2\"\n+ }\n }\n }\n---\nversions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n\r\n## Description\r\n\r\nCorrectly filter S3 endpoint based on the type of endpoint.\r\n\r\n## Motivation and Context\r\n\r\n\r\nThis is now required because AWS seems to have added a new endpoint Interface for S3. If you don't filter the datasource for S3 endpoint on type, Terraform will fail because it will return multiple VPC endpoints\r\n`Error: multiple VPC Endpoint Services matched; use additional constraints to reduce matches to a single VPC Endpoint Service`\r\n\r\nFix https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/571\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -19,7 +19,7 @@ These types of resources are supported:\n * [VPC Flow Log](https://www.terraform.io/docs/providers/aws/r/flow_log.html)\n * [VPC Endpoint](https://www.terraform.io/docs/providers/aws/r/vpc_endpoint.html):\n * Gateway: S3, DynamoDB\n- * Interface: EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n+ * Interface: S3, EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n ECS, ECS Agent, ECS Telemetry, SES, SNS, STS, Glue, CloudWatch(Monitoring, Logs, Events),\n Elastic Load Balancing, CloudTrail, Secrets Manager, Config, Codeartifact(API, Repositories), CodeBuild, CodeCommit,\n Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, SageMaker(Notebook, Runtime, API),\n@@ -353,6 +353,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n | dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n | dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| dynamodb\\_endpoint\\_type | DynamoDB VPC endpoint type | `string` | `\"Gateway\"` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -589,6 +590,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rekognition\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for Rekognition endpoint | `list(string)` | `[]` | no |\n | rekognition\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for Rekognition endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | reuse\\_nat\\_ips | Should be true if you don't want EIPs to be created for your NAT Gateways and will instead pass them in via the 'external\\_nat\\_ip\\_ids' variable | `bool` | `false` | no |\n+| s3\\_endpoint\\_type | S3 VPC endpoint type | `string` | `\"Gateway\"` | no |\n | sagemaker\\_api\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SageMaker API endpoint | `bool` | `false` | no |\n | sagemaker\\_api\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SageMaker API endpoint | `list(string)` | `[]` | no |\n | sagemaker\\_api\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SageMaker API endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nexamples/simple-vpc/main.tf\n@@ -18,6 +18,11 @@ module \"vpc\" {\n enable_nat_gateway = true\n single_nat_gateway = true\n \n+ # s3_endpoint_type = \"Interface\"\n+\n+ enable_s3_endpoint = true\n+ enable_dynamodb_endpoint = true\n+\n public_subnet_tags = {\n Name = \"overridden-name-public\"\n }\n---\nvariables.tf\n@@ -316,12 +316,24 @@ variable \"enable_dynamodb_endpoint\" {\n default = false\n }\n \n+variable \"dynamodb_endpoint_type\" {\n+ description = \"DynamoDB VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_s3_endpoint\" {\n description = \"Should be true if you want to provision an S3 endpoint to the VPC\"\n type = bool\n default = false\n }\n \n+variable \"s3_endpoint_type\" {\n+ description = \"S3 VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_codeartifact_api_endpoint\" {\n description = \"Should be true if you want to provision an Codeartifact API endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -4,15 +4,18 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service = \"s3\"\n+ service_type = var.s3_endpoint_type\n+ service = \"s3\"\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n- tags = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ vpc_endpoint_type = var.s3_endpoint_type\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n@@ -42,15 +45,18 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service = \"dynamodb\"\n+ service_type = var.dynamodb_endpoint_type\n+ service = \"dynamodb\"\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n- tags = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ vpc_endpoint_type = var.dynamodb_endpoint_type\n+ service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -19,7 +19,7 @@ These types of resources are supported:\n * [VPC Flow Log](https://www.terraform.io/docs/providers/aws/r/flow_log.html)\n * [VPC Endpoint](https://www.terraform.io/docs/providers/aws/r/vpc_endpoint.html):\n * Gateway: S3, DynamoDB\n- * Interface: EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n+ * Interface: S3, EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n ECS, ECS Agent, ECS Telemetry, SES, SNS, STS, Glue, CloudWatch(Monitoring, Logs, Events),\n Elastic Load Balancing, CloudTrail, Secrets Manager, Config, Codeartifact(API, Repositories), CodeBuild, CodeCommit,\n Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, SageMaker(Notebook, Runtime, API),\n@@ -353,6 +353,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n | dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n | dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| dynamodb\\_endpoint\\_type | DynamoDB VPC endpoint type | `string` | `\"Gateway\"` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -589,6 +590,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rekognition\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for Rekognition endpoint | `list(string)` | `[]` | no |\n | rekognition\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for Rekognition endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | reuse\\_nat\\_ips | Should be true if you don't want EIPs to be for your NAT Gateways and will instead pass them in via the 'external\\_nat\\_ip\\_ids' variable | `bool` | `false` | no |\n+| s3\\_endpoint\\_type | S3 VPC endpoint type | `string` | `\"Gateway\"` | no |\n | sagemaker\\_api\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SageMaker API endpoint | `bool` | `false` | no |\n | sagemaker\\_api\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SageMaker API endpoint | `list(string)` | `[]` | no |\n | sagemaker\\_api\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SageMaker API endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nexamples/simple-vpc/main.tf\n@@ -18,6 +18,11 @@ module \"vpc\" {\n enable_nat_gateway = true\n single_nat_gateway = true\n \n+ # s3_endpoint_type = \"Interface\"\n+\n+ enable_s3_endpoint = true\n+ enable_dynamodb_endpoint = true\n+\n public_subnet_tags = {\n Name = \"overridden-name-public\"\n }\n---\nvariables.tf\n@@ -316,12 +316,24 @@ variable \"enable_dynamodb_endpoint\" {\n default = false\n }\n \n+variable \"dynamodb_endpoint_type\" {\n+ description = \"DynamoDB VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_s3_endpoint\" {\n description = \"Should be true if you want to provision an S3 endpoint to the VPC\"\n type = bool\n default = false\n }\n \n+variable \"s3_endpoint_type\" {\n+ description = \"S3 VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_codeartifact_api_endpoint\" {\n description = \"Should be true if you want to provision an Codeartifact API endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -4,15 +4,18 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service = \"s3\"\n+ service_type = var.s3_endpoint_type\n+ service = \"s3\"\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n- tags = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ vpc_endpoint_type = var.s3_endpoint_type\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n@@ -42,15 +45,18 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service = \"dynamodb\"\n+ service_type = var.dynamodb_endpoint_type\n+ service = \"dynamodb\"\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n- tags = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ vpc_endpoint_type = var.dynamodb_endpoint_type\n+ service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -19,7 endpoint @@ These types of resources are supported:\n * [VPC Flow Log](https://www.terraform.io/docs/providers/aws/r/flow_log.html)\n * [VPC Endpoint](https://www.terraform.io/docs/providers/aws/r/vpc_endpoint.html):\n * Gateway: S3, DynamoDB\n- * Interface: EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n+ * Interface: S3, EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n ECS, ECS Agent, ECS Telemetry, SES, SNS, STS, Glue, CloudWatch(Monitoring, Logs, Events),\n Elastic Load Balancing, CloudTrail, Secrets Manager, Config, Codeartifact(API, Repositories), CodeBuild, CodeCommit,\n Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, SageMaker(Notebook, Runtime, API),\n@@ -353,6 +353,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n | dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n | dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| dynamodb\\_endpoint\\_type | DynamoDB VPC endpoint type | `string` | `\"Gateway\"` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -589,6 +590,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rekognition\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for Rekognition endpoint | `list(string)` | `[]` | no |\n | rekognition\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for Rekognition endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | reuse\\_nat\\_ips | Should be true if you don't want EIPs to be created for your NAT Gateways and will instead pass them in via the 'external\\_nat\\_ip\\_ids' variable | `bool` | `false` | no |\n+| s3\\_endpoint\\_type | S3 VPC endpoint type | `string` | `\"Gateway\"` | no |\n | sagemaker\\_api\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SageMaker API endpoint | `bool` | `false` | no |\n | sagemaker\\_api\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SageMaker API endpoint | `list(string)` | `[]` | no |\n | sagemaker\\_api\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SageMaker API endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nexamples/simple-vpc/main.tf\n@@ -18,6 +18,11 @@ module \"vpc\" {\n enable_nat_gateway = true\n single_nat_gateway = true\n \n+ # s3_endpoint_type = \"Interface\"\n+\n+ enable_s3_endpoint = true\n+ enable_dynamodb_endpoint = true\n+\n public_subnet_tags = {\n Name = \"overridden-name-public\"\n }\n---\nvariables.tf\n@@ -316,12 +316,24 @@ variable \"enable_dynamodb_endpoint\" {\n default = false\n }\n \n+variable \"dynamodb_endpoint_type\" {\n+ description = \"DynamoDB VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_s3_endpoint\" {\n description = \"Should be true if you want to provision an S3 endpoint to the VPC\"\n type = bool\n default = false\n }\n \n+variable \"s3_endpoint_type\" {\n+ description = \"S3 VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_codeartifact_api_endpoint\" {\n description = \"Should be true if you want to provision an Codeartifact API endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -4,15 +4,18 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service = \"s3\"\n+ service_type = var.s3_endpoint_type\n+ service = \"s3\"\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n- tags = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ vpc_endpoint_type = var.s3_endpoint_type\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n@@ -42,15 +45,18 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service = \"dynamodb\"\n+ service_type = var.dynamodb_endpoint_type\n+ service = \"dynamodb\"\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n- tags = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ vpc_endpoint_type = var.dynamodb_endpoint_type\n+ service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -19,7 +19,7 @@ These types of resources are supported:\n * [VPC Flow Log](https://www.terraform.io/docs/providers/aws/r/flow_log.html)\n * [VPC Endpoint](https://www.terraform.io/docs/providers/aws/r/vpc_endpoint.html):\n * Gateway: S3, DynamoDB\n- * Interface: EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n+ * Interface: S3, EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n ECS, ECS Agent, ECS Telemetry, SES, SNS, STS, Glue, CloudWatch(Monitoring, Logs, Events),\n Elastic Load Balancing, CloudTrail, Secrets Manager, Config, Codeartifact(API, Repositories), CodeBuild, CodeCommit,\n Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, SageMaker(Notebook, Runtime, API),\n@@ -353,6 +353,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n | dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n | dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| dynamodb\\_endpoint\\_type | DynamoDB VPC endpoint type | `string` | `\"Gateway\"` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -589,6 +590,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rekognition\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for Rekognition endpoint | `list(string)` | `[]` | no |\n | rekognition\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for Rekognition endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | reuse\\_nat\\_ips | Should be true if you don't want EIPs to be created for your NAT Gateways and will instead pass them in via the 'external\\_nat\\_ip\\_ids' variable | `bool` | `false` | no |\n+| s3\\_endpoint\\_type | S3 VPC endpoint type | `string` | `\"Gateway\"` | no |\n | sagemaker\\_api\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SageMaker API endpoint | `bool` | `false` | no |\n | sagemaker\\_api\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SageMaker API endpoint | `list(string)` | `[]` | no |\n | sagemaker\\_api\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SageMaker API endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nexamples/simple-vpc/main.tf\n@@ -18,6 +18,11 @@ module \"vpc\" {\n enable_nat_gateway = true\n single_nat_gateway = true\n \n+ # s3_endpoint_type = \"Interface\"\n+\n+ enable_s3_endpoint = true\n+ enable_dynamodb_endpoint = true\n+\n public_subnet_tags = {\n Name = \"overridden-name-public\"\n }\n---\nvariables.tf\n@@ -316,12 +316,24 @@ variable \"enable_dynamodb_endpoint\" {\n default = false\n }\n \n+variable \"dynamodb_endpoint_type\" {\n+ description = \"DynamoDB VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_s3_endpoint\" {\n description = \"Should be true if you want to provision an S3 endpoint to the VPC\"\n type = bool\n default = false\n }\n \n+variable \"s3_endpoint_type\" {\n+ description = \"S3 VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_codeartifact_api_endpoint\" {\n description = \"Should be true if you want to provision an Codeartifact API endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -4,15 +4,18 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service = \"s3\"\n+ service_type = var.s3_endpoint_type\n+ service = \"s3\"\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n- tags = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ vpc_endpoint_type = var.s3_endpoint_type\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n@@ -42,15 +45,18 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service = \"dynamodb\"\n+ service_type = var.dynamodb_endpoint_type\n+ service = \"dynamodb\"\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n- tags a = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ vpc_endpoint_type = var.dynamodb_endpoint_type\n+ service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAWS has some kind of bug on vpc endpoint service S3. S3 should be a \"gateway\" service however \"gateway\" and \"interface\" services shows up. This cause terraform to fail with the following error:\r\n\r\n`Error: multiple VPC Endpoint Services matched; use additional constraints to reduce matches to a single VPC Endpoint Service`\r\n\r\nMultiple S3 endpoint service (tested region: eu-central-1, eu-west-1)\r\n\"Screenshot\r\n\r\n## Motivation and Context\r\nI made this PR to able to deploy this able to deploy terraform code.\r\n\n\n---\n\nChoice A:\nvpc-endpoints.tf\n@@ -4,7 +4,9 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service = \"s3\"\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+\n }\n \n resource \"aws_vpc_endpoint\" {\n---\n\n\n---\n\nChoice B:\nvpc-endpoints.tf\n@@ -4,7 +4,9 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- = \"s3\"\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice C:\nvpc-endpoints.tf\n@@ -4,7 +4,9 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service = \"s3\"\n+ service service = \"s3\"\n+ service_type = \"Gateway\"\n+\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice D:\nvpc-endpoints.tf\n@@ -4,7 +4,9 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service = \"s3\"\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice B:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && -1535,7 ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice C:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 {\n- resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice D:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nSorry Anton,\r\nThere was a bug in the dms endpoint code\n\n---\n\nChoice A:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration \"codeartifact_repositories\" #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice B:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice C:\nvar.enable_dms_endpoint -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice D:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n = \"dms\"\n }\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nFixed #565\n\n---\n\nChoice A:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && data ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice B:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n }\n---\n VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice C:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n && = \"dms\"\n }\n---\n\n\n---\n\nChoice D:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdding missing DMS endpoint\r\n\r\n## Motivation and Context\r\nDMS endpoint is missing\n\n---\n\nChoice A:\nREADME.md\n@@ -26,7 +26,7 @@ Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, Sa\n CloudFormation, CodePipeline, Storage Gateway, AppMesh, Transfer, Service Catalog, AppStream API, AppStream Streaming,\n Athena, Rekognition, Elastic File System (EFS), Cloud Directory, Elastic Beanstalk (+ Health), Elastic Map Reduce(EMR),\n DataSync, EBS, SMS, Elastic Inference Runtime, QLDB Session, Step Functions, Access Analyzer, Auto Scaling Plans,\n-Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure\n+Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure, DMS\n \n * [RDS DB Subnet Group](https://www.terraform.io/docs/providers/aws/r/db_subnet_group.html)\n * [ElastiCache Subnet Group](https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html)\n@@ -350,6 +350,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dhcp\\_options\\_netbios\\_node\\_type | Specify netbios node\\_type for DHCP options set (requires enable\\_dhcp\\_options set to true) | `string` | `\"\"` | no |\n | dhcp\\_options\\_ntp\\_servers | Specify a list of NTP servers for DHCP options set (requires enable\\_dhcp\\_options set to true) | `list(string)` | `[]` | no |\n | dhcp\\_options\\_tags | Additional tags for the DHCP option set (requires enable\\_dhcp\\_options set to true) | `map(string)` | `{}` | no |\n+| dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n+| dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n+| dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -428,6 +431,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n+| enable\\_dms\\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dns\\_hostnames | Should be true to enable DNS hostnames in the VPC | `bool` | `false` | no |\n | enable\\_dns\\_support | Should be true to enable DNS support in the VPC | `bool` | `true` | no |\n | enable\\_dynamodb\\_endpoint | Should be true if you want to provision a DynamoDB endpoint to the VPC | `bool` | `false` | no |\n@@ -799,6 +803,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_datasync\\_dns\\_entry | The DNS entries for the VPC Endpoint for DataSync. |\n | vpc\\_endpoint\\_datasync\\_id | The ID of VPC endpoint for DataSync |\n | vpc\\_endpoint\\_datasync\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DataSync. |\n+| vpc\\_endpoint\\_dms\\_dns\\_entry | The DNS entries for the VPC Endpoint for DMS. |\n+| vpc\\_endpoint\\_dms\\_id | The ID of VPC endpoint for DMS |\n+| vpc\\_endpoint\\_dms\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DMS. |\n | vpc\\_endpoint\\_dynamodb\\_id | The ID of VPC endpoint for DynamoDB |\n | vpc\\_endpoint\\_dynamodb\\_pl\\_id | The prefix list for the DynamoDB VPC endpoint. |\n | vpc\\_endpoint\\_ebs\\_dns\\_entry | The DNS entries for the VPC Endpoint for EBS. |\n---\noutputs.tf\n@@ -1407,6 +1407,21 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_dms_id\" {\n+ description = \"The ID of VPC endpoint for DMS\"\n+ value = concat(aws_vpc_endpoint.sns.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_dms_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_dms_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_rds_id\" {\n description = \"The ID of VPC endpoint for RDS\"\n value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n@@ -1422,7 +1437,6 @@ output \"vpc_endpoint_rds_dns_entry\" {\n value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n }\n \n-\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\nvariables.tf\n@@ -1883,6 +1883,30 @@ variable \"acm_pca_endpoint_private_dns_enabled\" {\n default = false\n }\n = \"enable_dms_endpoint\" {\n+ description = \"Should be true if you want to provision a DMS endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"dms_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for DMS endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"map_public_ip_on_launch\" {\n description = \"Should be false if you do not want to auto-assign public IP on launch\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1529,3 +1529,27 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n \n tags = local.vpce_tags\n }\n+\n+\n+#############################################\n+# VPC Endpoint for Database Migration Service\n+#############################################\n+data \"aws_vpc_endpoint_service\" \"dms\" {\n+ count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+\n+ service = \"dms\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"dms\" {\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.dms[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.dms_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.dms_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.dms_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -26,7 +26,7 @@ Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, Sa\n CloudFormation, CodePipeline, Storage Gateway, AppMesh, Transfer, Service Catalog, AppStream API, AppStream Streaming,\n Athena, Rekognition, Elastic File System (EFS), Cloud Directory, Elastic Beanstalk (+ Health), Elastic Map Reduce(EMR),\n DataSync, EBS, SMS, Elastic Inference Runtime, QLDB Session, Step Functions, Access Analyzer, Auto Scaling Plans,\n-Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure\n+Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure, DMS\n \n * [RDS DB Subnet Group](https://www.terraform.io/docs/providers/aws/r/db_subnet_group.html)\n * [ElastiCache Subnet Group](https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html)\n@@ -350,6 +350,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dhcp\\_options\\_netbios\\_node\\_type | Specify netbios node\\_type for DHCP options set (requires enable\\_dhcp\\_options set to true) | `string` | `\"\"` | no |\n | dhcp\\_options\\_ntp\\_servers | Specify a list of NTP servers for DHCP options set (requires enable\\_dhcp\\_options set to true) | `list(string)` | `[]` | no |\n | dhcp\\_options\\_tags | Additional tags for the DHCP set (requires enable\\_dhcp\\_options set to true) | `map(string)` | `{}` | no |\n+| dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n+| dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n+| dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -428,6 +431,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n+| enable\\_dms\\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dns\\_hostnames | Should be true to enable DNS hostnames in the VPC | `bool` | `false` | no |\n | enable\\_dns\\_support | Should be true to enable DNS support in the VPC | `bool` | `true` | no |\n | enable\\_dynamodb\\_endpoint | Should be true if you want to provision a DynamoDB endpoint to the VPC | `bool` | `false` | no |\n@@ -799,6 +803,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_datasync\\_dns\\_entry | The DNS entries for the VPC Endpoint for DataSync. |\n | vpc\\_endpoint\\_datasync\\_id | The ID of VPC endpoint for DataSync |\n | vpc\\_endpoint\\_datasync\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DataSync. |\n+| vpc\\_endpoint\\_dms\\_dns\\_entry | The DNS entries for the VPC Endpoint for DMS. |\n+| vpc\\_endpoint\\_dms\\_id | The ID of VPC endpoint for DMS |\n+| vpc\\_endpoint\\_dms\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DMS. |\n | vpc\\_endpoint\\_dynamodb\\_id | The ID of VPC endpoint for DynamoDB |\n | vpc\\_endpoint\\_dynamodb\\_pl\\_id | The prefix list for the DynamoDB VPC endpoint. |\n | vpc\\_endpoint\\_ebs\\_dns\\_entry | The DNS entries for the VPC Endpoint for EBS. |\n---\noutputs.tf\n@@ -1407,6 +1407,21 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_dms_id\" {\n+ description = \"The ID of VPC endpoint for DMS\"\n+ value = concat(aws_vpc_endpoint.sns.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_dms_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_dms_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_rds_id\" {\n description = \"The ID of VPC endpoint for RDS\"\n value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n@@ -1422,7 +1437,6 @@ output \"vpc_endpoint_rds_dns_entry\" {\n value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n }\n \n-\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\nvariables.tf\n@@ -1883,6 +1883,30 @@ variable \"acm_pca_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_dms_endpoint\" {\n+ description = \"Should be true if you want to provision a DMS endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"dms_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for DMS endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"map_public_ip_on_launch\" {\n description = \"Should be false if you do not want to auto-assign public IP on launch\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1529,3 +1529,27 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n \n tags = local.vpce_tags\n }\n+\n+\n+#############################################\n+# VPC Endpoint for Database Migration Service\n+#############################################\n+data \"aws_vpc_endpoint_service\" \"dms\" {\n+ count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+\n+ service = \"dms\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"dms\" {\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.dms[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.dms_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.dms_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.dms_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -26,7 +26,7 @@ Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, Sa\n CloudFormation, CodePipeline, Storage Gateway, AppMesh, Transfer, Service Catalog, AppStream API, AppStream Streaming,\n Athena, Rekognition, Elastic File System (EFS), Cloud Directory, Elastic Beanstalk (+ Health), Elastic Map Reduce(EMR),\n DataSync, EBS, SMS, Elastic Inference Runtime, QLDB Session, Step Functions, Access Analyzer, Auto Scaling Plans,\n-Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure\n+Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure, DMS\n \n * [RDS DB Subnet Group](https://www.terraform.io/docs/providers/aws/r/db_subnet_group.html)\n * [ElastiCache Subnet Group](https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html)\n@@ -350,6 +350,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dhcp\\_options\\_netbios\\_node\\_type | Specify netbios node\\_type for DHCP options set (requires enable\\_dhcp\\_options set to true) | `string` | `\"\"` | no |\n | dhcp\\_options\\_ntp\\_servers | Specify a list of NTP servers for DHCP options set (requires enable\\_dhcp\\_options set to true) | `list(string)` | `[]` | no |\n | dhcp\\_options\\_tags | Additional tags for the DHCP option set (requires enable\\_dhcp\\_options set to true) | `map(string)` | `{}` | no |\n+| dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n+| dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n+| dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -428,6 +431,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n+| enable\\_dms\\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dns\\_hostnames | Should be true to enable DNS hostnames in the VPC | `bool` | `false` | no |\n | enable\\_dns\\_support | Should be true to enable DNS support in the VPC | `bool` | `true` | no |\n | enable\\_dynamodb\\_endpoint | Should be true if you want to provision a DynamoDB endpoint to the VPC | `bool` | `false` | no |\n@@ -799,6 +803,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_datasync\\_dns\\_entry | The DNS entries for the VPC Endpoint for DataSync. |\n | vpc\\_endpoint\\_datasync\\_id | The ID of VPC endpoint for DataSync |\n | vpc\\_endpoint\\_datasync\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DataSync. |\n+| vpc\\_endpoint\\_dms\\_dns\\_entry | The DNS entries for the VPC Endpoint for DMS. |\n+| vpc\\_endpoint\\_dms\\_id | The ID of VPC endpoint for DMS |\n+| vpc\\_endpoint\\_dms\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DMS. |\n | vpc\\_endpoint\\_dynamodb\\_id | The ID of VPC endpoint for DynamoDB |\n | vpc\\_endpoint\\_dynamodb\\_pl\\_id | The prefix list for the DynamoDB VPC endpoint. |\n | vpc\\_endpoint\\_ebs\\_dns\\_entry | The DNS entries for the VPC Endpoint for EBS. |\n---\noutputs.tf\n@@ -1407,6 +1407,21 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_dms_id\" {\n+ description = \"The ID of VPC endpoint for DMS\"\n+ value = concat(aws_vpc_endpoint.sns.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_dms_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_dms_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_rds_id\" {\n description = \"The ID of VPC endpoint for RDS\"\n value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n@@ -1422,7 +1437,6 @@ output \"vpc_endpoint_rds_dns_entry\" {\n value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n }\n \n-\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\nvariables.tf\n@@ -1883,6 +1883,30 @@ variable \"acm_pca_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_dms_endpoint\" {\n+ description = \"Should be true if you want to provision a DMS endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"dms_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for DMS endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"map_public_ip_on_launch\" {\n description = \"Should be false if you do not want to auto-assign public IP on launch\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1529,3 +1529,27 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n \n tags = local.vpce_tags\n }\n+\n+\n+#############################################\n+# VPC Endpoint for Database Migration Service\n+#############################################\n+data \"aws_vpc_endpoint_service\" \"dms\" {\n+ count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+\n+ service = \"dms\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"dms\" {\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.dms[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.dms_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.dms_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.dms_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -26,7 +26,7 @@ Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, Sa\n CloudFormation, CodePipeline, Storage Gateway, AppMesh, Transfer, Service Catalog, AppStream API, AppStream Streaming,\n Athena, Rekognition, Elastic File System (EFS), Cloud Directory, Elastic Beanstalk (+ Health), Elastic Map Reduce(EMR),\n DataSync, EBS, SMS, Elastic Inference Runtime, QLDB Session, Step Functions, Access Analyzer, Auto Scaling Plans,\n-Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure\n+Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure, DMS\n \n * [RDS DB Subnet Group](https://www.terraform.io/docs/providers/aws/r/db_subnet_group.html)\n * [ElastiCache Subnet Group](https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html)\n@@ -350,6 +350,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dhcp\\_options\\_netbios\\_node\\_type | Specify netbios node\\_type for DHCP options set (requires enable\\_dhcp\\_options set to true) | `string` | `\"\"` | no |\n | dhcp\\_options\\_ntp\\_servers | Specify a list of NTP servers for DHCP options set (requires enable\\_dhcp\\_options set to true) | `list(string)` | `[]` | no |\n | dhcp\\_options\\_tags | Additional tags for the DHCP option set (requires enable\\_dhcp\\_options set to true) | `map(string)` | `{}` | no |\n+| dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n+| dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n+| dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an | is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -428,6 +431,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n+| enable\\_dms\\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dns\\_hostnames | Should be true to enable DNS hostnames in the VPC | `bool` | `false` | no |\n | enable\\_dns\\_support | Should be true to enable DNS support in the VPC | `bool` | `true` | no |\n | enable\\_dynamodb\\_endpoint | Should be true if you want to provision a DynamoDB endpoint to the VPC | `bool` | `false` | no |\n@@ -799,6 +803,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_datasync\\_dns\\_entry | The DNS entries for the VPC Endpoint for DataSync. |\n | vpc\\_endpoint\\_datasync\\_id | The ID of VPC endpoint for DataSync |\n | vpc\\_endpoint\\_datasync\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DataSync. |\n+| vpc\\_endpoint\\_dms\\_dns\\_entry | The DNS entries for the VPC Endpoint for DMS. |\n+| vpc\\_endpoint\\_dms\\_id | The ID of VPC endpoint for DMS |\n+| vpc\\_endpoint\\_dms\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DMS. |\n | vpc\\_endpoint\\_dynamodb\\_id | The ID of VPC endpoint for DynamoDB |\n | vpc\\_endpoint\\_dynamodb\\_pl\\_id | The prefix list for the DynamoDB VPC endpoint. |\n | vpc\\_endpoint\\_ebs\\_dns\\_entry | The DNS entries for the VPC Endpoint for EBS. |\n---\noutputs.tf\n@@ -1407,6 +1407,21 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_dms_id\" {\n+ description = \"The ID of VPC endpoint for DMS\"\n+ value = concat(aws_vpc_endpoint.sns.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_dms_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_dms_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_rds_id\" {\n description = \"The ID of VPC endpoint for RDS\"\n value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n@@ -1422,7 +1437,6 @@ output \"vpc_endpoint_rds_dns_entry\" {\n value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n }\n \n-\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\nvariables.tf\n@@ -1883,6 +1883,30 @@ variable \"acm_pca_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_dms_endpoint\" {\n+ description = \"Should be true if you want to provision a DMS endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"dms_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for DMS endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"map_public_ip_on_launch\" {\n description = \"Should be false if you do not want to auto-assign public IP on launch\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1529,3 +1529,27 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n \n tags = local.vpce_tags\n }\n+\n+\n+#############################################\n+# VPC Endpoint for Database Migration Service\n+#############################################\n+data \"aws_vpc_endpoint_service\" \"dms\" {\n+ count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+\n+ service = \"dms\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"dms\" {\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.dms[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.dms_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.dms_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.dms_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nRDS endpoint is missing from the outputs.\r\n\r\n## Motivation and Context\r\nRDS endpoint is missing from the outputs.\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -876,6 +876,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_qldb\\_session\\_dns\\_entry | The DNS entries for the VPC Endpoint for QLDB Session. |\n | vpc\\_endpoint\\_qldb\\_session\\_id | The ID of VPC endpoint for QLDB Session |\n | vpc\\_endpoint\\_qldb\\_session\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for QLDB Session. |\n+| vpc\\_endpoint\\_rds\\_dns\\_entry | The DNS entries for the VPC Endpoint for RDS. |\n+| vpc\\_endpoint\\_rds\\_id | The ID of VPC endpoint for RDS |\n+| vpc\\_endpoint\\_rds\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for RDS. |\n | vpc\\_endpoint\\_rekognition\\_dns\\_entry | The DNS entries for the VPC Endpoint for Rekognition. |\n | vpc\\_endpoint\\_rekognition\\_id | The ID of VPC endpoint for Rekognition |\n | vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for Rekognition. |\n---\noutputs.tf\n@@ -1407,6 +1407,22 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_rds_id\" {\n+ description = \"The ID of VPC endpoint for RDS\"\n+ value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_rds_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for RDS.\"\n+ value = flatten(aws_vpc_endpoint.rds.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_rds_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for RDS.\"\n+ value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n+}\n+\n+\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -876,6 +876,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_qldb\\_session\\_dns\\_entry | The DNS entries for the VPC Endpoint for QLDB Session. |\n | vpc\\_endpoint\\_qldb\\_session\\_id | The ID of VPC endpoint for QLDB Session |\n | vpc\\_endpoint\\_qldb\\_session\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for QLDB Session. |\n+| vpc\\_endpoint\\_rds\\_dns\\_entry | The DNS entries for the VPC Endpoint for RDS. |\n+| vpc\\_endpoint\\_rds\\_id | The ID of VPC endpoint for RDS |\n+| vpc\\_endpoint\\_rds\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for RDS. |\n | vpc\\_endpoint\\_rekognition\\_dns\\_entry | The DNS entries for the VPC Endpoint for Rekognition. |\n | vpc\\_endpoint\\_rekognition\\_id | The ID of VPC endpoint for Rekognition VPC | vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for Rekognition. |\n---\noutputs.tf\n@@ -1407,6 +1407,22 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_rds_id\" {\n+ description = \"The ID of VPC endpoint for RDS\"\n+ value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_rds_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for RDS.\"\n+ value = flatten(aws_vpc_endpoint.rds.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_rds_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for RDS.\"\n+ value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n+}\n+\n+\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -876,6 +876,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_qldb\\_session\\_dns\\_entry | The DNS entries for the VPC Endpoint for QLDB Session. |\n | vpc\\_endpoint\\_qldb\\_session\\_id | The ID of VPC endpoint for QLDB Session |\n | vpc\\_endpoint\\_qldb\\_session\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for QLDB Session. |\n+| vpc\\_endpoint\\_rds\\_dns\\_entry | The DNS entries for the VPC Endpoint for RDS. |\n+| vpc\\_endpoint\\_rds\\_id | The ID of VPC endpoint for RDS |\n+| vpc\\_endpoint\\_rds\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for RDS. |\n | vpc\\_endpoint\\_rekognition\\_dns\\_entry | The DNS entries for the VPC Endpoint for Rekognition. |\n | vpc\\_endpoint\\_rekognition\\_id | The ID of VPC endpoint for Rekognition |\n | vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for Rekognition. |\n---\noutputs.tf\n@@ -1407,6 +1407,22 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_rds_id\" {\n+ description = \"The ID of VPC endpoint for RDS\"\n+ value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_rds_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for RDS.\"\n+ QLDB = flatten(aws_vpc_endpoint.rds.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_rds_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for RDS.\"\n+ value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n+}\n+\n+\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -876,6 +876,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_qldb\\_session\\_dns\\_entry | The DNS entries for the VPC Endpoint for QLDB Session. |\n | DNS | The ID of VPC endpoint for QLDB Session |\n | vpc\\_endpoint\\_qldb\\_session\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for QLDB Session. |\n+| vpc\\_endpoint\\_rds\\_dns\\_entry | The DNS entries for the VPC Endpoint for RDS. |\n+| vpc\\_endpoint\\_rds\\_id | The ID of VPC endpoint for RDS |\n+| vpc\\_endpoint\\_rds\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for RDS. |\n | vpc\\_endpoint\\_rekognition\\_dns\\_entry | The DNS entries for the VPC Endpoint for Rekognition. |\n | vpc\\_endpoint\\_rekognition\\_id | The ID of VPC endpoint for Rekognition |\n | vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for Rekognition. |\n---\noutputs.tf\n@@ -1407,6 +1407,22 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_rds_id\" {\n+ description = \"The ID of VPC endpoint for RDS\"\n+ value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_rds_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for RDS.\"\n+ value = flatten(aws_vpc_endpoint.rds.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_rds_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for RDS.\"\n+ value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n+}\n+\n+\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdd the ability to define a name prefix for the NAT Gateway and the EIP's that are created for the NAT Gateway.\r\n\r\n## Motivation and Context\r\nCurrently based on the name tag alone for the NAT Gateway and NAT Gateway's EIP's it is hard to know that the NAT Gateway is a NAT Gateway and that the EIP's that are created belong to the NAT Gateway. I wanted a way to make this more clear for reporting purposes. While I could have overridden the name using the `nat_gateway_tags` and `nat_eip_tags` options respectively it would have removed the subnet part of the name which would have left me with several NAT Gateways and EIPs with matching names in VPC's that have more than one. Adding a prefix option seemed like a sensible compromise.\r\n\r\n## Breaking Changes\r\nNo breaking changes, if the new option is not used the previous naming scheme is used.\r\n\r\n## How Has This Been Tested?\r\nI ran `terraform plan` on the `examples/simple-vpc` and verified the names matched what was previously there. Then I modified `examples/simple-vpc/main.tf` adding: \r\n```\r\n nat_gateway_name_prefix = \"my-overridden-nat-name\"\r\n nat_gateway_eips_name_prefix = \"my-overridden-eips-name\"\r\n``` \r\nthe new plan had:\r\n```\r\n # module.vpc.aws_eip.nat[0] will be created\r\n + resource \"aws_eip\" \"nat\" {\r\n + allocation_id = (known after apply)\r\n + association_id = (known after apply)\r\n + carrier_ip = (known after apply)\r\n + customer_owned_ip = (known after apply)\r\n + domain = (known after apply)\r\n + id = (known after apply)\r\n + instance = (known after apply)\r\n + network_border_group = (known after apply)\r\n + network_interface = (known after apply)\r\n + private_dns = (known after apply)\r\n + private_ip = (known after apply)\r\n + public_dns = (known after apply)\r\n + public_ip = (known after apply)\r\n + public_ipv4_pool = (known after apply)\r\n + tags = {\r\n + \"Environment\" = \"dev\"\r\n + \"Name\" = \"my-overridden-eips-name-eu-west-1a\"\r\n + \"Owner\" = \"user\"\r\n }\r\n + vpc = true\r\n }\r\n\r\n # module.vpc.aws_nat_gateway.this[0] will be created\r\n + resource \"aws_nat_gateway\" \"this\" {\r\n + allocation_id = (known after apply)\r\n + id = (known after apply)\r\n + network_interface_id = (known after apply)\r\n + private_ip = (known after apply)\r\n + public_ip = (known after apply)\r\n + subnet_id = (known after apply)\r\n + tags = {\r\n + \"Environment\" = \"dev\"\r\n + \"Name\" = \"my-overridden-nat-name-eu-west-1a\"\r\n + \"Owner\" = \"user\"\r\n }\r\n }\r\n``` \n\n---\n\nChoice A:\nREADME.md\n@@ -544,6 +544,8 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | name | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\n | nat\\_eip\\_tags | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | nat\\_gateway\\_tags | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| nat\\_gateway\\_name\\_prefix | Specify the prefix name for the nat gateway | `string` | `\"\"` | no |\n+| nat\\_gateway\\_eips\\_name\\_prefix | Specify the prefix name for the nat gateway's EIP's | `string` | `\"\"` | no |\n | one\\_nat\\_gateway\\_per\\_az | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs`. | `bool` | `false` | no |\n | private\\_acl\\_tags | Additional tags for the private subnets network ACL | `map(string)` | `{}` | no |\n | private\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for private subnets | `bool` | `false` | no |\n---\nmain.tf\n@@ -932,7 +932,7 @@ resource \"aws_eip\" \"nat\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_eips_name_prefix != \"\" ? var.nat_gateway_eips_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n@@ -957,7 +957,7 @@ resource \"aws_nat_gateway\" \"this\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_name_prefix != \"\" ? var.nat_gateway_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n---\nvariables.tf\n@@ -274,6 +274,12 @@ variable \"enable_nat_gateway\" {\n default |\n+| = false\n }\n \n+variable \"nat_gateway_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n@@ -304,6 +310,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"nat_gateway_eips_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways's eips, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"enable_public_s3_endpoint\" {\n description = \"Whether to enable S3 VPC Endpoint for public subnets\"\n default = true\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -544,6 +544,8 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | name | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\n | nat\\_eip\\_tags | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | nat\\_gateway\\_tags | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| nat\\_gateway\\_name\\_prefix | Specify the prefix name for the nat gateway | `string` | `\"\"` | no |\n+| nat\\_gateway\\_eips\\_name\\_prefix | Specify the prefix name for the nat gateway's EIP's | `string` | `\"\"` | no |\n | one\\_nat\\_gateway\\_per\\_az | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs`. | `bool` | `false` | no |\n | private\\_acl\\_tags | Additional tags for the private subnets network ACL | `map(string)` | `{}` | no |\n | private\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for private subnets | `bool` | `false` | no |\n---\nmain.tf\n@@ -932,7 +932,7 @@ resource \"aws_eip\" \"nat\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_eips_name_prefix != \"\" ? var.nat_gateway_eips_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n@@ -957,7 +957,7 @@ resource \"aws_nat_gateway\" \"this\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_name_prefix != \"\" ? var.nat_gateway_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n---\nvariables.tf\n@@ -274,6 +274,12 @@ variable \"enable_nat_gateway\" {\n default = false\n }\n \n+variable \"nat_gateway_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n@@ -304,6 +310,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"nat_gateway_eips_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways's eips, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"enable_public_s3_endpoint\" {\n description = \"Whether to enable S3 VPC Endpoint for public subnets\"\n default = true\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -544,6 +544,8 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | name | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\n | nat\\_eip\\_tags | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | nat\\_gateway\\_tags | Additional | for the NAT gateways | `map(string)` | `{}` | no |\n+| nat\\_gateway\\_name\\_prefix | Specify the prefix name for the nat gateway | `string` | `\"\"` | no |\n+| nat\\_gateway\\_eips\\_name\\_prefix | Specify the prefix name for the nat gateway's EIP's | `string` | `\"\"` | no |\n | one\\_nat\\_gateway\\_per\\_az | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs`. | `bool` | `false` | no |\n | private\\_acl\\_tags | Additional tags for the private subnets network ACL | `map(string)` | `{}` | no |\n | private\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for private subnets | `bool` | `false` | no |\n---\nmain.tf\n@@ -932,7 +932,7 @@ resource \"aws_eip\" \"nat\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_eips_name_prefix != \"\" ? var.nat_gateway_eips_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n@@ -957,7 +957,7 @@ resource \"aws_nat_gateway\" \"this\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_name_prefix != \"\" ? var.nat_gateway_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n---\nvariables.tf\n@@ -274,6 +274,12 @@ variable \"enable_nat_gateway\" {\n default = false\n }\n \n+variable \"nat_gateway_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n@@ -304,6 +310,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"nat_gateway_eips_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways's eips, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"enable_public_s3_endpoint\" {\n description = \"Whether to enable S3 VPC Endpoint for public subnets\"\n default = true\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -544,6 +544,8 @@ It is possible to for this VPC module with [terraform-aws-transit-gateway\n | name | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\n | nat\\_eip\\_tags | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | nat\\_gateway\\_tags | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| nat\\_gateway\\_name\\_prefix | Specify the prefix name for the nat gateway | `string` | `\"\"` | no |\n+| nat\\_gateway\\_eips\\_name\\_prefix | Specify the prefix name for the nat gateway's EIP's | `string` | `\"\"` | no |\n | one\\_nat\\_gateway\\_per\\_az | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs`. | `bool` | `false` | no |\n | private\\_acl\\_tags | Additional tags for the private subnets network ACL | `map(string)` | `{}` | no |\n | private\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for private subnets | `bool` | `false` | no |\n---\nmain.tf\n@@ -932,7 +932,7 @@ resource \"aws_eip\" \"nat\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_eips_name_prefix != \"\" ? var.nat_gateway_eips_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n@@ -957,7 +957,7 @@ resource \"aws_nat_gateway\" \"this\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_name_prefix != \"\" ? var.nat_gateway_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n---\nvariables.tf\n@@ -274,6 +274,12 @@ variable \"enable_nat_gateway\" {\n default = false\n }\n \n+variable \"nat_gateway_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n@@ -304,6 +310,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"nat_gateway_eips_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways's eips, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"enable_public_s3_endpoint\" {\n description = \"Whether to enable S3 VPC Endpoint for public subnets\"\n default = true\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -324,13 +324,13 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n ################\n-# Public subnet\n+# Public-App subnet\n ################\n-resource \"aws_subnet\" \"public\" {\n- count = var.create_vpc && length(var.public_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public_subnets) >= length(var.azs)) ? length(var.public_subnets) : 0\n+resource \"aws_subnet\" \"public-app\" {\n+ count = var.create_vpc && length(var.public-app_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-app_subnets) >= length(var.azs)) ? length(var.public-app_subnets) : 0\n \n vpc_id = local.vpc_id\n- cidr_block = element(concat(var.public_subnets, [\"\"]), count.index)\n+ cidr_block = element(concat(var.public-app_subnets, [\"\"]), count.index)\n availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n map_public_ip_on_launch = var.map_public_ip_on_launch\n@@ -341,13 +341,41 @@ resource \"aws_subnet\" \"public\" {\n tags = merge(\n {\n \"Name\" = format(\n- \"%s-${var.public_subnet_suffix}-%s\",\n+ \"%s-${var.public-app_subnet_suffix}-%s\",\n var.name,\n element(var.azs, count.index),\n )\n },\n var.tags,\n- var.public_subnet_tags,\n+ var.public-app_subnet_tags,\n+ )\n+}\n+\n+################\n+# Public-Network subnet\n+################\n+resource \"aws_subnet\" \"public-network\" {\n+ count = var.create_vpc && length(var.public-network_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-network_subnets) >= length(var.azs)) ? length(var.public-network_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = element(concat(var.public-network_subnets, [\"\"]), count.index)\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ map_public_ip_on_launch = var.map_public_ip_on_launch\n+ assign_ipv6_address_on_creation = var.public_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.public_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.public_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.public_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = \"%s-${var.public-network_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.public-network_subnet_tags,\n )\n }\n \n---\noutputs.tf\n@@ -88,24 +88,44 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private.*.ipv6_cidr_block\n }\n \n-output \"public_subnets\" {\n+output \"public-app_subnets\" {\n description = \"List of IDs of public subnets\"\n- value = aws_subnet.public.*.id\n+ value = aws_subnet.public-app.*.id\n }\n \n-output \"public_subnet_arns\" {\n+output \"public-network_subnets\" {\n+ description = \"List of IDs of public subnets\"\n+ value = aws_subnet.public-network.*.id\n+}\n+\n+output \"public-app_subnet_arns\" {\n+ description = \"List of ARNs of public subnets\"\n+ value = aws_subnet.public-app.*.arn\n+}\n+\n+output \"public-network_subnet_arns\" {\n description = \"List of ARNs of public subnets\"\n- value = aws_subnet.public.*.arn\n+ value = aws_subnet.public-network.*.arn\n }\n \n-output \"public_subnets_cidr_blocks\" {\n+output \"public-app_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public.*.cidr_block\n+ value = aws_subnet.public-app.*.cidr_block\n+}\n+\n+output \"public-network_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of public subnets\"\n+ value = aws_subnet.public-network.*.cidr_block\n+}\n+\n+output \"public-app_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.public-app.*.ipv6_cidr_block\n }\n \n-output \"public_subnets_ipv6_cidr_blocks\" {\n+output \"public-network_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public.*.ipv6_cidr_block\n+ value = aws_subnet.public-network.*.ipv6_cidr_block\n }\n \n output \"database_subnets\" {\n---\nvariables.tf\n@@ -148,8 +148,14 @@ variable \"elasticache_subnet_suffix\" {\n default = \"elasticache\"\n }\n \n-variable \"public_subnets\" {\n- description = \"A list of public subnets inside the VPC\"\n+variable \"public-app_subnets\" {\n+ description = \"A list of public-app subnets inside the VPC\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"public-network_subnets\" {\n+ description = \"A list of public-network subnets inside the VPC\"\n type = list(string)\n default = []\n }\n@@ -1955,7 +1961,13 @@ variable \"igw_tags\" {\n default = {}\n }\n \n-variable \"public_subnet_tags\" {\n+variable \"public-app_subnet_tags\" {\n+ description = \"Additional tags for the public subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n+variable \"public-network_subnet_tags\" {\n description = \"Additional tags for the public subnets\"\n type = map(string)\n default = {}\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -324,13 +324,13 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n ################\n-# Public subnet\n+# Public-App subnet\n ################\n-resource \"aws_subnet\" \"public\" {\n- count = var.create_vpc && length(var.public_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public_subnets) >= length(var.azs)) ? length(var.public_subnets) : 0\n+resource \"aws_subnet\" \"public-app\" {\n+ count = var.create_vpc && length(var.public-app_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-app_subnets) >= length(var.azs)) ? length(var.public-app_subnets) : 0\n \n vpc_id = local.vpc_id\n- cidr_block = element(concat(var.public_subnets, [\"\"]), count.index)\n+ cidr_block = element(concat(var.public-app_subnets, [\"\"]), count.index)\n availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n map_public_ip_on_launch = var.map_public_ip_on_launch\n@@ -341,13 +341,41 @@ resource \"aws_subnet\" \"public\" {\n tags = merge(\n {\n \"Name\" = format(\n- \"%s-${var.public_subnet_suffix}-%s\",\n+ \"%s-${var.public-app_subnet_suffix}-%s\",\n var.name,\n element(var.azs, count.index),\n )\n },\n var.tags,\n- var.public_subnet_tags,\n+ var.public-app_subnet_tags,\n+ )\n+}\n+\n+################\n+# Public-Network subnet\n+################\n+resource \"aws_subnet\" \"public-network\" {\n+ count = var.create_vpc && length(var.public-network_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-network_subnets) >= length(var.azs)) ? length(var.public-network_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = element(concat(var.public-network_subnets, [\"\"]), count.index)\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ map_public_ip_on_launch = var.map_public_ip_on_launch\n+ assign_ipv6_address_on_creation = var.public_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.public_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.public_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.public_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"%s-${var.public-network_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.public-network_subnet_tags,\n )\n }\n \n---\noutputs.tf\n@@ -88,24 +88,44 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private.*.ipv6_cidr_block\n }\n \n-output \"public_subnets\" {\n+output \"public-app_subnets\" {\n description = \"List of IDs of public subnets\"\n- value = aws_subnet.public.*.id\n+ value = aws_subnet.public-app.*.id\n }\n \n-output \"public_subnet_arns\" {\n+output \"public-network_subnets\" {\n+ description = \"List of IDs of public subnets\"\n+ value = aws_subnet.public-network.*.id\n+}\n+\n+output \"public-app_subnet_arns\" {\n+ description = \"List of ARNs of public subnets\"\n+ value = aws_subnet.public-app.*.arn\n+}\n+\n+output \"public-network_subnet_arns\" {\n description = \"List of ARNs of public subnets\"\n- value = aws_subnet.public.*.arn\n+ value = aws_subnet.public-network.*.arn\n }\n \n-output \"public_subnets_cidr_blocks\" {\n+output \"public-app_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public.*.cidr_block\n+ value = aws_subnet.public-app.*.cidr_block\n+}\n+\n+output \"public-network_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of public subnets\"\n+ value = aws_subnet.public-network.*.cidr_block\n+}\n+\n+output \"public-app_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.public-app.*.ipv6_cidr_block\n }\n \n-output \"public_subnets_ipv6_cidr_blocks\" {\n+output \"public-network_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public.*.ipv6_cidr_block\n+ value = aws_subnet.public-network.*.ipv6_cidr_block\n }\n \n output \"database_subnets\" {\n---\nvariables.tf\n@@ -148,8 +148,14 @@ variable \"elasticache_subnet_suffix\" {\n default = \"elasticache\"\n }\n \n-variable \"public_subnets\" {\n- description = \"A list of public subnets inside the VPC\"\n+variable \"public-app_subnets\" {\n+ description = \"A list of public-app subnets inside the VPC\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"public-network_subnets\" {\n+ description = \"A list of public-network subnets inside the VPC\"\n type = list(string)\n default = []\n }\n@@ -1955,7 +1961,13 @@ variable \"igw_tags\" {\n default = {}\n }\n \n-variable \"public_subnet_tags\" {\n+variable \"public-app_subnet_tags\" {\n+ description = \"Additional tags for the public subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n+variable \"public-network_subnet_tags\" {\n description = \"Additional tags for the public subnets\"\n type = map(string)\n default = {}\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -324,13 +324,13 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n ################\n-# Public subnet\n+# Public-App subnet\n ################\n-resource \"aws_subnet\" \"public\" {\n- count = var.create_vpc && length(var.public_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public_subnets) >= length(var.azs)) ? length(var.public_subnets) : 0\n+resource \"aws_subnet\" \"public-app\" {\n+ count = var.create_vpc && length(var.public-app_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-app_subnets) >= length(var.azs)) ? length(var.public-app_subnets) : 0\n \n vpc_id = local.vpc_id\n- cidr_block = element(concat(var.public_subnets, [\"\"]), count.index)\n+ cidr_block = element(concat(var.public-app_subnets, [\"\"]), count.index)\n availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n map_public_ip_on_launch = var.map_public_ip_on_launch\n@@ -341,13 +341,41 @@ resource \"aws_subnet\" \"public\" {\n tags = merge(\n {\n \"Name\" = format(\n- \"%s-${var.public_subnet_suffix}-%s\",\n+ \"%s-${var.public-app_subnet_suffix}-%s\",\n var.name,\n element(var.azs, count.index),\n )\n },\n var.tags,\n- var.public_subnet_tags,\n+ var.public-app_subnet_tags,\n+ )\n+}\n+\n+################\n+# Public-Network subnet\n+################\n+resource \"aws_subnet\" \"public-network\" {\n+ count = var.create_vpc && length(var.public-network_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-network_subnets) >= length(var.azs)) ? length(var.public-network_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = element(concat(var.public-network_subnets, [\"\"]), count.index)\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) description 0 ? element(var.azs, count.index) : null\n+ map_public_ip_on_launch = var.map_public_ip_on_launch\n+ assign_ipv6_address_on_creation = var.public_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.public_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.public_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.public_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"%s-${var.public-network_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.public-network_subnet_tags,\n )\n }\n \n---\noutputs.tf\n@@ -88,24 +88,44 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private.*.ipv6_cidr_block\n }\n \n-output \"public_subnets\" {\n+output \"public-app_subnets\" {\n description = \"List of IDs of public subnets\"\n- value = aws_subnet.public.*.id\n+ value = aws_subnet.public-app.*.id\n }\n \n-output \"public_subnet_arns\" {\n+output \"public-network_subnets\" {\n+ description = \"List of IDs of public subnets\"\n+ value = aws_subnet.public-network.*.id\n+}\n+\n+output \"public-app_subnet_arns\" {\n+ description = \"List of ARNs of public subnets\"\n+ value = aws_subnet.public-app.*.arn\n+}\n+\n+output \"public-network_subnet_arns\" {\n description = \"List of ARNs of public subnets\"\n- value = aws_subnet.public.*.arn\n+ value = aws_subnet.public-network.*.arn\n }\n \n-output \"public_subnets_cidr_blocks\" {\n+output \"public-app_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public.*.cidr_block\n+ value = aws_subnet.public-app.*.cidr_block\n+}\n+\n+output \"public-network_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of public subnets\"\n+ value = aws_subnet.public-network.*.cidr_block\n+}\n+\n+output \"public-app_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.public-app.*.ipv6_cidr_block\n }\n \n-output \"public_subnets_ipv6_cidr_blocks\" {\n+output \"public-network_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public.*.ipv6_cidr_block\n+ value = aws_subnet.public-network.*.ipv6_cidr_block\n }\n \n output \"database_subnets\" {\n---\nvariables.tf\n@@ -148,8 +148,14 @@ variable \"elasticache_subnet_suffix\" {\n default = \"elasticache\"\n }\n \n-variable \"public_subnets\" {\n- description = \"A list of public subnets inside the VPC\"\n+variable \"public-app_subnets\" {\n+ description = \"A list of public-app subnets inside the VPC\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"public-network_subnets\" {\n+ description = \"A list of public-network subnets inside the VPC\"\n type = list(string)\n default = []\n }\n@@ -1955,7 +1961,13 @@ variable \"igw_tags\" {\n default = {}\n }\n \n-variable \"public_subnet_tags\" {\n+variable \"public-app_subnet_tags\" {\n+ description = \"Additional tags for the public subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n+variable \"public-network_subnet_tags\" {\n description = \"Additional tags for the public subnets\"\n type = map(string)\n default = {}\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -324,13 +324,13 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n ################\n-# Public subnet\n+# Public-App subnet\n ################\n-resource \"aws_subnet\" \"public\" {\n- count = var.create_vpc && length(var.public_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public_subnets) >= length(var.azs)) ? length(var.public_subnets) : 0\n+resource \"aws_subnet\" \"public-app\" {\n+ count = var.create_vpc && length(var.public-app_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-app_subnets) >= length(var.azs)) ? length(var.public-app_subnets) : 0\n \n vpc_id = local.vpc_id\n- cidr_block = element(concat(var.public_subnets, [\"\"]), count.index)\n+ cidr_block = element(concat(var.public-app_subnets, [\"\"]), count.index)\n availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n map_public_ip_on_launch = var.map_public_ip_on_launch\n@@ -341,13 +341,41 @@ resource \"aws_subnet\" \"public\" {\n tags = merge(\n {\n \"Name\" = format(\n- \"%s-${var.public_subnet_suffix}-%s\",\n+ \"%s-${var.public-app_subnet_suffix}-%s\",\n var.name,\n element(var.azs, count.index),\n )\n },\n var.tags,\n- var.public_subnet_tags,\n+ var.public-app_subnet_tags,\n+ )\n+}\n+\n+################\n+# Public-Network subnet\n+################\n+resource \"aws_subnet\" \"public-network\" {\n+ count = var.create_vpc && length(var.public-network_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-network_subnets) >= length(var.azs)) ? length(var.public-network_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = element(concat(var.public-network_subnets, [\"\"]), count.index)\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ map_public_ip_on_launch = var.map_public_ip_on_launch\n+ assign_ipv6_address_on_creation = var.public_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.public_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.public_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.public_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"%s-${var.public-network_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.public-network_subnet_tags,\n )\n }\n \n---\noutputs.tf\n@@ -88,24 +88,44 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private.*.ipv6_cidr_block\n }\n \n-output \"public_subnets\" {\n+output \"public-app_subnets\" {\n description = \"List of IDs of public subnets\"\n- value = aws_subnet.public.*.id\n+ value = aws_subnet.public-app.*.id\n }\n \n-output \"public_subnet_arns\" {\n+output \"public-network_subnets\" {\n+ description = \"List of IDs of public subnets\"\n+ value = aws_subnet.public-network.*.id\n+}\n+\n+output \"public-app_subnet_arns\" {\n+ description = \"List of ARNs of public subnets\"\n+ value = aws_subnet.public-app.*.arn\n+}\n+\n+output \"public-network_subnet_arns\" {\n description = \"List of ARNs of public subnets\"\n- value = aws_subnet.public.*.arn\n+ value = aws_subnet.public-network.*.arn\n }\n \n-output \"public_subnets_cidr_blocks\" {\n+output \"public-app_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public.*.cidr_block\n+ value = aws_subnet.public-app.*.cidr_block\n+}\n+\n+output \"public-network_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of public subnets\"\n+ value = aws_subnet.public-network.*.cidr_block\n+}\n+\n+output \"public-app_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of public subnets in an length(var.public-network_subnets) enabled VPC\"\n+ value = aws_subnet.public-app.*.ipv6_cidr_block\n }\n \n-output \"public_subnets_ipv6_cidr_blocks\" {\n+output \"public-network_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public.*.ipv6_cidr_block\n+ value = aws_subnet.public-network.*.ipv6_cidr_block\n }\n \n output \"database_subnets\" {\n---\nvariables.tf\n@@ -148,8 +148,14 @@ variable \"elasticache_subnet_suffix\" {\n default = \"elasticache\"\n }\n \n-variable \"public_subnets\" {\n- description = \"A list of public subnets inside the VPC\"\n+variable \"public-app_subnets\" {\n+ description = \"A list of public-app subnets inside the VPC\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"public-network_subnets\" {\n+ description = \"A list of public-network subnets inside the VPC\"\n type = list(string)\n default = []\n }\n@@ -1955,7 +1961,13 @@ variable \"igw_tags\" {\n default = {}\n }\n \n-variable \"public_subnet_tags\" {\n+variable \"public-app_subnet_tags\" {\n+ description = \"Additional tags for the public subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n+variable \"public-network_subnet_tags\" {\n description = \"Additional tags for the public subnets\"\n type = map(string)\n default = {}\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -324,13 +324,13 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n ################\n-# Public subnet\n+# Public-App subnet\n ################\n-resource \"aws_subnet\" \"public\" {\n- count = var.create_vpc && length(var.public_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public_subnets) >= length(var.azs)) ? length(var.public_subnets) : 0\n+resource \"aws_subnet\" \"public-app\" {\n+ count = var.create_vpc && length(var.public-app_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-app_subnets) >= length(var.azs)) ? length(var.public-app_subnets) : 0\n \n vpc_id = local.vpc_id\n- cidr_block = element(concat(var.public_subnets, [\"\"]), count.index)\n+ cidr_block = element(concat(var.public-app_subnets, [\"\"]), count.index)\n availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n map_public_ip_on_launch = var.map_public_ip_on_launch\n@@ -341,13 +341,41 @@ resource \"aws_subnet\" \"public\" {\n tags = merge(\n {\n \"Name\" = format(\n- \"%s-${var.public_subnet_suffix}-%s\",\n+ \"%s-${var.public-app_subnet_suffix}-%s\",\n var.name,\n element(var.azs, count.index),\n )\n },\n var.tags,\n- var.public_subnet_tags,\n+ var.public-app_subnet_tags,\n+ )\n+}\n+\n+################\n+# Public-Network subnet\n+################\n+resource \"aws_subnet\" \"public-network\" {\n+ count = var.create_vpc && length(var.public-network_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-network_subnets) >= length(var.azs)) ? length(var.public-network_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = element(concat(var.public-network_subnets, [\"\"]), count.index)\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ map_public_ip_on_launch = var.map_public_ip_on_launch\n+ assign_ipv6_address_on_creation = var.public_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.public_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.public_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.public_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"%s-${var.public-network_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.public-network_subnet_tags,\n )\n }\n \n---\noutputs.tf\n@@ -88,24 +88,44 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private.*.ipv6_cidr_block\n }\n \n-output \"public_subnets\" {\n+output \"public-app_subnets\" {\n description = \"List of IDs of public subnets\"\n- value = aws_subnet.public.*.id\n+ value = aws_subnet.public-app.*.id\n }\n \n-output \"public_subnet_arns\" {\n+output \"public-network_subnets\" {\n+ description = \"List of IDs of public subnets\"\n+ value = aws_subnet.public-network.*.id\n+}\n+\n+output \"public-app_subnet_arns\" {\n+ description = \"List of ARNs of public subnets\"\n+ value = aws_subnet.public-app.*.arn\n+}\n+\n+output \"public-network_subnet_arns\" {\n description = \"List of ARNs of public subnets\"\n- value = aws_subnet.public.*.arn\n+ value = aws_subnet.public-network.*.arn\n }\n \n-output \"public_subnets_cidr_blocks\" {\n+output \"public-app_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public.*.cidr_block\n+ value = aws_subnet.public-app.*.cidr_block\n+}\n+\n+output \"public-network_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of public subnets\"\n+ value = aws_subnet.public-network.*.cidr_block\n+}\n+\n+output \"public-app_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.public-app.*.ipv6_cidr_block\n }\n \n-output \"public_subnets_ipv6_cidr_blocks\" {\n+output \"public-network_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public.*.ipv6_cidr_block\n+ value = aws_subnet.public-network.*.ipv6_cidr_block\n }\n \n output \"database_subnets\" {\n---\nvariables.tf\n@@ -148,8 +148,14 @@ variable \"elasticache_subnet_suffix\" {\n default = \"elasticache\"\n }\n \n-variable \"public_subnets\" {\n- description = \"A list of public subnets inside the VPC\"\n+variable \"public-app_subnets\" {\n+ description = \"A list of public-app subnets inside the VPC\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"public-network_subnets\" {\n+ description = \"A list of public-network subnets inside the VPC\"\n type = list(string)\n default = []\n }\n@@ -1955,7 +1961,13 @@ variable \"igw_tags\" {\n default = {}\n }\n \n-variable \"public_subnet_tags\" {\n+variable \"public-app_subnet_tags\" {\n+ description = \"Additional tags for the public subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n+variable \"public-network_subnet_tags\" {\n description = \"Additional tags for the public subnets\"\n type = map(string)\n default = {}\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -324,13 +324,13 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n ################\n-# Public subnet\n+# Public-App subnet\n ################\n-resource \"aws_subnet\" \"public\" {\n- count = var.create_vpc && length(var.public_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public_subnets) >= length(var.azs)) ? length(var.public_subnets) : 0\n+resource \"aws_subnet\" \"public-app\" {\n+ count = var.create_vpc && length(var.public-app_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-app_subnets) >= length(var.azs)) ? length(var.public-app_subnets) : 0\n \n vpc_id = local.vpc_id\n- cidr_block = element(concat(var.public_subnets, [\"\"]), count.index)\n+ cidr_block = element(concat(var.public-app_subnets, [\"\"]), count.index)\n availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n map_public_ip_on_launch = var.map_public_ip_on_launch\n@@ -341,13 +341,41 @@ resource \"aws_subnet\" \"public\" {\n tags = merge(\n {\n \"Name\" = format(\n- \"%s-${var.public_subnet_suffix}-%s\",\n+ \"%s-${var.public-app_subnet_suffix}-%s\",\n var.name,\n element(var.azs, count.index),\n )\n },\n var.tags,\n- var.public_subnet_tags,\n+ var.public-app_subnet_tags,\n+ )\n+}\n+\n+################\n+# Public-Network subnet\n+################\n+resource \"aws_subnet\" \"public-network\" {\n+ count = var.create_vpc && length(var.public-network_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-network_subnets) >= length(var.azs)) ? length(var.public-network_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = element(concat(var.public-network_subnets, [\"\"]), count.index)\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ map_public_ip_on_launch = var.map_public_ip_on_launch\n+ assign_ipv6_address_on_creation = var.public_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.public_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = && length(var.public_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.public_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"%s-${var.public-network_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.public-network_subnet_tags,\n )\n }\n \n---\noutputs.tf\n@@ -88,24 +88,44 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private.*.ipv6_cidr_block\n }\n \n-output \"public_subnets\" {\n+output \"public-app_subnets\" {\n description = \"List of IDs of public subnets\"\n- value = aws_subnet.public.*.id\n+ value = aws_subnet.public-app.*.id\n }\n \n-output \"public_subnet_arns\" {\n+output \"public-network_subnets\" {\n+ description = \"List of IDs of public subnets\"\n+ value = aws_subnet.public-network.*.id\n+}\n+\n+output \"public-app_subnet_arns\" {\n+ description = \"List of ARNs of public subnets\"\n+ value = aws_subnet.public-app.*.arn\n+}\n+\n+output \"public-network_subnet_arns\" {\n description = \"List of ARNs of public subnets\"\n- value = aws_subnet.public.*.arn\n+ value = aws_subnet.public-network.*.arn\n }\n \n-output \"public_subnets_cidr_blocks\" {\n+output \"public-app_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public.*.cidr_block\n+ value = aws_subnet.public-app.*.cidr_block\n+}\n+\n+output \"public-network_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of public subnets\"\n+ value = aws_subnet.public-network.*.cidr_block\n+}\n+\n+output \"public-app_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.public-app.*.ipv6_cidr_block\n }\n \n-output \"public_subnets_ipv6_cidr_blocks\" {\n+output \"public-network_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public.*.ipv6_cidr_block\n+ value = aws_subnet.public-network.*.ipv6_cidr_block\n }\n \n output \"database_subnets\" {\n---\nvariables.tf\n@@ -148,8 +148,14 @@ variable \"elasticache_subnet_suffix\" {\n default = \"elasticache\"\n }\n \n-variable \"public_subnets\" {\n- description = \"A list of public subnets inside the VPC\"\n+variable \"public-app_subnets\" {\n+ description = \"A list of public-app subnets inside the VPC\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"public-network_subnets\" {\n+ description = \"A list of public-network subnets inside the VPC\"\n type = list(string)\n default = []\n }\n@@ -1955,7 +1961,13 @@ variable \"igw_tags\" {\n default = {}\n }\n \n-variable \"public_subnet_tags\" {\n+variable \"public-app_subnet_tags\" {\n+ description = \"Additional tags for the public subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n+variable \"public-network_subnet_tags\" {\n description = \"Additional tags for the public subnets\"\n type = map(string)\n default = {}\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -324,13 +324,13 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n ################\n-# Public subnet\n+# Public-App subnet\n ################\n-resource \"aws_subnet\" \"public\" {\n- count = var.create_vpc && length(var.public_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public_subnets) >= length(var.azs)) ? length(var.public_subnets) : 0\n+resource \"aws_subnet\" \"public-app\" {\n+ count = var.create_vpc && length(var.public-app_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-app_subnets) >= length(var.azs)) ? length(var.public-app_subnets) : 0\n \n vpc_id = local.vpc_id\n- cidr_block = element(concat(var.public_subnets, [\"\"]), count.index)\n+ cidr_block = element(concat(var.public-app_subnets, [\"\"]), count.index)\n availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n map_public_ip_on_launch = var.map_public_ip_on_launch\n@@ -341,13 +341,41 @@ resource \"aws_subnet\" \"public\" {\n tags = merge(\n {\n \"Name\" = format(\n- \"%s-${var.public_subnet_suffix}-%s\",\n+ \"%s-${var.public-app_subnet_suffix}-%s\",\n var.name,\n element(var.azs, count.index),\n )\n },\n var.tags,\n- var.public_subnet_tags,\n+ var.public-app_subnet_tags,\n+ )\n+}\n+\n+################\n+# Public-Network subnet\n+################\n+resource \"aws_subnet\" \"public-network\" {\n+ count = var.create_vpc && length(var.public-network_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-network_subnets) >= length(var.azs)) ? length(var.public-network_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = element(concat(var.public-network_subnets, [\"\"]), count.index)\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ map_public_ip_on_launch = var.map_public_ip_on_launch\n+ assign_ipv6_address_on_creation = var.public_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.public_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.public_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.public_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"%s-${var.public-network_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.public-network_subnet_tags,\n )\n }\n \n---\noutputs.tf\n@@ -88,24 +88,44 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private.*.ipv6_cidr_block\n }\n \n-output \"public_subnets\" {\n+output \"public-app_subnets\" {\n description = \"List of IDs of public subnets\"\n- value = aws_subnet.public.*.id\n+ value = aws_subnet.public-app.*.id\n }\n \n-output \"public_subnet_arns\" {\n+output \"public-network_subnets\" {\n+ description = \"List of IDs of public subnets\"\n+ value = aws_subnet.public-network.*.id\n+}\n+\n+output \"public-app_subnet_arns\" {\n+ description = \"List of ARNs of public subnets\"\n+ value = aws_subnet.public-app.*.arn\n+}\n+\n+output \"public-network_subnet_arns\" {\n description = \"List of ARNs of public subnets\"\n- value = aws_subnet.public.*.arn\n+ value = aws_subnet.public-network.*.arn\n }\n \n-output \"public_subnets_cidr_blocks\" {\n+output \"public-app_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public.*.cidr_block\n+ value = aws_subnet.public-app.*.cidr_block\n+}\n+\n+output \"public-network_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of public subnets\"\n+ value = aws_subnet.public-network.*.cidr_block\n+}\n+\n+output \"public-app_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.public-app.*.ipv6_cidr_block\n }\n \n-output \"public_subnets_ipv6_cidr_blocks\" {\n+output \"public-network_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public.*.ipv6_cidr_block\n+ value = aws_subnet.public-network.*.ipv6_cidr_block\n }\n \n output \"database_subnets\" {\n---\nvariables.tf\n@@ -148,8 +148,14 @@ variable \"elasticache_subnet_suffix\" {\n default = \"elasticache\"\n }\n \n-variable \"public_subnets\" {\n- description = \"A list of public subnets inside the VPC\"\n+variable \"public-app_subnets\" {\n+ description = \"A list of public-app subnets inside the VPC\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"public-network_subnets\" {\n+ description = \"A list of public-network subnets inside the VPC\"\n type = list(string)\n default = []\n }\n@@ -1955,7 +1961,13 @@ variable \"igw_tags\" {\n default = {}\n }\n \n-variable \"public_subnet_tags\" {\n+variable \"public-app_subnet_tags\" {\n+ description = \"Additional tags for the public subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n+variable \"public-network_subnet_tags\" {\n description = \"Additional tags for the public subnets\"\n type = map(string)\n default = {}\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -324,13 +324,13 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n ################\n-# Public subnet\n+# Public-App subnet\n ################\n-resource \"aws_subnet\" \"public\" {\n- count = var.create_vpc && length(var.public_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public_subnets) >= length(var.azs)) ? length(var.public_subnets) : 0\n+resource \"aws_subnet\" \"public-app\" {\n+ count = var.create_vpc && length(var.public-app_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-app_subnets) >= length(var.azs)) ? length(var.public-app_subnets) : 0\n \n vpc_id = local.vpc_id\n- cidr_block = element(concat(var.public_subnets, [\"\"]), count.index)\n+ cidr_block = element(concat(var.public-app_subnets, [\"\"]), count.index)\n availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n map_public_ip_on_launch = var.map_public_ip_on_launch\n@@ -341,13 +341,41 @@ resource \"aws_subnet\" \"public\" {\n tags = merge(\n {\n \"Name\" = format(\n- \"%s-${var.public_subnet_suffix}-%s\",\n+ \"%s-${var.public-app_subnet_suffix}-%s\",\n var.name,\n element(var.azs, count.index),\n )\n },\n var.tags,\n- var.public_subnet_tags,\n+ var.public-app_subnet_tags,\n+ )\n+}\n+\n+################\n+# Public-Network subnet\n+################\n+resource \"aws_subnet\" \"public-network\" {\n+ count = var.create_vpc && length(var.public-network_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-network_subnets) >= length(var.azs)) ? length(var.public-network_subnets) : 0\n+\n+ -341,13 vpc_id = local.vpc_id\n+ cidr_block = element(concat(var.public-network_subnets, [\"\"]), count.index)\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ map_public_ip_on_launch = var.map_public_ip_on_launch\n+ assign_ipv6_address_on_creation = var.public_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.public_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.public_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.public_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"%s-${var.public-network_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.public-network_subnet_tags,\n )\n }\n \n---\noutputs.tf\n@@ -88,24 +88,44 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private.*.ipv6_cidr_block\n }\n \n-output \"public_subnets\" {\n+output \"public-app_subnets\" {\n description = \"List of IDs of public subnets\"\n- value = aws_subnet.public.*.id\n+ value = aws_subnet.public-app.*.id\n }\n \n-output \"public_subnet_arns\" {\n+output \"public-network_subnets\" {\n+ description = \"List of IDs of public subnets\"\n+ value = aws_subnet.public-network.*.id\n+}\n+\n+output \"public-app_subnet_arns\" {\n+ description = \"List of ARNs of public subnets\"\n+ value = aws_subnet.public-app.*.arn\n+}\n+\n+output \"public-network_subnet_arns\" {\n description = \"List of ARNs of public subnets\"\n- value = aws_subnet.public.*.arn\n+ value = aws_subnet.public-network.*.arn\n }\n \n-output \"public_subnets_cidr_blocks\" {\n+output \"public-app_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public.*.cidr_block\n+ value = aws_subnet.public-app.*.cidr_block\n+}\n+\n+output \"public-network_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of public subnets\"\n+ value = aws_subnet.public-network.*.cidr_block\n+}\n+\n+output \"public-app_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.public-app.*.ipv6_cidr_block\n }\n \n-output \"public_subnets_ipv6_cidr_blocks\" {\n+output \"public-network_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public.*.ipv6_cidr_block\n+ value = aws_subnet.public-network.*.ipv6_cidr_block\n }\n \n output \"database_subnets\" {\n---\nvariables.tf\n@@ -148,8 +148,14 @@ variable \"elasticache_subnet_suffix\" {\n default = \"elasticache\"\n }\n \n-variable \"public_subnets\" {\n- description = \"A list of public subnets inside the VPC\"\n+variable \"public-app_subnets\" {\n+ description = \"A list of public-app subnets inside the VPC\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"public-network_subnets\" {\n+ description = \"A list of public-network subnets inside the VPC\"\n type = list(string)\n default = []\n }\n@@ -1955,7 +1961,13 @@ variable \"igw_tags\" {\n default = {}\n }\n \n-variable \"public_subnet_tags\" {\n+variable \"public-app_subnet_tags\" {\n+ description = \"Additional tags for the public subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n+variable \"public-network_subnet_tags\" {\n description = \"Additional tags for the public subnets\"\n type = map(string)\n default = {}\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nFixes #551 \r\nChanges the descriptions of \r\ndefault_vpc_id\r\ndefault_vpc_arn\r\ndefault_vpc_cidr_block\r\ndefault_vpc_default_network_acl_id\r\ndefault_vpc_route_tabnle_id\r\ndefault_vpc_security_group_id\r\ndefault_vpc_enable_dns_hostnames\r\ndefault_vpc_enable_dns_support\r\ndefault_vpc_instance_tenancy\r\ndefault_vpc_main_route_table_id\r\nin both README.md and outputs.tf to avoid confusion.\n\n---\n\nChoice A:\nREADME.md\n@@ -673,16 +673,16 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | default\\_network\\_acl\\_id | The ID of the default network ACL |\n | default\\_route\\_table\\_id | The ID of the default route table |\n | default\\_security\\_group\\_id | The ID of the security group created by default on VPC creation |\n-| default\\_vpc\\_arn | The ARN of the VPC |\n-| default\\_vpc\\_cidr\\_block | The CIDR block of the VPC |\n-| default\\_vpc\\_default\\_network\\_acl\\_id | The ID of the default network ACL |\n-| default\\_vpc\\_default\\_route\\_table\\_id | The ID of the default route table |\n-| default\\_vpc\\_default\\_security\\_group\\_id | The ID of the security group created by default on VPC creation |\n-| default\\_vpc\\_enable\\_dns\\_hostnames | Whether or not the VPC has DNS hostname support |\n-| default\\_vpc\\_enable\\_dns\\_support | Whether or not the VPC has DNS support |\n-| default\\_vpc\\_id | The ID of the VPC |\n-| default\\_vpc\\_instance\\_tenancy | Tenancy of instances spin up within VPC |\n-| default\\_vpc\\_main\\_route\\_table\\_id | The ID of the main route table associated with this VPC |\n+| default\\_vpc\\_arn | The ARN of the Default VPC |\n+| default\\_vpc\\_cidr\\_block | The CIDR block of the Default VPC |\n+| default\\_vpc\\_default\\_network\\_acl\\_id | The ID of the default network ACL of the Default VPC |\n+| default\\_vpc\\_default\\_route\\_table\\_id | The ID of the default route table of the Default VPC |\n+| default\\_vpc\\_default\\_security\\_group\\_id | The ID of the security group created by default on Default VPC creation |\n+| default\\_vpc\\_enable\\_dns\\_hostnames | Whether or not the Default VPC has DNS hostname support |\n+| default\\_vpc\\_enable\\_dns\\_support | Whether or not the Default VPC has DNS support |\n+| default\\_vpc\\_id | The ID of the Default VPC |\n+| default\\_vpc\\_instance\\_tenancy | Tenancy of instances spin up within Default VPC |\n+| default\\_vpc\\_main\\_route\\_table\\_id | The ID of the main route table associated with the Default VPC |\n | egress\\_only\\_internet\\_gateway\\_id | The ID of the egress only Internet Gateway |\n | elasticache\\_network\\_acl\\_arn | ARN of the elasticache network ACL |\n | elasticache\\_network\\_acl\\_id | ID of the elasticache network ACL |\n---\noutputs.tf\n@@ -368,52 +368,52 @@ output \"vgw_arn\" {\n }\n \n output \"default_vpc_id\" {\n- description = \"The ID of the VPC\"\n+ description = \"The ID of the Default VPC\"\n value = concat(aws_default_vpc.this.*.id, [\"\"])[0]\n }\n \n output \"default_vpc_arn\" {\n- description = \"The ARN of the VPC\"\n+ description = \"The ARN of the Default VPC\"\n value = concat(aws_default_vpc.this.*.arn, [\"\"])[0]\n }\n \n output \"default_vpc_cidr_block\" {\n- description = \"The CIDR block of the VPC\"\n+ description = \"The CIDR block of the Default VPC\"\n value = concat(aws_default_vpc.this.*.cidr_block, [\"\"])[0]\n }\n \n output \"default_vpc_default_security_group_id\" {\n- description = \"The ID of the security group created by default on VPC creation\"\n+ description = \"The ID of the security group created by default on Default VPC creation\"\n value = concat(aws_default_vpc.this.*.default_security_group_id, [\"\"])[0]\n }\n \n output \"default_vpc_default_network_acl_id\" {\n- description = \"The ID of the default network ACL\"\n+ description = \"The ID of the default network ACL of the Default VPC\"\n value = concat(aws_default_vpc.this.*.default_network_acl_id, [\"\"])[0]\n }\n \n output \"default_vpc_default_route_table_id\" {\n- description = \"The ID of the default route table\"\n+ description = \"The ID of the default route table of the Default VPC\"\n value = concat(aws_default_vpc.this.*.default_route_table_id, [\"\"])[0]\n }\n \n output \"default_vpc_instance_tenancy\" {\n- description = \"Tenancy of instances spin up within VPC\"\n+ description = \"Tenancy of instances spin up within Default VPC\"\n value = concat(aws_default_vpc.this.*.instance_tenancy, [\"\"])[0]\n }\n \n output \"default_vpc_enable_dns_support\" {\n- description = \"Whether or not the VPC has DNS support\"\n+ description = \"Whether or not the Default VPC has DNS support\"\n value = concat(aws_default_vpc.this.*.enable_dns_support, [\"\"])[0]\n }\n \n output \"default_vpc_enable_dns_hostnames\" {\n- description = \"Whether or not the VPC has DNS hostname support\"\n+ description = \"Whether or not the Default VPC has DNS hostname support\"\n value = concat(aws_default_vpc.this.*.enable_dns_hostnames, [\"\"])[0]\n }\n \n output \"default_vpc_main_route_table_id\" {\n- description = \"The ID of the main route table associated with this VPC\"\n+ description = \"The ID of the main route table associated with the Default VPC\"\n value = concat(aws_default_vpc.this.*.main_route_table_id, [\"\"])[0]\n }\n \n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -673,16 +673,16 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | default\\_network\\_acl\\_id | The ID of the default network ACL |\n | default\\_route\\_table\\_id | The ID of the default route table |\n | default\\_security\\_group\\_id | The ID of the security group created by default on VPC creation |\n-| default\\_vpc\\_arn | The ARN of the VPC |\n-| default\\_vpc\\_cidr\\_block | The CIDR block of the VPC |\n-| default\\_vpc\\_default\\_network\\_acl\\_id | The ID of the default network ACL |\n-| default\\_vpc\\_default\\_route\\_table\\_id | The ID of the default route table |\n-| default\\_vpc\\_default\\_security\\_group\\_id | The ID of the security group created by default on VPC creation |\n-| default\\_vpc\\_enable\\_dns\\_hostnames | Whether or not the VPC has DNS hostname support |\n-| default\\_vpc\\_enable\\_dns\\_support | Whether or not the VPC has DNS support |\n-| default\\_vpc\\_id | The ID of the VPC |\n-| default\\_vpc\\_instance\\_tenancy | Tenancy of instances spin up within VPC |\n-| default\\_vpc\\_main\\_route\\_table\\_id | The ID of the main route table associated with this VPC |\n+| default\\_vpc\\_arn | The ARN of the Default VPC |\n+| default\\_vpc\\_cidr\\_block | The CIDR block of the Default VPC |\n+| default\\_vpc\\_default\\_network\\_acl\\_id | The ID of the default network ACL of the Default VPC |\n+| default\\_vpc\\_default\\_route\\_table\\_id | The ID of the default route table of the Default VPC |\n+| default\\_vpc\\_default\\_security\\_group\\_id | The ID of the security group created by default on Default VPC creation |\n+| default\\_vpc\\_enable\\_dns\\_hostnames | Whether or not the Default VPC has DNS hostname support |\n+| default\\_vpc\\_enable\\_dns\\_support | Whether or not the Default VPC has DNS support |\n+| default\\_vpc\\_id | The ID of the Default VPC |\n+| default\\_vpc\\_instance\\_tenancy | Tenancy of instances spin up within Default VPC |\n+| default\\_vpc\\_main\\_route\\_table\\_id | The ID \n the main route table associated with the Default VPC |\n | egress\\_only\\_internet\\_gateway\\_id | The ID of the egress only Internet Gateway |\n | elasticache\\_network\\_acl\\_arn | ARN of the elasticache network ACL |\n | elasticache\\_network\\_acl\\_id | ID of the elasticache network ACL |\n---\noutputs.tf\n@@ -368,52 +368,52 @@ output \"vgw_arn\" {\n }\n \n output \"default_vpc_id\" {\n- description = \"The ID of the VPC\"\n+ description = \"The ID of the Default VPC\"\n value = concat(aws_default_vpc.this.*.id, [\"\"])[0]\n }\n \n output \"default_vpc_arn\" {\n- description = \"The ARN of the VPC\"\n+ description = \"The ARN of the Default VPC\"\n value = concat(aws_default_vpc.this.*.arn, [\"\"])[0]\n }\n \n output \"default_vpc_cidr_block\" {\n- description = \"The CIDR block of the VPC\"\n+ description = \"The CIDR block of the Default VPC\"\n value = concat(aws_default_vpc.this.*.cidr_block, [\"\"])[0]\n }\n \n output \"default_vpc_default_security_group_id\" {\n- description = \"The ID of the security group created by default on VPC creation\"\n+ description = \"The ID of the security group created by default on Default VPC creation\"\n value = concat(aws_default_vpc.this.*.default_security_group_id, [\"\"])[0]\n }\n \n output \"default_vpc_default_network_acl_id\" {\n- description = \"The ID of the default network ACL\"\n+ description = \"The ID of the default network ACL of the Default VPC\"\n value = concat(aws_default_vpc.this.*.default_network_acl_id, [\"\"])[0]\n }\n \n output \"default_vpc_default_route_table_id\" {\n- description = \"The ID of the default route table\"\n+ description = \"The ID of the default route table of the Default VPC\"\n value = concat(aws_default_vpc.this.*.default_route_table_id, [\"\"])[0]\n }\n \n output \"default_vpc_instance_tenancy\" {\n- description = \"Tenancy of instances spin up within VPC\"\n+ description = \"Tenancy of instances spin up within Default VPC\"\n value = concat(aws_default_vpc.this.*.instance_tenancy, [\"\"])[0]\n }\n \n output \"default_vpc_enable_dns_support\" {\n- description = \"Whether or not the VPC has DNS support\"\n+ description = \"Whether or not the Default VPC has DNS support\"\n value = concat(aws_default_vpc.this.*.enable_dns_support, [\"\"])[0]\n }\n \n output \"default_vpc_enable_dns_hostnames\" {\n- description = \"Whether or not the VPC has DNS hostname support\"\n+ description = \"Whether or not the Default VPC has DNS hostname support\"\n value = concat(aws_default_vpc.this.*.enable_dns_hostnames, [\"\"])[0]\n }\n \n output \"default_vpc_main_route_table_id\" {\n- description = \"The ID of the main route table associated with this VPC\"\n+ description = \"The ID of the main route table associated with the Default VPC\"\n value = concat(aws_default_vpc.this.*.main_route_table_id, [\"\"])[0]\n }\n \n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -673,16 +673,16 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | default\\_network\\_acl\\_id | The ID of the default network ACL |\n | default\\_route\\_table\\_id | The ID of the default route table |\n | default\\_security\\_group\\_id | The ID of the security group created by default on VPC creation |\n-| default\\_vpc\\_arn | The ARN of the VPC |\n-| default\\_vpc\\_cidr\\_block | The CIDR block of the VPC |\n-| default\\_vpc\\_default\\_network\\_acl\\_id | The ID of the default network ACL |\n-| default\\_vpc\\_default\\_route\\_table\\_id | The ID of the default route table |\n-| default\\_vpc\\_default\\_security\\_group\\_id | The ID of the security group created by default on VPC creation |\n-| default\\_vpc\\_enable\\_dns\\_hostnames | Whether or not the VPC has DNS hostname support |\n-| default\\_vpc\\_enable\\_dns\\_support | Whether or not the VPC has DNS support |\n-| default\\_vpc\\_id | The ID of the VPC |\n-| default\\_vpc\\_instance\\_tenancy | Tenancy of instances spin up within VPC |\n-| default\\_vpc\\_main\\_route\\_table\\_id | The ID of the main route table associated with this VPC |\n+| default\\_vpc\\_arn | The ARN of the Default VPC |\n+| default\\_vpc\\_cidr\\_block | The CIDR block of the Default VPC |\n+| default\\_vpc\\_default\\_network\\_acl\\_id | The ID of the default network ACL of the Default VPC |\n+| default\\_vpc\\_default\\_route\\_table\\_id | The ID of the default route table of the Default VPC |\n+| default\\_vpc\\_default\\_security\\_group\\_id | The ID of the security group created by default on Default VPC creation |\n+| default\\_vpc\\_enable\\_dns\\_hostnames | Whether or not the Default VPC has DNS hostname support |\n+| default\\_vpc\\_enable\\_dns\\_support | Whether or not the Default VPC has DNS support |\n+| default\\_vpc\\_id | The ID of the Default VPC |\n+| default\\_vpc\\_instance\\_tenancy | Tenancy of instances spin up within Default VPC |\n+| default\\_vpc\\_main\\_route\\_table\\_id | The ID of the main route table associated with the Default VPC |\n | egress\\_only\\_internet\\_gateway\\_id | The ID of the egress only Internet Gateway |\n | elasticache\\_network\\_acl\\_arn | ARN of the elasticache network ACL |\n | elasticache\\_network\\_acl\\_id | ID of the elasticache network ACL |\n---\noutputs.tf\n@@ -368,52 +368,52 @@ output \"vgw_arn\" {\n }\n \n output \"default_vpc_id\" {\n- description = \"The ID of the VPC\"\n+ description = \"The ID of the Default VPC\"\n value = concat(aws_default_vpc.this.*.id, [\"\"])[0]\n }\n \n output \"default_vpc_arn\" {\n- description = \"The ARN of the VPC\"\n+ description = \"The ARN of the Default VPC\"\n value = concat(aws_default_vpc.this.*.arn, [\"\"])[0]\n }\n \n output \"default_vpc_cidr_block\" {\n- description = \"The CIDR block of the VPC\"\n+ description = \"The CIDR block of the Default VPC\"\n value = concat(aws_default_vpc.this.*.cidr_block, [\"\"])[0]\n }\n \n output \"default_vpc_default_security_group_id\" {\n- description = \"The ID of the security group created by default on VPC creation\"\n+ description = \"The ID of the security group created by default on Default VPC creation\"\n value = concat(aws_default_vpc.this.*.default_security_group_id, [\"\"])[0]\n }\n \n output \"default_vpc_default_network_acl_id\" {\n- description = \"The ID of the default network ACL\"\n+ description = \"The ID of the default network ACL of the Default VPC\"\n value = concat(aws_default_vpc.this.*.default_network_acl_id, [\"\"])[0]\n }\n \n output \"default_vpc_default_route_table_id\" {\n- description = \"The ID of the default route table\"\n+ description = \"The ID of the default route table of the Default VPC\"\n value The = concat(aws_default_vpc.this.*.default_route_table_id, [\"\"])[0]\n }\n \n output \"default_vpc_instance_tenancy\" {\n- description = \"Tenancy of instances spin up within VPC\"\n+ description = \"Tenancy of instances spin up within Default VPC\"\n value = concat(aws_default_vpc.this.*.instance_tenancy, [\"\"])[0]\n }\n \n output \"default_vpc_enable_dns_support\" {\n- description = \"Whether or not the VPC has DNS support\"\n+ description = \"Whether or not the Default VPC has DNS support\"\n value = concat(aws_default_vpc.this.*.enable_dns_support, [\"\"])[0]\n }\n \n output \"default_vpc_enable_dns_hostnames\" {\n- description = \"Whether or not the VPC has DNS hostname support\"\n+ description = \"Whether or not the Default VPC has DNS hostname support\"\n value = concat(aws_default_vpc.this.*.enable_dns_hostnames, [\"\"])[0]\n }\n \n output \"default_vpc_main_route_table_id\" {\n- description = \"The ID of the main route table associated with this VPC\"\n+ description = \"The ID of the main route table associated with the Default VPC\"\n value = concat(aws_default_vpc.this.*.main_route_table_id, [\"\"])[0]\n }\n \n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -673,16 +673,16 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | default\\_network\\_acl\\_id | The ID of the default network ACL |\n | default\\_route\\_table\\_id | The ID of the default route table |\n | default\\_security\\_group\\_id | The ID of the security group created by default on VPC creation |\n-| default\\_vpc\\_arn | The ARN of the VPC |\n-| default\\_vpc\\_cidr\\_block | The CIDR block of the VPC |\n-| default\\_vpc\\_default\\_network\\_acl\\_id | The ID of the default network ACL |\n-| default\\_vpc\\_default\\_route\\_table\\_id | The ID of the default route table |\n-| default\\_vpc\\_default\\_security\\_group\\_id | The ID of the security group created by default on VPC creation |\n-| default\\_vpc\\_enable\\_dns\\_hostnames | Whether or not the VPC has DNS hostname support |\n-| default\\_vpc\\_enable\\_dns\\_support | Whether or not the VPC has DNS support |\n-| default\\_vpc\\_id | The ID of the VPC |\n-| default\\_vpc\\_instance\\_tenancy | Tenancy of instances spin up within VPC |\n-| default\\_vpc\\_main\\_route\\_table\\_id | The ID of the main route table associated with this VPC |\n+| default\\_vpc\\_arn | The ARN of the Default VPC |\n+| default\\_vpc\\_cidr\\_block | The CIDR block of the Default VPC |\n+| default\\_vpc\\_default\\_network\\_acl\\_id | The ID of the default network ACL of the Default VPC |\n+| default\\_vpc\\_default\\_route\\_table\\_id | The ID of the default route table of the Default VPC |\n+| default\\_vpc\\_default\\_security\\_group\\_id | The ID of the security group created by default on Default VPC creation |\n+| default\\_vpc\\_enable\\_dns\\_hostnames | Whether or not the Default VPC has DNS hostname support |\n+| default\\_vpc\\_enable\\_dns\\_support | Whether or not the Default VPC has DNS support |\n+| default\\_vpc\\_id | The ID of the Default VPC |\n+| default\\_vpc\\_instance\\_tenancy | Tenancy of instances spin up within Default VPC |\n+| default\\_vpc\\_main\\_route\\_table\\_id | The ID of the main route table associated with the Default VPC |\n | egress\\_only\\_internet\\_gateway\\_id | The ID of the egress only Internet Gateway |\n | elasticache\\_network\\_acl\\_arn | ARN of the elasticache network ACL |\n | elasticache\\_network\\_acl\\_id | ID of the elasticache network ACL |\n---\noutputs.tf\n@@ -368,52 +368,52 @@ output \"vgw_arn\" {\n }\n \n output \"default_vpc_id\" {\n- description = \"The ID of the VPC\"\n+ description = \"The ID of the Default VPC\"\n value = concat(aws_default_vpc.this.*.id, [\"\"])[0]\n }\n \n output \"default_vpc_arn\" {\n- description = \"The ARN of the VPC\"\n+ description = \"The ARN of the Default VPC\"\n value = concat(aws_default_vpc.this.*.arn, [\"\"])[0]\n }\n \n output \"default_vpc_cidr_block\" {\n- description = \"The CIDR block of the VPC\"\n+ description = \"The CIDR block of the Default VPC\"\n value = concat(aws_default_vpc.this.*.cidr_block, [\"\"])[0]\n }\n \n output \"default_vpc_default_security_group_id\" {\n- description = \"The ID of the security group created by default on VPC creation\"\n+ description = \"The ID of the security group created by default on Default VPC creation\"\n value = concat(aws_default_vpc.this.*.default_security_group_id, [\"\"])[0]\n }\n \n output \"default_vpc_default_network_acl_id\" {\n- description = \"The ID of the default network ACL\"\n+ description = \"The ID of the default network ACL of the Default VPC\"\n value = concat(aws_default_vpc.this.*.default_network_acl_id, [\"\"])[0]\n }\n \n output \"default_vpc_default_route_table_id\" {\n- description = \"The ID of the default route table\"\n+ description = \"The ID of the default route table of the Default VPC\"\n value = concat(aws_default_vpc.this.*.default_route_table_id, [\"\"])[0]\n }\n \n output \"default_vpc_instance_tenancy\" {\n- description = \"Tenancy of instances spin up within VPC\"\n+ description = \"Tenancy of instances spin up within Default VPC\"\n value = concat(aws_default_vpc.this.*.instance_tenancy, [\"\"])[0]\n }\n \n output \"default_vpc_enable_dns_support\" {\n- description = \"Whether or not the VPC has DNS support\"\n+ description = \"Whether or not the Default VPC has DNS support\"\n value = concat(aws_default_vpc.this.*.enable_dns_support, [\"\"])[0]\n }\n \n output \"default_vpc_enable_dns_hostnames\" {\n- description = \"Whether or not the VPC has DNS hostname support\"\n+ description = \"Whether or not the Default VPC has DNS hostname support\"\n value = concat(aws_default_vpc.this.*.enable_dns_hostnames, [\"\"])[0]\n }\n \n output \"default_vpc_main_route_table_id\" {\n- description = \"The ID of the main route table associated with this VPC\"\n+ description = \"The ID of the main route \n associated with the Default VPC\"\n value = concat(aws_default_vpc.this.*.main_route_table_id, [\"\"])[0]\n }\n \n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n## Motivation and Context\r\nThis permission is not needed because we create the log group with Terraform so the VPC Flow Logs service doesn\u2019t need to do it. On the other hand having this permission causes a bug where, on terraform destroy the log group will be destroyed, but then if there is still a few messages in a VPC Flow Logs queue the managed service will see that the log group does not exist and create it again using.\r\n\r\nYou\u2019ll then have the log group lingering after the tf destroy, which can cause trouble if you try to terraform apply again with the same name: the log group will be already existing and your apply will fail. Not having the permission prevents that as the managed service will not be able to recreate the log group after the tf destroy.\r\n\r\n## Breaking Changes\r\nNot that I know, except if someone was reusing the created role for another purpose that depended on the permission, which seems unlikely (we don\u2019t expose the role name in the outputs, do we ?).\r\n\r\n## How Has This Been Tested?\r\nI\u2019m waiting on CI here https://github.com/trussworks/terraform-aws-vpc-flow-logs/pull/8 which is the exact same change in another module.\n\n---\n\nChoice A:\nvpc-flow-logs.tf\n@@ -90,7 +90,6 @@ data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n = \"Allow\"\n \n actions = [\n- \"logs:CreateLogGroup\",\n \"logs:CreateLogStream\",\n \"logs:PutLogEvents\",\n \"logs:DescribeLogGroups\",\n---\n\n\n---\n\nChoice B:\nvpc-flow-logs.tf\n@@ -90,7 +90,6 @@ data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n effect = \"Allow\"\n \n actions = [\n- \"logs:CreateLogGroup\",\n \"logs:CreateLogStream\",\n \"logs:PutLogEvents\",\n \"logs:DescribeLogGroups\",\n---\n\n\n---\n\nChoice C:\nvpc-flow-logs.tf\n@@ -90,7 +90,6 @@ data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n effect = \"Allow\"\n \n actions = [\n- \"logs:CreateLogGroup\",\n \"logs:CreateLogStream\",\n \"logs:PutLogEvents\",\n \"logs:DescribeLogGroups\",\n---\n\n\n---\n\nChoice D:\nvpc-flow-logs.tf\n@@ -90,7 +90,6 @@ data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n effect = \"Allow\"\n \n actions = \"logs:CreateLogGroup\",\n \"logs:CreateLogStream\",\n \"logs:PutLogEvents\",\n \"logs:DescribeLogGroups\",\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nThis commit implements a fully-automated development setup using Gitpod.io, an\nonline IDE for GitLab, GitHub, and Bitbucket that enables Dev-Environments-As-Code.\nThis makes it easy for anyone to get a ready-to-code workspace for any branch,\nissue or pull request almost instantly with a single click.\n\n---\n\nChoice A:\n.gitpod.Dockerfile\n@@ -0,0 +1,7 @@\n+FROM gitpod/workspace-full\n+\n+# Install custom tools, runtimes, etc.\n+# For example \"bastet\", a command-line tetris clone:\n+# RUN brew bastet\n+#\n+# More information: https://www.gitpod.io/docs/config-docker/\n---\n.gitpod.yml\n@@ -0,0 +1,5 @@\n+image:\n+ file: .gitpod.Dockerfile\n+\n+tasks:\n+ - init: make\n---\nREADME.md\n@@ -1,3 +1,5 @@\n+[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/terraform-aws-modules/terraform-aws-vpc)\n+\n # AWS VPC Terraform module\n \n [![Help Contribute to Open Source](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc/badges/users.svg)](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc)\n---\n\n\n---\n\nChoice B:\ntetris -0,0 +1,7 @@\n+FROM gitpod/workspace-full\n+\n+# Install custom tools, runtimes, etc.\n+# For example \"bastet\", a command-line tetris clone:\n+# RUN brew install bastet\n+#\n+# More information: https://www.gitpod.io/docs/config-docker/\n---\n.gitpod.yml\n@@ -0,0 +1,5 @@\n+image:\n+ file: .gitpod.Dockerfile\n+\n+tasks:\n+ - init: make\n---\nREADME.md\n@@ -1,3 +1,5 @@\n+[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/terraform-aws-modules/terraform-aws-vpc)\n+\n # AWS VPC Terraform module\n \n [![Help Contribute to Open Source](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc/badges/users.svg)](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc)\n---\n\n\n---\n\nChoice C:\n.gitpod.Dockerfile\n@@ -0,0 +1,7 @@\n+FROM gitpod/workspace-full\n+\n+# Install custom tools, runtimes, etc.\n+# For example \"bastet\", a command-line tetris clone:\n+# RUN brew install bastet\n+#\n+# More information: https://www.gitpod.io/docs/config-docker/\n---\n.gitpod.yml\n@@ -0,0 +1,5 @@\n+image:\n+ file: .gitpod.Dockerfile\n+\n+tasks:\n+ - init: make\n---\nREADME.md\n@@ -1,3 +1,5 @@\n+[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/terraform-aws-modules/terraform-aws-vpc)\n+\n # AWS VPC Terraform module\n \n [![Help Contribute to Open Source](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc/badges/users.svg)](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc)\n---\n\n\n---\n\nChoice D:\n.gitpod.Dockerfile\n@@ -0,0 +1,7 @@\n+FROM gitpod/workspace-full\n+\n+# Install custom tools, For etc.\n+# For example \"bastet\", a command-line tetris clone:\n+# RUN brew install bastet\n+#\n+# More information: https://www.gitpod.io/docs/config-docker/\n---\n.gitpod.yml\n@@ -0,0 +1,5 @@\n+image:\n+ file: .gitpod.Dockerfile\n+\n+tasks:\n+ - init: make\n---\nREADME.md\n@@ -1,3 +1,5 @@\n+[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/terraform-aws-modules/terraform-aws-vpc)\n+\n # AWS VPC Terraform module\n \n [![Help Contribute to Open Source](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc/badges/users.svg)](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc)\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nSigned-off-by: Lays Rodrigues \r\n\r\n## Description\r\nAdd support to tag default route table since PR #147 is getting dust.\r\n\r\n## Motivation and Context\r\nSo far this is the only resource on this module that has not set a Name by default. And I like my resources tagged :3\r\n\r\n## Breaking Changes\r\nNot that I know.\r\n\r\n## How Has This Been Tested?\r\nUsed terraform 0.14\r\n```sh\r\nterraform fmt\r\nterraform validate\r\nterraform plan\r\nterraform apply\r\n```\r\n```hcl\r\n # module.vpc.aws_default_route_table.default[0] must be replaced\r\n-/+ resource \"aws_default_route_table\" \"default\" {\r\n + default_route_table_id = \"rtb-id\"\r\n + id = (known after apply)\r\n + owner_id = (known after apply)\r\n + route = (known after apply)\r\n + tags = {\r\n + \"Name\" = \"my-rt-name\"\r\n + \"environment\" = \"development\"\r\n + \"kubernetes.io/cluster/beira-rio\" = \"shared\"\r\n }\r\n + vpc_id = (known after apply)\r\n }\r\n```\r\n```\r\nApply complete! Resources: 1 added, 0 changed, 0 destroyed.\r\n```\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -335,6 +335,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | default\\_network\\_acl\\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | default\\_network\\_acl\\_name | Name to be used on the Default Network ACL | `string` | `\"\"` | no |\n | default\\_network\\_acl\\_tags | Additional tags for the Default Network ACL | `map(string)` | `{}` | no |\n+| default\\_route\\_table\\_tags | Additional tags for |\n Default Route Table | `map(string)` | `{}` | no |\n | default\\_security\\_group\\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_name | Name to be used on the default security group | `string` | `\"default\"` | no |\n---\nmain.tf\n@@ -160,6 +160,22 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n )\n }\n \n+\n+################\n+# Default route\n+################\n+resource \"aws_default_route_table\" \"default\" {\n+ count = var.create_vpc ? 1 : 0\n+ default_route_table_id = aws_vpc.this[0].default_route_table_id\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", var.name)\n+ },\n+ var.tags,\n+ var.default_route_table_tags,\n+ )\n+}\n+\n ################\n # Publi\u0441 routes\n ################\n---\nvariables.tf\n@@ -2602,3 +2602,9 @@ variable \"create_egress_only_igw\" {\n type = bool\n default = true\n }\n+\n+variable \"default_route_table_tags\" {\n+ description = \"Additional tags for the Default Route Table\"\n+ type = map(string)\n+ default = {}\n+}\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -335,6 +335,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | default\\_network\\_acl\\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | default\\_network\\_acl\\_name | Name to be used on the Default Network ACL | `string` | `\"\"` | no |\n | default\\_network\\_acl\\_tags | Additional tags for the Default Network ACL | `map(string)` | `{}` | no |\n+| default\\_route\\_table\\_tags | Additional tags for the Default Route Table | `map(string)` | `{}` | no |\n | default\\_security\\_group\\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_name | Name to be used on the default security group | `string` | `\"default\"` | no |\n---\nmain.tf\n@@ -160,6 +160,22 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n )\n }\n \n+\n+################\n+# Default route\n+################\n+resource \"aws_default_route_table\" \"default\" {\n+ count = var.create_vpc ? 1 : 0\n+ default_route_table_id = aws_vpc.this[0].default_route_table_id\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", var.name)\n+ },\n+ var.tags,\n+ var.default_route_table_tags,\n+ )\n+}\n+\n ################\n # Publi\u0441 routes\n ################\n---\nvariables.tf\n@@ -2602,3 +2602,9 @@ variable \"create_egress_only_igw\" {\n type = bool\n default = true\n }\n+\n+variable \"default_route_table_tags\" {\n+ description = \"Additional tags for the Default Route Table\"\n+ type = map(string)\n+ default = {}\n+}\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -335,6 +335,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | default\\_network\\_acl\\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | default\\_network\\_acl\\_name | Name to be used on the Default Network ACL | `string` | `\"\"` | no |\n | default\\_network\\_acl\\_tags | Additional tags for the Default Network ACL | `map(string)` | `{}` | no |\n+| default\\_route\\_table\\_tags | Additional tags for the Default Route Table | `map(string)` | `{}` | no |\n | default\\_security\\_group\\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_name | Name to be used on the default security group | `string` | `\"default\"` | no |\n---\nmain.tf\n@@ -160,6 +160,22 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n -160,6 }\n \n+\n+################\n+# Default route\n+################\n+resource \"aws_default_route_table\" \"default\" {\n+ count = var.create_vpc ? 1 : 0\n+ default_route_table_id = aws_vpc.this[0].default_route_table_id\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", var.name)\n+ },\n+ var.tags,\n+ var.default_route_table_tags,\n+ )\n+}\n+\n ################\n # Publi\u0441 routes\n ################\n---\nvariables.tf\n@@ -2602,3 +2602,9 @@ variable \"create_egress_only_igw\" {\n type = bool\n default = true\n }\n+\n+variable \"default_route_table_tags\" {\n+ description = \"Additional tags for the Default Route Table\"\n+ type = map(string)\n+ default = {}\n+}\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -335,6 +335,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | default\\_network\\_acl\\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` |
[
{
\"action\": \"allow\",
\"cidr_block\": \"0.0.0.0/0\",
\"from_port\": 0,
\"protocol\": \"-1\",
\"rule_no\": 100,
\"to_port\": 0
},
{
\"action\": \"allow\",
\"from_port\": 0,
\"ipv6_cidr_block\": \"::/0\",
\"protocol\": \"-1\",
\"rule_no\": 101,
\"to_port\": 0
}
]
| no |\n | default\\_network\\_acl\\_name | Name to be used on the Default Network ACL | `string` | `\"\"` | no |\n | default\\_network\\_acl\\_tags | Additional tags for the Default Network ACL | `map(string)` | `{}` | no |\n+| default\\_route\\_table\\_tags | Additional tags for the Default Route Table | `map(string)` | `{}` | no |\n | default\\_security\\_group\\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_name | Name to be used on the default security group | `string` | `\"default\"` | no |\n---\nmain.tf\n@@ -160,6 +160,22 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n )\n }\n \n+\n+################\n+# Default route\n+################\n+resource \"aws_default_route_table\" \"default\" {\n+ count = var.create_vpc ? 1 : 0\n+ default_route_table_id = aws_vpc.this[0].default_route_table_id\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", var.name)\n+ },\n+ var.tags,\n+ var.default_route_table_tags,\n+ )\n+}\n+\n ################\n # Publi\u0441 routes\n ################\n---\nvariables.tf\n@@ -2602,3 +2602,9 @@ variable \"create_egress_only_igw\" {\n type = bool\n default = true\n }\n+\n+variable \"default_route_table_tags\" {\n+ description = \"Additional tags for the Default Route Table\"\n+ type = map(string)\n+ default = \n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nFix for `aws_route_table.private` creation.\r\n\r\n## Motivation and Context\r\n\r\n\r\nIf you are using only `elasticache_subnets` without providing `private_subnets` the \"private route tables\" will be created anyway. \r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\nWith this change, these \"private route tables\" will be removed.\r\n\r\n## How Has This Been Tested?\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\n################################################################################\n -222,7 +222,7 @@ resource \"aws_route\" \"public_internet_gateway_ipv6\" {\n ################################################################################\n \n resource \"aws_route_table\" \"private\" {\n- count = var.create_vpc && local.max_subnet_length > 0 ? local.nat_gateway_count : 0\n+ count = var.create_vpc && length(var.private_subnets) > 0 ? length(var.private_subnets) : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -222,7 +222,7 @@ resource \"aws_route\" \"public_internet_gateway_ipv6\" {\n ################################################################################\n \n resource \"aws_route_table\" \"private\" {\n- count = var.create_vpc && local.max_subnet_length > 0 ? local.nat_gateway_count : 0\n+ count = var.create_vpc && length(var.private_subnets) > 0 ? length(var.private_subnets) : 0\n \n vpc_id \n local.vpc_id\n \n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -222,7 +222,7 @@ resource \"aws_route\" \"public_internet_gateway_ipv6\" {\n ################################################################################\n \n resource \"aws_route_table\" \"private\" {\n- count = var.create_vpc && local.max_subnet_length > 0 ? local.nat_gateway_count : 0\n+ count = var.create_vpc && length(var.private_subnets) > 0 ? length(var.private_subnets) : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -222,7 +222,7 @@ resource \"aws_route\" \"public_internet_gateway_ipv6\" {\n ################################################################################\n \n resource \"aws_route_table\" \"private\" {\n- count = var.create_vpc && local.max_subnet_length > 0 ? local.nat_gateway_count : 0\n+ count = {\n && length(var.private_subnets) > 0 ? length(var.private_subnets) : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n- Just testing for now, disregard\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\n.github/workflows/static-checks.yml\n@@ -0,0 +1,73 @@\n+name: static-checks\n+\n+on:\n+ pull_request:\n+\n+jobs:\n+ versionExtract:\n+ name: Get min/max versions\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/terraform-min-max@main\n+ outputs:\n+ minVersion: ${{ steps.minMax.outputs.minVersion }}\n+ maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n+\n+ versionEvaluate:\n+ name: Evaluate Terraform versions\n+ runs-on: ubuntu-latest\n+ needs: versionExtract\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ version:\n+ - ${{ needs.versionExtract.outputs.minVersion }}\n+ - ${{ needs.versionExtract.outputs.maxVersion }}\n+ directory: [examples/complete-vpc, examples/ipv6, examples/simple-vpc, examples/network-acls]\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Terraform v${{ matrix.version }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ matrix.version }}\n+\n+ - name: Init & validate v${{ matrix.version }}\n+ run: |\n+ cd ${{ matrix.directory }}\n+ terraform init\n+ terraform validate\n+\n+ - name: tflint\n+ uses: reviewdog/action-tflint@master\n+ with:\n+ github_token: ${{ secrets.GITHUB_TOKEN }}\n+ working_directory: ${{ matrix.directory }}\n+ fail_on_error: 'true'\n+ filter_mode: 'nofilter'\n+ flags: '--module'\n+\n+ format:\n+ name: Check code format\n+ runs-on: ubuntu-latest\n+ needs: versionExtract\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Terraform v${{ needs.versionExtract.outputs.maxVersion }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ needs.versionExtract.outputs.maxVersion }}\n+\n+ - name: Check Terraform format changes\n+ run: terraform fmt --recursive -check=true\n---\n\n\n---\n\nChoice B:\n.github/workflows/static-checks.yml\n@@ -0,0 +1,73 @@\n+name: static-checks\n+\n+on:\n+ pull_request:\n+\n+jobs:\n+ versionExtract:\n+ name: Get min/max versions\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/terraform-min-max@main\n+ outputs:\n+ minVersion: ${{ steps.minMax.outputs.minVersion }}\n+ maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n+\n+ versionEvaluate:\n+ name: Evaluate Terraform versions\n+ runs-on: ubuntu-latest\n+ needs: versionExtract\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ version:\n+ - ${{ needs.versionExtract.outputs.minVersion }}\n+ - ${{ needs.versionExtract.outputs.maxVersion }}\n+ directory: [examples/complete-vpc, examples/ipv6, examples/simple-vpc, examples/network-acls]\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Terraform v${{ matrix.version }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ matrix.version }}\n+\n+ - name: Init & validate v${{ matrix.version }}\n+ run: |\n+ cd ${{ matrix.directory }}\n+ terraform init\n+ terraform validate\n+\n+ - name: tflint\n+ uses: reviewdog/action-tflint@master\n+ with:\n+ github_token: secrets.GITHUB_TOKEN }}\n+ working_directory: ${{ matrix.directory }}\n+ fail_on_error: 'true'\n+ filter_mode: 'nofilter'\n+ flags: '--module'\n+\n+ format:\n+ name: Check code format\n+ runs-on: ubuntu-latest\n+ needs: versionExtract\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Terraform v${{ needs.versionExtract.outputs.maxVersion }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ needs.versionExtract.outputs.maxVersion }}\n+\n+ - name: Check Terraform format changes\n+ run: terraform fmt --recursive -check=true\n---\n\n\n---\n\nChoice C:\n.github/workflows/static-checks.yml\n@@ -0,0 +1,73 @@\n+name: static-checks\n+\n+on:\n+ pull_request:\n+\n+jobs:\n+ versionExtract:\n+ name: Get min/max versions\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/terraform-min-max@main\n+ outputs:\n+ minVersion: ${{ steps.minMax.outputs.minVersion }}\n+ maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n+\n+ versionEvaluate:\n+ name: Evaluate Terraform versions\n+ runs-on: ubuntu-latest\n+ needs: versionExtract\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ version:\n+ - ${{ needs.versionExtract.outputs.minVersion }}\n+ - ${{ needs.versionExtract.outputs.maxVersion }}\n+ directory: [examples/complete-vpc, examples/ipv6, examples/simple-vpc, examples/network-acls]\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Terraform v${{ matrix.version }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ matrix.version }}\n+\n+ - name: Init & validate v${{ matrix.version }}\n+ run: |\n+ cd ${{ matrix.directory }}\n+ terraform init\n+ terraform validate\n+\n+ - name: tflint\n+ uses: reviewdog/action-tflint@master\n+ with:\n+ github_token: ${{ secrets.GITHUB_TOKEN }}\n+ working_directory: ${{ matrix.directory }}\n+ fail_on_error: 'true'\n+ filter_mode: 'nofilter'\n+ flags: '--module'\n+\n+ format:\n+ name: Check code format\n+ runs-on: ubuntu-latest\n+ needs: versionExtract\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Terraform v${{ needs.versionExtract.outputs.maxVersion }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ needs.versionExtract.outputs.maxVersion }}\n+\n+ - name: Check Terraform format changes\n+ run: terraform fmt --recursive -check=true\n---\n\n\n---\n\nChoice D:\n.github/workflows/static-checks.yml\n@@ -0,0 +1,73 @@\n+name: static-checks\n+\n+on:\n+ pull_request:\n+\n+jobs:\n+ versionExtract:\n+ name: Get min/max versions\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/terraform-min-max@main\n+ outputs:\n+ minVersion: ${{ steps.minMax.outputs.minVersion }}\n+ maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n+\n+ versionEvaluate:\n+ name: Evaluate Terraform versions\n+ runs-on: ubuntu-latest\n+ needs: versionExtract\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ version:\n+ - ${{ needs.versionExtract.outputs.minVersion }}\n+ - ${{ needs.versionExtract.outputs.maxVersion }}\n+ directory: [examples/complete-vpc, examples/ipv6, examples/simple-vpc, examples/network-acls]\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Terraform v${{ matrix.version }}\n+ needs: uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ matrix.version }}\n+\n+ - name: Init & validate v${{ matrix.version }}\n+ run: |\n+ cd ${{ matrix.directory }}\n+ terraform init\n+ terraform validate\n+\n+ - name: tflint\n+ uses: reviewdog/action-tflint@master\n+ with:\n+ github_token: ${{ secrets.GITHUB_TOKEN }}\n+ working_directory: ${{ matrix.directory }}\n+ fail_on_error: 'true'\n+ filter_mode: 'nofilter'\n+ flags: '--module'\n+\n+ format:\n+ name: Check code format\n+ runs-on: ubuntu-latest\n+ needs: versionExtract\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Terraform v${{ needs.versionExtract.outputs.maxVersion }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ needs.versionExtract.outputs.maxVersion }}\n+\n+ - name: Check Terraform format changes\n+ run: terraform fmt --recursive -check=true\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nAdding `vpc_flow_log_permissions_boundary` so that developers who are required to specify a permissions boundary on IAM roles can enable the VPC Flow Log feature in this module\r\n\r\n## Motivation and Context\r\nIn many AWS setups, developers are required to assume a role in order to make changes to AWS resources. One of the recommended security measures that is recommended by AWS is to allow roles the ability to create other roles only if a permissions boundary is set directly on the role. This prevents developers (in an assumed-role session) from [unintentionally/intentionally] creating a role with, for example, super powers/administrative rights. Without the ability to set a permissions boundary on the VPC Flow Logs IAM role, those who are bound by this permissions boundary restraint will not be able to enable the VPC Flow Logs feature, but will instead need to create a new module to handle this.\r\n\r\n## Breaking Changes\r\n\r\nNone\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n\r\nCircleCI pipeline passes. Using the fork in our production code/environment (manual smoke testing/verification) -- the VPC Flow Logs elements (IAM role, IAM cloudwatch log group) are created; other elements are not affected.\r\n```\r\nmodule \"vpc\" {\r\n source = \"git::https://github.com/kelseymok/terraform-aws-vpc.git\"\r\n\r\n name = \"${local.project-name}-${local.module-name}\"\r\n cidr = local.vpc-cidr\r\n\r\n azs = local.azs\r\n private_subnets = local.private_subnets\r\n public_subnets = local.public_subnets\r\n\r\n enable_nat_gateway = true\r\n enable_dns_hostnames = true\r\n enable_dns_support = true\r\n\r\n enable_flow_log = true\r\n flow_log_destination_type = \"cloud-watch-logs\"\r\n create_flow_log_cloudwatch_iam_role = true\r\n create_flow_log_cloudwatch_log_group = true\r\n vpc_flow_log_permissions_boundary = \"arn:aws:iam::${data.aws_caller_identity.current.account_id}:policy/my-awesome-boundary\"\r\n}\r\n```\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -161,6 +161,10 @@ You can add additional tags with `intra_subnet_tags` as with other subnet types.\n \n VPC Flow Log allows to capture IP traffic for a specific network interface (ENI), subnet, or entire VPC. This module supports enabling or disabling VPC Flow Logs for entire VPC. If you need to have VPC Flow Logs for subnet or ENI, you have to manage it outside of this module with [aws_flow_log resource](https://www.terraform.io/docs/providers/aws/r/flow_log.html).\n \n+### Permissions Boundary\n+\n+If your organization requires a permissions boundary to be attached to the VPC Flow Log role, make sure that you specify an ARN of the permissions boundary policy as `vpc_flow_log_permissions_boundary` argument. Read more about required [IAM policy for publishing flow logs](https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs-cwl.html#flow-logs-iam).\n+\n ## Conditional creation\n \n Sometimes you need to have a way to create VPC resources conditionally but Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_vpc`.\n@@ -637,6 +641,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | transferserver\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for Transfer Server endpoint | `list(string)` | `[]` | no |\n | transferserver\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for Transfer Server endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | vpc\\_endpoint\\_tags | Additional tags for the VPC Endpoints | `map(string)` | `{}` | no |\n+| vpc\\_flow\\_log\\_permissions\\_boundary | The ARN of the Permissions Boundary for the VPC Flow Log IAM Role | `string` | `null` | no |\n | vpc\\_flow\\_log\\_tags | Additional tags for the VPC Flow Logs | `map(string)` | `{}` | no |\n | vpc\\_tags | Additional tags for the VPC | `map(string)` | `{}` | no |\n | vpn\\_gateway\\_az | The Availability Zone for the VPN Gateway | `string` | `null` | no |\n---\nvariables.tf\n@@ -2117,6 +2117,12 @@ variable \"vpc_flow_log_tags\" {\n default = {}\n }\n \n+variable \"vpc_flow_log_permissions_boundary\" {\n+ description = \"The ARN of the Permissions Boundary for the VPC Flow Log IAM Role\"\n+ type = string\n+ default = null\n+}\n+\n variable \"enable_dhcp_options\" {\n description = \"Should be true if you want to specify a DHCP options set with a custom domain name, DNS for NTP servers, netbios servers, and/or netbios server type\"\n type = bool\n---\nvpc-flow-logs.tf\n@@ -45,8 +45,9 @@ resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n resource \"aws_iam_role\" \"vpc_flow_log_cloudwatch\" {\n count = local.create_flow_log_cloudwatch_iam_role ? 1 : 0\n \n- name_prefix = \"vpc-flow-log-role-\"\n- assume_role_policy = data.aws_iam_policy_document.flow_log_cloudwatch_assume_role[0].json\n+ name_prefix = \"vpc-flow-log-role-\"\n+ assume_role_policy = data.aws_iam_policy_document.flow_log_cloudwatch_assume_role[0].json\n+ permissions_boundary = var.vpc_flow_log_permissions_boundary\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n }\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -161,6 +161,10 @@ You can add additional tags with `intra_subnet_tags` as with other subnet types.\n \n VPC Flow Log allows to capture IP traffic for a specific network interface (ENI), subnet, or entire VPC. This module supports enabling or disabling VPC Flow Logs for entire VPC. If you need to have VPC Flow Logs for subnet or ENI, you have to manage it outside of this module with [aws_flow_log resource](https://www.terraform.io/docs/providers/aws/r/flow_log.html).\n \n+### Permissions Boundary\n+\n+If your organization requires a permissions boundary to be attached to the VPC Flow Log role, make sure that you specify an ARN of the permissions boundary policy as `vpc_flow_log_permissions_boundary` argument. Read more about required [IAM policy for publishing flow logs](https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs-cwl.html#flow-logs-iam).\n+\n ## Conditional creation\n \n Sometimes you need to have a way to create VPC resources conditionally but Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_vpc`.\n@@ -637,6 +641,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | transferserver\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for Transfer Server endpoint | `list(string)` | `[]` | no |\n | transferserver\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for Transfer Server endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | vpc\\_endpoint\\_tags | Additional tags for the VPC Endpoints | `map(string)` | `{}` | no |\n+| vpc\\_flow\\_log\\_permissions\\_boundary | The ARN of the Permissions Boundary for the VPC Flow Log IAM Role | `string` | `null` | no |\n | vpc\\_flow\\_log\\_tags | Additional tags for the VPC Flow Logs | `map(string)` | `{}` | no |\n | vpc\\_tags | Additional tags for the VPC | `map(string)` | `{}` | no |\n | vpn\\_gateway\\_az | The Availability Zone for the VPN Gateway | `string` | `null` | no |\n---\nvariables.tf\n@@ -2117,6 +2117,12 @@ variable \"vpc_flow_log_tags\" {\n default = {}\n }\n \n+variable \"vpc_flow_log_permissions_boundary\" {\n+ description = \"The ARN of the Permissions Boundary for the VPC Flow Log IAM Role\"\n+ type = string\n+ default = null\n+}\n+\n variable \"enable_dhcp_options\" {\n description = \"Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type\"\n type = bool\n---\nvpc-flow-logs.tf\n@@ -45,8 +45,9 @@ resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n resource \"aws_iam_role\" \"vpc_flow_log_cloudwatch\" {\n count = local.create_flow_log_cloudwatch_iam_role ? 1 : 0\n \n- name_prefix = \"vpc-flow-log-role-\"\n- assume_role_policy = data.aws_iam_policy_document.flow_log_cloudwatch_assume_role[0].json\n+ name_prefix = \"vpc-flow-log-role-\"\n+ assume_role_policy = data.aws_iam_policy_document.flow_log_cloudwatch_assume_role[0].json\n+ permissions_boundary = var.vpc_flow_log_permissions_boundary\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n }\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -161,6 +161,10 @@ You can add additional tags with `intra_subnet_tags` as with other subnet types.\n \n VPC Flow Log allows to capture IP traffic for a specific network interface (ENI), subnet, or entire VPC. This module supports enabling or disabling VPC Flow Logs for entire VPC. If you need to have VPC Flow Logs for subnet or ENI, you have to manage it outside of this module with [aws_flow_log resource](https://www.terraform.io/docs/providers/aws/r/flow_log.html).\n \n+### Permissions Boundary\n+\n+If your organization requires a permissions boundary to be attached to the VPC Flow Log role, make sure that you specify an ARN of the permissions boundary policy as `vpc_flow_log_permissions_boundary` argument. Read more about required [IAM policy for publishing flow logs](https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs-cwl.html#flow-logs-iam).\n+\n ## Conditional creation\n \n Sometimes you need to have a way to create VPC resources conditionally but Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_vpc`.\n@@ -637,6 +641,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | transferserver\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for Transfer Server endpoint | `list(string)` | `[]` | no |\n | transferserver\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for Transfer Server endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | vpc\\_endpoint\\_tags | Additional tags for the VPC Endpoints | `map(string)` | `{}` | no |\n+| vpc\\_flow\\_log\\_permissions\\_boundary | The ARN of the Permissions Boundary for the VPC Flow or IAM Role | `string` | `null` | no |\n | vpc\\_flow\\_log\\_tags | Additional tags for the VPC Flow Logs | `map(string)` | `{}` | no |\n | vpc\\_tags | Additional tags for the VPC | `map(string)` | `{}` | no |\n | vpn\\_gateway\\_az | The Availability Zone for the VPN Gateway | `string` | `null` | no |\n---\nvariables.tf\n@@ -2117,6 +2117,12 @@ variable \"vpc_flow_log_tags\" {\n default = {}\n }\n \n+variable \"vpc_flow_log_permissions_boundary\" {\n+ description = \"The ARN of the Permissions Boundary for the VPC Flow Log IAM Role\"\n+ type = string\n+ default = null\n+}\n+\n variable \"enable_dhcp_options\" {\n description = \"Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type\"\n type = bool\n---\nvpc-flow-logs.tf\n@@ -45,8 +45,9 @@ resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n resource \"aws_iam_role\" \"vpc_flow_log_cloudwatch\" {\n count = local.create_flow_log_cloudwatch_iam_role ? 1 : 0\n \n- name_prefix = \"vpc-flow-log-role-\"\n- assume_role_policy = data.aws_iam_policy_document.flow_log_cloudwatch_assume_role[0].json\n+ name_prefix = \"vpc-flow-log-role-\"\n+ assume_role_policy = data.aws_iam_policy_document.flow_log_cloudwatch_assume_role[0].json\n+ permissions_boundary = var.vpc_flow_log_permissions_boundary\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n }\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -161,6 +161,10 @@ You can add additional tags with `intra_subnet_tags` as with other subnet types.\n \n VPC Flow Log allows to capture IP traffic for a specific network interface (ENI), subnet, or entire VPC. This module supports enabling or disabling VPC Flow Logs for entire VPC. If you need to have VPC Flow Logs for subnet or ENI, you have to manage it outside of this module with [aws_flow_log resource](https://www.terraform.io/docs/providers/aws/r/flow_log.html).\n \n+### Permissions Boundary\n+\n+If your organization requires a permissions boundary to be attached to the VPC Flow Log role, make sure that you specify an ARN of the permissions boundary policy as `vpc_flow_log_permissions_boundary` argument. Read more about required [IAM policy for publishing flow logs](https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs-cwl.html#flow-logs-iam).\n+\n ## Conditional creation\n \n Sometimes you need to have a way to create VPC resources conditionally but Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_vpc`.\n@@ -637,6 +641,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | transferserver\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for Transfer Server endpoint | `list(string)` | `[]` | no |\n | transferserver\\_endpoint\\_subnet\\_ids | The ID of one or more module in which to create a network interface for Transfer Server endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | vpc\\_endpoint\\_tags | Additional tags for the VPC Endpoints | `map(string)` | `{}` | no |\n+| vpc\\_flow\\_log\\_permissions\\_boundary | The ARN of the Permissions Boundary for the VPC Flow Log IAM Role | `string` | `null` | no |\n | vpc\\_flow\\_log\\_tags | Additional tags for the VPC Flow Logs | `map(string)` | `{}` | no |\n | vpc\\_tags | Additional tags for the VPC | `map(string)` | `{}` | no |\n | vpn\\_gateway\\_az | The Availability Zone for the VPN Gateway | `string` | `null` | no |\n---\nvariables.tf\n@@ -2117,6 +2117,12 @@ variable \"vpc_flow_log_tags\" {\n default = {}\n }\n \n+variable \"vpc_flow_log_permissions_boundary\" {\n+ description = \"The ARN of the Permissions Boundary for the VPC Flow Log IAM Role\"\n+ type = string\n+ default = null\n+}\n+\n variable \"enable_dhcp_options\" {\n description = \"Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type\"\n type = bool\n---\nvpc-flow-logs.tf\n@@ -45,8 +45,9 @@ resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n resource \"aws_iam_role\" \"vpc_flow_log_cloudwatch\" {\n count = local.create_flow_log_cloudwatch_iam_role ? 1 : 0\n \n- name_prefix = \"vpc-flow-log-role-\"\n- assume_role_policy = data.aws_iam_policy_document.flow_log_cloudwatch_assume_role[0].json\n+ name_prefix = \"vpc-flow-log-role-\"\n+ assume_role_policy = data.aws_iam_policy_document.flow_log_cloudwatch_assume_role[0].json\n+ permissions_boundary = var.vpc_flow_log_permissions_boundary\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n }\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nFixes #530 \n\n---\n\nChoice A:\nREADME.md\n@@ -224,7 +224,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/complete-vpc/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/complete-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/ipv6/README.md\n@@ -19,7 +19,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Version | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/ipv6/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/issue-44-asymmetric-private-subnets/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/manage-default-vpc/README.md\n@@ -21,7 +21,7 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/network-acls/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/network-acls/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/simple-vpc/README.md\n@@ -25,7 +25,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/simple-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n | random | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nversions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -224,7 +224,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/complete-vpc/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/complete-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/ipv6/README.md\n@@ -19,7 +19,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/ipv6/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -23,7 +23,7 @@ Note that this example may create Version which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/issue-44-asymmetric-private-subnets/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/manage-default-vpc/README.md\n@@ -21,7 +21,7 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/network-acls/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/network-acls/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/simple-vpc/README.md\n@@ -25,7 +25,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/simple-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n | random | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nversions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -224,7 +224,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/complete-vpc/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/complete-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/ipv6/README.md\n@@ -19,7 +19,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/ipv6/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/issue-44-asymmetric-private-subnets/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/manage-default-vpc/README.md\n@@ -21,7 +21,7 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/network-acls/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/network-acls/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/simple-vpc/README.md\n@@ -25,7 +25,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/simple-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n | random | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nversions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -224,7 +224,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/complete-vpc/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/complete-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/ipv6/README.md\n@@ -19,7 +19,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/ipv6/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/issue-44-asymmetric-private-subnets/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/manage-default-vpc/README.md\n@@ -21,7 +21,7 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/network-acls/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/network-acls/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/simple-vpc/README.md\n@@ -25,7 +25,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/simple-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n | random | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7 |\n+| terraform | >= 0.12.21 |\n | aws | >= 2.68 |\n \n ## Providers\n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n |------|---------|\n-| aws = \">= 2.68\"\n---\nversions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.7\"\n+ required_version = \">= 0.12.21\"\n \n required_providers {\n aws = \">= 2.68\"\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nThis fix sets the value for the `subnet_ids` attribute of the `aws_default_network_acl` to be any subnets created by the module that are not allocated to any other `aws_network_acl` resources.\r\n\r\n## Motivation and Context\r\n\r\n\r\n#529 \r\n\r\n## Breaking Changes\r\n\r\n\r\nThis fix involves the usage of the `setsubtract`, `compact`, and `flatten` functions which should not break any backward compatibility.\r\n\r\n## How Has This Been Tested?\r\n\r\n\r\n\r\nI did the following:\r\n\r\n- Added the `manage_default_network_acl` attribute set as `true` to the `network-acls` example\r\n- `terraform apply`\r\n- Set the `private_dedicated_network_acl` attribute as `false` in the example\r\n- `terraform apply`\r\n- `terraform plan`\r\n- Noticed that the plan was complaining that the previously created subnets would be removed from the `aws_default_network_acl` resource\r\n- `terraform apply`\r\n- `terraform plan`\r\n- Noticed that the plan was *still* complaining that the previously created subnets would be removed from the `aws_default_network_acl` resource\r\n- Implemented my changes to default the `subnet_ids` attribute of the `aws_default_network_acl` resource\r\n- `terraform plan`\r\n- No changes needed\r\n- Set the `private_dedicated_network_acl` attribute back to `true` in the example\r\n- `terraform apply`\r\n- `terraform plan`\r\n- No changes needed\n\n---\n\nChoice A:\nexamples/network-acls/main.tf\n@@ -28,9 +28,11 @@ module \"vpc\" {\n local.network_acls[\"elasticache_outbound\"],\n )\n \n- private_dedicated_network_acl = true\n+ private_dedicated_network_acl = false\n elasticache_dedicated_network_acl = true\n \n+ manage_default_network_acl = true\n+\n enable_ipv6 = true\n \n enable_nat_gateway = false\n@@ -200,4 +202,3 @@ locals {\n \n }\n }\n-\n---\nmain.tf\n@@ -534,6 +534,27 @@ resource \"aws_default_network_acl\" \"this\" {\n \n default_network_acl_id = element(concat(aws_vpc.this.*.default_network_acl_id, [\"\"]), 0)\n \n+ # The value of subnet_ids should be any subnet IDs that are not set as subnet_ids\n+ # for any of the non-default network ACLs\n+ subnet_ids = setsubtract(\n+ compact(flatten([\n+ aws_subnet.public.*.id,\n+ aws_subnet.private.*.id,\n+ aws_subnet.intra.*.id,\n+ aws_subnet.database.*.id,\n+ aws_subnet.redshift.*.id,\n+ aws_subnet.elasticache.*.id,\n+ ])),\n+ compact(flatten([\n+ aws_network_acl.public.*.subnet_ids,\n+ aws_network_acl.private.*.subnet_ids,\n+ aws_network_acl.intra.*.subnet_ids,\n+ aws_network_acl.database.*.subnet_ids,\n+ aws_network_acl.redshift.*.subnet_ids,\n+ aws_network_acl.elasticache.*.subnet_ids,\n+ ]))\n+ )\n+\n dynamic \"ingress\" {\n for_each = var.default_network_acl_ingress\n content {\n---\n\n\n---\n\nChoice B:\nexamples/network-acls/main.tf\n@@ -28,9 +28,11 @@ module \"vpc\" {\n local.network_acls[\"elasticache_outbound\"],\n )\n \n- private_dedicated_network_acl = true\n+ = false\n elasticache_dedicated_network_acl = true\n \n+ manage_default_network_acl = true\n+\n enable_ipv6 = true\n \n enable_nat_gateway = false\n@@ -200,4 +202,3 @@ locals {\n ]\n }\n }\n-\n---\nmain.tf\n@@ -534,6 +534,27 @@ resource \"aws_default_network_acl\" \"this\" {\n \n default_network_acl_id = element(concat(aws_vpc.this.*.default_network_acl_id, [\"\"]), 0)\n \n+ # The value of subnet_ids should be any subnet IDs that are not set as subnet_ids\n+ # for any of the non-default network ACLs\n+ subnet_ids = setsubtract(\n+ compact(flatten([\n+ aws_subnet.public.*.id,\n+ aws_subnet.private.*.id,\n+ aws_subnet.intra.*.id,\n+ aws_subnet.database.*.id,\n+ aws_subnet.redshift.*.id,\n+ aws_subnet.elasticache.*.id,\n+ ])),\n+ compact(flatten([\n+ aws_network_acl.public.*.subnet_ids,\n+ aws_network_acl.private.*.subnet_ids,\n+ aws_network_acl.intra.*.subnet_ids,\n+ aws_network_acl.database.*.subnet_ids,\n+ aws_network_acl.redshift.*.subnet_ids,\n+ aws_network_acl.elasticache.*.subnet_ids,\n+ ]))\n+ )\n+\n dynamic \"ingress\" {\n for_each = var.default_network_acl_ingress\n content {\n---\n\n\n---\n\nChoice C:\nexamples/network-acls/main.tf\n@@ -28,9 +28,11 @@ module \"vpc\" {\n local.network_acls[\"elasticache_outbound\"],\n )\n \n- private_dedicated_network_acl = true\n+ private_dedicated_network_acl = false\n elasticache_dedicated_network_acl = true\n \n+ manage_default_network_acl = true\n+\n enable_ipv6 = true\n \n enable_nat_gateway = false\n@@ -200,4 +202,3 @@ locals {\n ]\n }\n }\n-\n---\nmain.tf\n@@ -534,6 +534,27 @@ resource \"aws_default_network_acl\" \"this\" {\n \n default_network_acl_id = element(concat(aws_vpc.this.*.default_network_acl_id, [\"\"]), 0)\n \n+ # The value of subnet_ids should be any subnet IDs that are not set as subnet_ids\n+ # for any of the non-default network ACLs\n+ subnet_ids = setsubtract(\n+ compact(flatten([\n+ aws_subnet.public.*.id,\n+ aws_subnet.private.*.id,\n+ aws_subnet.intra.*.id,\n+ aws_subnet.database.*.id,\n+ aws_subnet.redshift.*.id,\n+ aws_subnet.elasticache.*.id,\n+ ])),\n+ compact(flatten([\n+ aws_network_acl.public.*.subnet_ids,\n+ aws_network_acl.private.*.subnet_ids,\n+ aws_network_acl.intra.*.subnet_ids,\n+ aws_network_acl.database.*.subnet_ids,\n+ aws_network_acl.redshift.*.subnet_ids,\n+ aws_network_acl.elasticache.*.subnet_ids,\n+ ]))\n+ )\n+\n dynamic \"ingress\" {\n for_each = var.default_network_acl_ingress\n content {\n---\n\n\n---\n\nChoice D:\nexamples/network-acls/main.tf\n@@ -28,9 +28,11 @@ module \"vpc\" {\n local.network_acls[\"elasticache_outbound\"],\n )\n \n- private_dedicated_network_acl = true\n+ private_dedicated_network_acl = false\n elasticache_dedicated_network_acl = true\n \n+ manage_default_network_acl = true\n+\n enable_ipv6 = true\n \n enable_nat_gateway = false\n@@ -200,4 +202,3 @@ locals {\n ]\n }\n }\n-\n---\nmain.tf\n@@ -534,6 +534,27 @@ resource \"aws_default_network_acl\" \"this\" {\n \n default_network_acl_id = element(concat(aws_vpc.this.*.default_network_acl_id, [\"\"]), 0)\n \n+ # The value of subnet_ids should be any subnet IDs that are not set as subnet_ids\n+ # for any of the non-default network ACLs\n+ subnet_ids = setsubtract(\n+ compact(flatten([\n+ aws_subnet.public.*.id,\n+ aws_subnet.private.*.id,\n+ aws_subnet.intra.*.id,\n+ aws_subnet.database.*.id,\n+ aws_subnet.redshift.*.id,\n+ aws_subnet.elasticache.*.id,\n+ ])),\n+ compact(flatten([\n+ aws_network_acl.public.*.subnet_ids,\n+ aws_network_acl.private.*.subnet_ids,\n+ aws_network_acl.intra.*.subnet_ids,\n+ aws_network_acl.database.*.subnet_ids,\n+ aws_network_acl.redshift.*.subnet_ids,\n+ aws_network_acl.elasticache.*.subnet_ids,\n+ ]))\n+ )\n+\n dynamic \"ingress\" {\n for_each = var.default_network_acl_ingress\n content {\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nFollow up to #525 \r\nRelated to https://github.com/hashicorp/terraform/pull/26387\n\n---\n\nChoice A:\nmain.tf\n@@ -570,10 +570,6 @@ resource \"aws_default_network_acl\" \"this\" {\n var.tags,\n var.default_network_acl_tags,\n )\n-\n- lifecycle {\n- ignore_changes = [subnet_ids]\n- }\n }\n \n ########################\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -570,10 +570,6 @@ resource \"aws_default_network_acl\" \"this\" {\n var.tags,\n var.default_network_acl_tags,\n )\n-\n- lifecycle {\n- ignore_changes = [subnet_ids]\n- }\n }\n \n ########################\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -570,10 +570,6 @@ resource \"aws_default_network_acl\" \"this\" {\n var.tags,\n var.default_network_acl_tags,\n )\n-\n- lifecycle {\n- ignore_changes = [subnet_ids]\n- }\n }\n \n ########################\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -570,10 +570,6 @@ resource \"aws_default_network_acl\" -570,10 {\n var.tags,\n var.default_network_acl_tags,\n )\n-\n- lifecycle {\n- ignore_changes = [subnet_ids]\n- }\n }\n \n ########################\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n- fix: Added support for Terraform 0.14\n- fix: Removed lifecycle ignore_changes which doesn't work in TF 0.14\n\n\n---\n\nChoice A:\n.gitignore\n@@ -2,3 +2,5 @@\n terraform.tfstate\n *.tfstate*\n terraform.tfvars\n+\n+.terraform.lock.hcl\n---\n.tflint.hcl\n@@ -1,57 +0,0 @@\n-config {\n- deep_check = false\n- ignore_module = {}\n- varfile = []\n-}\n-\n-rule \"terraform_deprecated_interpolation\" {\n- enabled = true\n-}\n-\n-rule \"terraform_deprecated_index\" {\n- enabled = true\n-}\n-\n-rule \"terraform_unused_declarations\" {\n- enabled = true\n-}\n-\n-rule \"terraform_comment_syntax\" {\n- enabled = true\n-}\n-\n-rule \"terraform_documented_outputs\" {\n- enabled = true\n-}\n-\n-rule \"terraform_documented_variables\" {\n- enabled = true\n-}\n-\n-rule \"terraform_typed_variables\" {\n- enabled = true\n-}\n-\n-rule \"terraform_module_pinned_source\" {\n- enabled = true\n-}\n-\n-rule \"terraform_naming_convention\" {\n- enabled = true\n-}\n-\n-rule \"terraform_required_version\" {\n- enabled = true\n-}\n-\n-rule \"terraform_required_providers\" {\n- enabled = true\n-}\n-\n-rule \"terraform_standard_module_structure\" {\n- enabled = true\n-}\n-\n-rule \"terraform_workspace_remote\" {\n- enabled = true\n-}\n---\nREADME.md\n@@ -224,14 +224,14 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| |\n-| | >= 2.68 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/README.md\n@@ -21,14 +21,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/ipv6/README.md\n@@ -19,14 +19,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n \n ## Inputs\n \n---\nexamples/ipv6/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -23,8 +23,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/issue-44-asymmetric-private-subnets/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/manage-default-vpc/README.md\n@@ -21,8 +21,8 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/network-acls/README.md\n@@ -23,8 +23,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/network-acls/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/simple-vpc/README.md\n@@ -25,8 +25,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/simple-vpc/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,15 +23,15 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n | random | >= 2 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n | random | >= 2 |\n \n ## Inputs\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,8 +1,8 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n random = \">= 2\"\n }\n }\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nmain.tf\n@@ -217,12 +217,6 @@ resource \"aws_route_table\" \"private\" {\n var.tags,\n var.private_route_table_tags,\n )\n-\n- lifecycle {\n- # When attaching VPN gateways it is common to define aws_vpn_gateway_route_propagation\n- # resources that manipulate the attributes of the routing table (typically for the private subnets)\n- ignore_changes = [propagating_vgws]\n- }\n }\n \n #################\n---\nversions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\n\n\n---\n\nChoice B:\n.gitignore\n@@ -2,3 +2,5 @@\n terraform.tfstate\n *.tfstate*\n terraform.tfvars\n+\n+.terraform.lock.hcl\n---\n.tflint.hcl\n@@ -1,57 +0,0 @@\n-config {\n- deep_check = false\n- ignore_module = {}\n- varfile = []\n-}\n-\n-rule \"terraform_deprecated_interpolation\" {\n- enabled = true\n-}\n-\n-rule \"terraform_deprecated_index\" {\n- enabled = true\n-}\n-\n-rule \"terraform_unused_declarations\" {\n- enabled = true\n-}\n-\n-rule \"terraform_comment_syntax\" {\n- enabled = true\n-}\n-\n-rule \"terraform_documented_outputs\" {\n- enabled = true\n-}\n-\n-rule \"terraform_documented_variables\" {\n- enabled = true\n-}\n-\n-rule \"terraform_typed_variables\" {\n- enabled = true\n-}\n-\n-rule \"terraform_module_pinned_source\" {\n- enabled = true\n-}\n-\n-rule \"terraform_naming_convention\" {\n- enabled = true\n-}\n-\n-rule \"terraform_required_version\" {\n- enabled = true\n-}\n-\n-rule \"terraform_required_providers\" {\n- enabled = true\n-}\n-\n-rule \"terraform_standard_module_structure\" {\n- enabled = true\n-}\n-\n-rule \"terraform_workspace_remote\" {\n- enabled = true\n-}\n---\nREADME.md\n@@ -224,14 +224,14 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/README.md\n@@ -21,14 +21,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/ipv6/README.md\n@@ -19,14 +19,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n \n ## Inputs\n \n---\nexamples/ipv6/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -23,8 +23,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/issue-44-asymmetric-private-subnets/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version Providers\n \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/manage-default-vpc/README.md\n@@ -21,8 +21,8 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/network-acls/README.md\n@@ -23,8 +23,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/network-acls/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/simple-vpc/README.md\n@@ -25,8 +25,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/simple-vpc/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,15 +23,15 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n | random | >= 2 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n | random | >= 2 |\n \n ## Inputs\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,8 +1,8 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n random = \">= 2\"\n }\n }\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nmain.tf\n@@ -217,12 +217,6 @@ resource \"aws_route_table\" \"private\" {\n var.tags,\n var.private_route_table_tags,\n )\n-\n- lifecycle {\n- # When attaching VPN gateways it is common to define aws_vpn_gateway_route_propagation\n- # resources that manipulate the attributes of the routing table (typically for the private subnets)\n- ignore_changes = [propagating_vgws]\n- }\n }\n \n #################\n---\nversions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\n\n\n---\n\nChoice C:\n.gitignore\n@@ -2,3 +2,5 @@\n terraform.tfstate\n *.tfstate*\n terraform.tfvars\n+\n+.terraform.lock.hcl\n---\n.tflint.hcl\n@@ -1,57 +0,0 @@\n-config {\n- deep_check = false\n- ignore_module = {}\n- varfile = []\n-}\n-\n-rule \"terraform_deprecated_interpolation\" {\n- enabled = true\n-}\n-\n-rule \"terraform_deprecated_index\" {\n- enabled = true\n-}\n-\n-rule \"terraform_unused_declarations\" {\n- enabled = true\n-}\n-\n-rule \"terraform_comment_syntax\" {\n- enabled = true\n-}\n-\n-rule \"terraform_documented_outputs\" {\n- enabled = true\n-}\n-\n-rule \"terraform_documented_variables\" {\n- enabled = true\n-}\n-\n-rule \"terraform_typed_variables\" {\n- enabled = true\n-}\n-\n-rule \"terraform_module_pinned_source\" {\n- enabled = true\n-}\n-\n-rule \"terraform_naming_convention\" {\n- enabled = true\n-}\n-\n-rule \"terraform_required_version\" {\n- enabled = true\n-}\n-\n-rule \"terraform_required_providers\" {\n- enabled = true\n-}\n-\n-rule \"terraform_standard_module_structure\" {\n- enabled = true\n-}\n-\n-rule \"terraform_workspace_remote\" {\n- enabled = true\n-}\n---\nREADME.md\n@@ -224,14 +224,14 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/README.md\n@@ -21,14 +21,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/ipv6/README.md\n@@ -19,14 +19,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n \n ## Inputs\n \n---\nexamples/ipv6/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -23,8 +23,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/issue-44-asymmetric-private-subnets/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n 2.68, }\n---\nexamples/manage-default-vpc/README.md\n@@ -21,8 +21,8 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/network-acls/README.md\n@@ -23,8 +23,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/network-acls/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/simple-vpc/README.md\n@@ -25,8 +25,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/simple-vpc/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,15 +23,15 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n | random | >= 2 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n | random | >= 2 |\n \n ## Inputs\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,8 +1,8 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n random = \">= 2\"\n }\n }\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nmain.tf\n@@ -217,12 +217,6 @@ resource \"aws_route_table\" \"private\" {\n var.tags,\n var.private_route_table_tags,\n )\n-\n- lifecycle {\n- # When attaching VPN gateways it is common to define aws_vpn_gateway_route_propagation\n- # resources that manipulate the attributes of the routing table (typically for the private subnets)\n- ignore_changes = [propagating_vgws]\n- }\n }\n \n #################\n---\nversions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\n\n\n---\n\nChoice D:\n.gitignore\n@@ -2,3 +2,5 @@\n terraform.tfstate\n *.tfstate*\n terraform.tfvars\n+\n+.terraform.lock.hcl\n---\n.tflint.hcl\n@@ -1,57 +0,0 @@\n-config {\n- deep_check = false\n- ignore_module = {}\n- varfile = []\n-}\n-\n-rule \"terraform_deprecated_interpolation\" {\n- enabled = true\n-}\n-\n-rule \"terraform_deprecated_index\" {\n- enabled = true\n-}\n-\n-rule \"terraform_unused_declarations\" {\n- enabled = true\n-}\n-\n-rule \"terraform_comment_syntax\" {\n- enabled = true\n-}\n-\n-rule \"terraform_documented_outputs\" {\n- enabled = true\n-}\n-\n-rule \"terraform_documented_variables\" {\n- enabled = true\n-}\n-\n-rule \"terraform_typed_variables\" {\n- enabled = true\n-}\n-\n-rule \"terraform_module_pinned_source\" {\n- enabled = true\n-}\n-\n-rule \"terraform_naming_convention\" {\n- enabled = true\n-}\n-\n-rule \"terraform_required_version\" {\n- enabled = true\n-}\n-\n-rule \"terraform_required_providers\" {\n- enabled = true\n-}\n-\n-rule \"terraform_standard_module_structure\" {\n- enabled = true\n-}\n-\n-rule \"terraform_workspace_remote\" {\n- enabled = true\n-}\n---\nREADME.md\n@@ -224,14 +224,14 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/README.md\n@@ -21,14 +21,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/ipv6/README.md\n@@ -19,14 +19,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n \n ## Inputs\n \n---\nexamples/ipv6/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -23,8 +23,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/issue-44-asymmetric-private-subnets/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/manage-default-vpc/README.md\n@@ -21,8 +21,8 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/network-acls/README.md\n@@ -23,8 +23,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/network-acls/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/simple-vpc/README.md\n@@ -25,8 +25,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/simple-vpc/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,15 +23,15 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n | random | >= 2 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68, < 4.0 |\n+| aws | >= 2.68 |\n | random | >= 2 |\n \n ## Inputs\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,8 +1,8 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n random = \">= 2\"\n }\n }\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,8 +21,8 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.7, < 0.14 |\n-| aws | >= 2.68, < 4.0 |\n+| terraform | >= 0.12.7 |\n+| aws | >= 2.68 |\n \n ## Providers\n \n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\nmain.tf\n@@ -217,12 +217,6 @@ resource \"aws_route_table\" \"private\" {\n var.tags,\n var.private_route_table_tags,\n )\n-\n- lifecycle {\n- # When attaching VPN gateways it is common to define aws_vpn_gateway_route_propagation\n- # resources that manipulate the attributes of the routing table (typically for the private subnets)\n- ignore_changes = [propagating_vgws]\n- }\n }\n \n #################\n---\nversions.tf\n@@ -1,7 +1,7 @@\n terraform {\n- required_version = \">= 0.12.7, < 0.14\"\n+ required_version = \">= 0.12.7\"\n \n required_providers {\n- aws = \">= 2.68, < 4.0\"\n+ aws = \">= 2.68\"\n }\n }\n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nJust fixing a typo on the simple vpc example.\r\n\n\n---\n\nChoice A:\nexamples/simple-vpc/README.md\n@@ -40,7 +40,7 @@ No input.\n \n | Name | Description |\n |------|-------------|\n-| azs | A list of availability zones spefified as argument to this module |\n+| azs | A list of availability zones specified as argument to this module |\n | nat\\_public\\_ips | List of public Elastic IPs created for AWS NAT Gateway |\n | private\\_subnets | List of IDs of private subnets |\n | public\\_subnets | List of IDs of public subnets |\n---\nexamples/simple-vpc/outputs.tf\n@@ -29,7 +29,7 @@ output \"nat_public_ips\" {\n \n # AZs\n output \"azs\" {\n- description = availability list of availability zones spefified as argument to this module\"\n+ description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n \n---\n\n\n---\n\nChoice B:\nexamples/simple-vpc/README.md\n@@ -40,7 +40,7 @@ No input.\n \n | Name | Description |\n |------|-------------|\n-| azs | A list of availability zones spefified as argument to this module |\n+| azs | A list of availability zones specified as argument to this module |\n | nat\\_public\\_ips | List of public Elastic IPs created for AWS NAT Gateway |\n | private\\_subnets | List of IDs of private subnets |\n | public\\_subnets | List of IDs of public subnets |\n---\nexamples/simple-vpc/outputs.tf\n@@ -29,7 +29,7 @@ output \"nat_public_ips\" {\n \n # AZs\n output \"azs\" {\n- description = \"A | of availability zones spefified as argument to this module\"\n+ description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n \n---\n\n\n---\n\nChoice C:\nexamples/simple-vpc/README.md\n@@ -40,7 +40,7 @@ No input.\n \n | Name | Description |\n |------|-------------|\n-| azs | A list of availability zones spefified as argument to this module |\n+| azs | A list of availability zones specified as argument to this module |\n | nat\\_public\\_ips | List of public Elastic IPs created for AWS NAT Gateway |\n | private\\_subnets | List of IDs of private subnets |\n | public\\_subnets | List of IDs of public subnets |\n---\nexamples/simple-vpc/outputs.tf\n@@ -29,7 +29,7 @@ output \"nat_public_ips\" {\n \n # AZs\n output \"azs\" {\n- description = \"A list of availability zones spefified as argument to this to description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n \n---\n\n\n---\n\nChoice D:\nexamples/simple-vpc/README.md\n@@ -40,7 +40,7 @@ No input.\n \n | Name | Description |\n |------|-------------|\n-| azs | A list of availability zones spefified as argument to this module |\n+| azs | A list of availability zones specified as argument to this module |\n | nat\\_public\\_ips | List of public Elastic IPs created for AWS NAT Gateway |\n | private\\_subnets | List of IDs of private subnets |\n | public\\_subnets | List of IDs of public subnets |\n---\nexamples/simple-vpc/outputs.tf\n@@ -29,7 +29,7 @@ output \"nat_public_ips\" {\n \n # AZs\n output \"azs\" {\n- description = \"A list of availability zones spefified as argument to this module\"\n+ description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n \n---\n\n\n---\n"}], "ideal": "D"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\nOriginal pull request from @y-batsianouski (https://github.com/terraform-aws-modules/terraform-aws-vpc/pull/494). \r\nI'm taking it forward because the aforementioned author no longer has interest in carrying the PR forward. \r\n\r\nThe module fails when trying to add the NAT gateway route to the database route table when there is more then a single NAT gateway. Fixes https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/516\r\n\r\n## Motivation and Context\r\nIn particular, I want to enable the NAT gateway route for the database route tables. When I tried that by setting the following options, \r\n\r\n```hcl\r\n database_subnets = [\r\n \"10.50.160.0/22\",\r\n \"10.50.164.0/22\",\r\n \"10.50.168.0/22\",\r\n \"10.50.172.0/22\",\r\n \"10.50.176.0/22\",\r\n ]\r\n\r\n enable_nat_gateway = true\r\n one_nat_gateway_per_az = true\r\n single_nat_gateway = false\r\n\r\n create_database_subnet_route_table = true\r\n create_database_nat_gateway_route = true \r\n create_database_subnet_group = false\r\n ```\r\n\r\nit fails with:\r\n\r\n```console\r\nError: Error creating route: RouteAlreadyExists: The route identified by 0.0.0.0/0 already exists.\r\n\tstatus code: 400, request id: 6739c57a-097a-433d-a032-28fe6835033f\r\n\r\nError: Error creating route: RouteAlreadyExists: The route identified by 0.0.0.0/0 already exists.\r\n\tstatus code: 400, request id: c4ab4221-dcc8-4eb0-b976-e5f15f6c7f47\r\n\r\nError: Error creating route: RouteAlreadyExists: The route identified by 0.0.0.0/0 already exists.\r\n\tstatus code: 400, request id: 99a91d24-cb7b-4b4c-90db-e68e8faf1625\r\n\r\nError: Error creating route: RouteAlreadyExists: The route identified by 0.0.0.0/0 already exists.\r\n\tstatus code: 400, request id: ad82436e-223e-4f90-91e9-5b12fc096c11\r\n```\r\n\r\nThe problem lies here:\r\n\r\nThe database route table: https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/master/main.tf#L231-L232\r\nThe database route rule for adding the nat gateway: https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/master/main.tf#L257-L260\r\nOnly one database route table for all of the database subnets is created, but when enabling the create_database_nat_gateway_route and one_nat_gateway_per_az option, the database route rule resource expects there to be more then 1 database route table. However, what ends up happening is that it tries to modify that single database route table the same number of times there are nat gateways which causes the above RouteAlreadyExists error.\r\n\r\nThe solution would be to create multiple database route tables when both create_database_nat_gateway_route and one_nat_gateway_per_az are enabled, then it should work as expected.\r\n\r\n## Breaking Changes\r\nThere are no breaking changes as this particular behavior was not working beforehand. The changes here preserve the existing behavior if there is only a single nat gateway. \r\n\r\n## How Has This Been Tested?\r\nThe following cases have been tested: \r\n\r\n### Case 1\r\n```hcl\r\nmodule \"vpc-test\" {\r\n ...\r\n cidr = \"10.40.0.0/16\"\r\n azs = [\"us-east-1a\", \"us-east-1b\"]\r\n public_subnets = [\"10.40.1.0/24\", \"10.40.2.0/24\"]\r\n private_subnets = [\"10.40.3.0/24\", \"10.40.4.0/24\"]\r\n database_subnets = [\"10.40.5.0/24\", \"10.40.6.0/24\"]\r\n\r\n single_nat_gateway = false\r\n create_database_subnet_route_table = true\r\n create_database_nat_gateway_route = true\r\n ...\r\n}\r\n```\r\nCreates 2 route tables for database subnets. Points each route table to appropriate NAT gateway\r\n\r\n###Case 2\r\n```hcl\r\nmodule \"vpc-test\" {\r\n ...\r\n cidr = \"10.40.0.0/16\"\r\n azs = [\"us-east-1a\", \"us-east-1b\"]\r\n public_subnets = [\"10.40.1.0/24\", \"10.40.2.0/24\"]\r\n private_subnets = [\"10.40.3.0/24\", \"10.40.4.0/24\"]\r\n database_subnets = [\"10.40.5.0/24\", \"10.40.6.0/24\"]\r\n\r\n single_nat_gateway = true\r\n create_database_subnet_route_table = true\r\n create_database_nat_gateway_route = true\r\n ...\r\n}\r\n```\r\n\r\nCreates 1 route table for all database subnets. Points route table to single NAT gateway\r\n\r\n### Case 3\r\n\r\n```hcl\r\nmodule \"vpc-test\" {\r\n ...\r\n cidr = \"10.40.0.0/16\"\r\n azs = [\"us-east-1a\", \"us-east-1b\"]\r\n public_subnets = [\"10.40.1.0/24\", \"10.40.2.0/24\"]\r\n private_subnets = [\"10.40.3.0/24\", \"10.40.4.0/24\"]\r\n database_subnets = [\"10.40.5.0/24\", \"10.40.6.0/24\"]\r\n \r\n create_database_subnet_route_table = true\r\n create_database_nat_gateway_route = false\r\n create_database_internet_gateway_route = true\r\n ...\r\n}\r\n```\r\nCreates 1 route table for all database subnets. Points route table to internet gateway\r\n\r\n### Case 4\r\n```\r\nmodule \"vpc-test\" {\r\n cidr = \"10.50.0.0/16\"\r\n azs = [\"us-east-1a\", \"us-east-1b\", \"us-east-1c\", \"us-east-1d\", \"us-east-1f\"]\r\n\r\n public_subnets = [\r\n \"10.50.200.0/24\",\r\n \"10.50.201.0/24\",\r\n \"10.50.202.0/24\",\r\n \"10.50.203.0/24\",\r\n \"10.50.204.0/24\",\r\n]\r\n private_subnets = [\r\n \"10.50.0.0/19\",\r\n \"10.50.32.0/19\",\r\n \"10.50.64.0/19\",\r\n \"10.50.96.0/19\",\r\n \"10.50.128.0/19\",\r\n ]\r\n\r\n\r\n database_subnets = [\r\n \"10.50.160.0/22\",\r\n \"10.50.164.0/22\",\r\n \"10.50.168.0/22\",\r\n \"10.50.172.0/22\",\r\n \"10.50.176.0/22\",\r\n ]\r\n\r\n enable_nat_gateway = true\r\n one_nat_gateway_per_az = true\r\n single_nat_gateway = false\r\n\r\n create_database_subnet_route_table = true\r\n create_database_nat_gateway_route = true \r\n create_database_subnet_group = false\r\n\r\n```\r\nCreates 5 route tables, one per az for the database subnets; each of the route tables has a corresponding route rule to one of the NAT gateways. This is similar to case 1. \n\n---\n\nChoice A:\nmain.tf\n@@ -223,13 +223,17 @@ resource \"aws_route_table\" \"private\" {\n # Database routes\n #################\n resource \"aws_route_table\" \"database\" {\n- count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 ? 1 : 0\n+ count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n {\n- \"Name\" = \"${var.name}-${var.database_subnet_suffix}\"\n+ \"Name\" = var.single_nat_gateway || var.create_database_internet_gateway_route ? \"${var.name}-${var.database_subnet_suffix}\" : format(\n+ \"%s-${var.database_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n },\n var.tags,\n var.database_route_table_tags,\n@@ -249,7 +253,7 @@ resource \"aws_route\" \"database_internet_gateway\" {\n }\n \n resource \"aws_route\" \"database_nat_gateway\" {\n- count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && false == var.create_database_internet_gateway_route && var.create_database_nat_gateway_route && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && false == var.create_database_internet_gateway_route && var.create_database_nat_gateway_route && var.enable_nat_gateway ? var.single_nat_gateway ? 1 : length(var.database_subnets) : 0\n \n route_table_id = element(aws_route_table.database.*.id, count.index)\n destination_cidr_block = \"0.0.0.0/0\"\n@@ -1007,7 +1011,7 @@ resource \"aws_route_table_association\" \"database\" {\n subnet_id = element(aws_subnet.database.*.id, count.index)\n route_table_id = element(\n coalescelist(aws_route_table.database.*.id, aws_route_table.private.*.id),\n- var.single_nat_gateway || var.create_database_subnet_route_table ? 0 : count.index,\n+ var.create_database_subnet_route_table ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 0 : count.index : count.index,\n )\n }\n \n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -223,13 +223,17 @@ resource \"aws_route_table\" \"private\" {\n # Database routes\n #################\n resource \"aws_route_table\" \"database\" {\n- count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 ? 1 : 0\n+ count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n {\n- \"Name\" = \"${var.name}-${var.database_subnet_suffix}\"\n+ \"Name\" = var.single_nat_gateway || var.create_database_internet_gateway_route ? \"${var.name}-${var.database_subnet_suffix}\" : format(\n+ > \"%s-${var.database_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n },\n var.tags,\n var.database_route_table_tags,\n@@ -249,7 +253,7 @@ resource \"aws_route\" \"database_internet_gateway\" {\n }\n \n resource \"aws_route\" \"database_nat_gateway\" {\n- count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && false == var.create_database_internet_gateway_route && var.create_database_nat_gateway_route && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && false == var.create_database_internet_gateway_route && var.create_database_nat_gateway_route && var.enable_nat_gateway ? var.single_nat_gateway ? 1 : length(var.database_subnets) : 0\n \n route_table_id = element(aws_route_table.database.*.id, count.index)\n destination_cidr_block = \"0.0.0.0/0\"\n@@ -1007,7 +1011,7 @@ resource \"aws_route_table_association\" \"database\" {\n subnet_id = element(aws_subnet.database.*.id, count.index)\n route_table_id = element(\n coalescelist(aws_route_table.database.*.id, aws_route_table.private.*.id),\n- var.single_nat_gateway || var.create_database_subnet_route_table ? 0 : count.index,\n+ var.create_database_subnet_route_table ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 0 : count.index : count.index,\n )\n }\n \n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -223,13 +223,17 @@ resource \"aws_route_table\" \"private\" {\n # Database routes\n #################\n resource \"aws_route_table\" \"database\" {\n- count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 ? 1 : 0\n+ count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n {\n- \"Name\" = \"${var.name}-${var.database_subnet_suffix}\"\n+ \"Name\" = var.single_nat_gateway || var.create_database_internet_gateway_route ? \"${var.name}-${var.database_subnet_suffix}\" : format(\n+ \"%s-${var.database_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n },\n var.tags,\n var.database_route_table_tags,\n@@ -249,7 +253,7 @@ resource \"aws_route\" \"database_internet_gateway\" {\n }\n \n resource \"aws_route\" \"database_nat_gateway\" {\n- count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && false == var.create_database_internet_gateway_route && var.create_database_nat_gateway_route && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && false == var.create_database_internet_gateway_route && var.create_database_nat_gateway_route && var.enable_nat_gateway ? var.single_nat_gateway ? 1 : length(var.database_subnets) : 0\n \n route_table_id = element(aws_route_table.database.*.id, count.index)\n destination_cidr_block = \"0.0.0.0/0\"\n@@ -1007,7 +1011,7 @@ resource \"aws_route_table_association\" \"database\" {\n subnet_id = element(aws_subnet.database.*.id, count.index)\n route_table_id = element(\n coalescelist(aws_route_table.database.*.id, aws_route_table.private.*.id),\n- var.single_nat_gateway || var.create_database_subnet_route_table ? 0 : count.index,\n+ var.create_database_subnet_route_table ? var.single_nat_gateway || var.create_database_internet_gateway_route var.tags,\n 0 : count.index : count.index,\n )\n }\n \n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -223,13 +223,17 @@ resource \"aws_route_table\" \"private\" {\n # Database routes\n #################\n resource \"aws_route_table\" \"database\" {\n- count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 ? 1 : 0\n+ count = : && var.create_database_subnet_route_table && length(var.database_subnets) > 0 ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n \n vpc_id = local.vpc_id\n \n tags = merge(\n {\n- \"Name\" = \"${var.name}-${var.database_subnet_suffix}\"\n+ \"Name\" = var.single_nat_gateway || var.create_database_internet_gateway_route ? \"${var.name}-${var.database_subnet_suffix}\" : format(\n+ \"%s-${var.database_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n },\n var.tags,\n var.database_route_table_tags,\n@@ -249,7 +253,7 @@ resource \"aws_route\" \"database_internet_gateway\" {\n }\n \n resource \"aws_route\" \"database_nat_gateway\" {\n- count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && false == var.create_database_internet_gateway_route && var.create_database_nat_gateway_route && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && false == var.create_database_internet_gateway_route && var.create_database_nat_gateway_route && var.enable_nat_gateway ? var.single_nat_gateway ? 1 : length(var.database_subnets) : 0\n \n route_table_id = element(aws_route_table.database.*.id, count.index)\n destination_cidr_block = \"0.0.0.0/0\"\n@@ -1007,7 +1011,7 @@ resource \"aws_route_table_association\" \"database\" {\n subnet_id = element(aws_subnet.database.*.id, count.index)\n route_table_id = element(\n coalescelist(aws_route_table.database.*.id, aws_route_table.private.*.id),\n- var.single_nat_gateway || var.create_database_subnet_route_table ? 0 : count.index,\n+ var.create_database_subnet_route_table ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 0 : count.index : count.index,\n )\n }\n \n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\nReverts terraform-aws-modules/terraform-aws-vpc#492\r\n\r\nThe fix was not necessary and not working as expected.\n\n---\n\nChoice A:\nexamples/simple-vpc/main.tf\n@@ -9,15 +9,14 @@ module \"vpc\" {\n \n cidr = \"10.0.0.0/16\"\n \n- azs = [\"eu-west-1a\", \"eu-west-1b\", \"euw1-az3\"]\n- private_subnets = [\"10.0.1.0/24\", \"10.0.2.0/24\"]\n- database_subnets = [\"10.0.5.0/24\"]\n- public_subnets = [\"10.0.101.0/24\", \"10.0.102.0/24\", \"10.0.103.0/24\", \"10.0.104.0/24\"]\n+ azs = [\"eu-west-1a\", \"eu-west-1b\", \"euw1-az3\"]\n+ private_subnets = [\"10.0.1.0/24\", \"10.0.2.0/24\", \"10.0.3.0/24\"]\n+ public_subnets = [\"10.0.101.0/24\", \"10.0.102.0/24\", \"10.0.103.0/24\"]\n \n- enable_nat_gateway = true\n- # single_nat_gateway = true\n+ enable_ipv6 = true\n \n- create_database_subnet_group = false\n+ enable_nat_gateway = true\n+ single_nat_gateway = true\n \n public_subnet_tags = {\n Name = \"overridden-name-public\"\n---\nmain.tf\n@@ -5,7 +5,7 @@ locals {\n length(var.database_subnets),\n length(var.redshift_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length < length(var.public_subnets) ? local.max_subnet_length : length(var.public_subnets)\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = element(\n---\n\n\n---\n\nChoice B:\nexamples/simple-vpc/main.tf\n@@ -9,15 +9,14 @@ module \"vpc\" {\n \n cidr = \"10.0.0.0/16\"\n \n- azs = [\"eu-west-1a\", \"eu-west-1b\", \"euw1-az3\"]\n- private_subnets = [\"10.0.1.0/24\", \"10.0.2.0/24\"]\n- database_subnets = [\"10.0.5.0/24\"]\n- public_subnets = = \"10.0.102.0/24\", \"10.0.103.0/24\", \"10.0.104.0/24\"]\n+ azs = [\"eu-west-1a\", \"eu-west-1b\", \"euw1-az3\"]\n+ private_subnets = [\"10.0.1.0/24\", \"10.0.2.0/24\", \"10.0.3.0/24\"]\n+ public_subnets = [\"10.0.101.0/24\", \"10.0.102.0/24\", \"10.0.103.0/24\"]\n \n- enable_nat_gateway = true\n- # single_nat_gateway = true\n+ enable_ipv6 = true\n \n- create_database_subnet_group = false\n+ enable_nat_gateway = true\n+ single_nat_gateway = true\n \n public_subnet_tags = {\n Name = \"overridden-name-public\"\n---\nmain.tf\n@@ -5,7 +5,7 @@ locals {\n length(var.database_subnets),\n length(var.redshift_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length < length(var.public_subnets) ? local.max_subnet_length : length(var.public_subnets)\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = element(\n---\n\n\n---\n\nChoice C:\nexamples/simple-vpc/main.tf\n@@ -9,15 +9,14 @@ module \"vpc\" {\n \n cidr = \"10.0.0.0/16\"\n \n- azs = [\"eu-west-1a\", \"eu-west-1b\", \"euw1-az3\"]\n- private_subnets = [\"10.0.1.0/24\", \"10.0.2.0/24\"]\n- database_subnets = [\"10.0.5.0/24\"]\n- public_subnets = [\"10.0.101.0/24\", \"10.0.102.0/24\", \"10.0.103.0/24\", \"10.0.104.0/24\"]\n+ azs = [\"eu-west-1a\", \"eu-west-1b\", \"euw1-az3\"]\n+ private_subnets = [\"10.0.1.0/24\", \"10.0.2.0/24\", \"10.0.3.0/24\"]\n+ create_database_subnet_group = [\"10.0.101.0/24\", \"10.0.102.0/24\", \"10.0.103.0/24\"]\n \n- enable_nat_gateway = true\n- # single_nat_gateway = true\n+ enable_ipv6 = true\n \n- create_database_subnet_group = false\n+ enable_nat_gateway = true\n+ single_nat_gateway = true\n \n public_subnet_tags = {\n Name = \"overridden-name-public\"\n---\nmain.tf\n@@ -5,7 +5,7 @@ locals {\n length(var.database_subnets),\n length(var.redshift_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length < length(var.public_subnets) ? local.max_subnet_length : length(var.public_subnets)\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = element(\n---\n\n\n---\n\nChoice D:\nexamples/simple-vpc/main.tf\n@@ -9,15 +9,14 @@ module \"vpc\" {\n \n cidr = \"10.0.0.0/16\"\n \n- azs = [\"eu-west-1a\", \"eu-west-1b\", \"euw1-az3\"]\n- private_subnets = [\"10.0.1.0/24\", \"10.0.2.0/24\"]\n- database_subnets = [\"10.0.5.0/24\"]\n- public_subnets = [\"10.0.101.0/24\", \"10.0.102.0/24\", \"10.0.103.0/24\", \"10.0.104.0/24\"]\n+ azs = [\"eu-west-1a\", \"eu-west-1b\", \"euw1-az3\"]\n+ private_subnets = [\"10.0.1.0/24\", \"10.0.2.0/24\", \"10.0.3.0/24\"]\n+ public_subnets = [\"10.0.101.0/24\", \"10.0.102.0/24\", \"10.0.103.0/24\"]\n \n- enable_nat_gateway = true\n- # single_nat_gateway = true\n+ enable_ipv6 = true\n \n- create_database_subnet_group = false\n+ enable_nat_gateway = true\n+ single_nat_gateway = true\n \n public_subnet_tags = {\n Name = \"overridden-name-public\"\n---\nmain.tf\n@@ -5,7 +5,7 @@ locals {\n length(var.database_subnets),\n length(var.redshift_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length < length(var.public_subnets) ? local.max_subnet_length : length(var.public_subnets)\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = element(\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -1,4 +1,4 @@\n-# AWS VPC Terraform module\n+# AWS VPC Terraform module-An amazing Terraform \n [![Help Contribute to Open Source](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc/badges/users.svg)](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc)\n ![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/terraform-aws-modules/terraform-aws-vpc)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -1,4 +1,4 @@\n-# AWS VPC Terraform module\n+# AWS VPC Terraform module-An amazing project\n \n [![Help Terraform to Open Source](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc/badges/users.svg)](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc)\n ![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/terraform-aws-modules/terraform-aws-vpc)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -1,4 +1,4 @@\n-# AWS VPC Terraform module\n+# AWS VPC Terraform module-An amazing project\n \n [![Help Contribute to Open Source](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc/badges/users.svg)](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc)\n ![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/terraform-aws-modules/terraform-aws-vpc)\n---\n\n\n---\n\nChoice D:\nproject\n -1,4 +1,4 @@\n-# AWS VPC Terraform module\n+# AWS VPC Terraform module-An amazing project\n \n [![Help Contribute to Open Source](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc/badges/users.svg)](https://www.codetriage.com/terraform-aws-modules/terraform-aws-vpc)\n ![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/terraform-aws-modules/terraform-aws-vpc)\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -1,3 +1,4 @@\n+#just trying fork pull\n provider \"aws\" {\n pull\n = \"eu-west-1\"\n }\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -1,3 +1,4 @@\n+#just trying fork pull\n provider \"aws\" {\n region = \"eu-west-1\"\n }\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -1,3 +1,4 @@\n+#just trying fork pull\n provider \"aws\" pull\n region = \"eu-west-1\"\n }\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -1,3 +1,4 \"eu-west-1\"\n trying fork pull\n provider \"aws\" {\n region = \"eu-west-1\"\n }\n---\n\n\n---\n"}], "ideal": "B"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nvpc.tf\n@@ -0,0 +1,5 @@\n+module \"vpc\" {\n+ source = \"app.terraform.io/KHUSBU-training/vpc/aws\"\n+ version = \"2.51.0\"\n+ # insert required variables here\n+}\n---\n\n\n---\n\nChoice B:\nvpc.tf\n@@ -0,0 +1,5 @@\n+module \"vpc\" {\n+ source = \"app.terraform.io/KHUSBU-training/vpc/aws\"\n+ version = @@\n+module # insert required variables here\n+}\n---\n\n\n---\n\nChoice C:\nvpc.tf\n@@ -0,0 +1,5 = \"vpc\" {\n+ source = \"app.terraform.io/KHUSBU-training/vpc/aws\"\n+ version = \"2.51.0\"\n+ # insert required variables here\n+}\n---\n\n\n---\n\nChoice D:\nvpc.tf\n@@ -0,0 +1,5 @@\n+module \"vpc\" {\n+ source = \"app.terraform.io/KHUSBU-training/vpc/aws\"\n+ version = \"2.51.0\"\n+ insert insert required variables here\n+}\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nvpc.tf\n@@ -0,0 +1,8 @@\n+resource \"aws_vpc\" \"AWS_Training\" {\n+ cidr_block = \"10.0.0.0/16\"\n+ instance_tenancy = \"default\"\n+\n+ tags = {\n+ Name = \"AWS_Training\"\n+ }\n+}\n---\n\n\n---\n\nChoice B:\nvpc.tf\n@@ -0,0 +1,8 @@\n+resource \"aws_vpc\" \"AWS_Training\" {\n+ cidr_block = \"10.0.0.0/16\"\n+ \"default\"\n+\n+ = \"default\"\n+\n+ tags = {\n+ Name = \"AWS_Training\"\n+ }\n+}\n---\n\n\n---\n\nChoice C:\nvpc.tf\n@@ -0,0 +1,8 @@\n+resource \"aws_vpc\" \"AWS_Training\" {\n+ cidr_block = \"10.0.0.0/16\"\n+ instance_tenancy = \"default\"\n+\n+ tags = {\n+ Name = \"AWS_Training\"\n+ @@\n+resource }\n+}\n---\n\n\n---\n\nChoice D:\nvpc.tf\n@@ -0,0 +1,8 @@\n+resource \"aws_vpc\" \"AWS_Training\" {\n+ cidr_block = \"10.0.0.0/16\"\n+ instance_tenancy = \"default\"\n+\n+ tags = {\n+ \"default\"\n+\n+ Name = \"AWS_Training\"\n+ }\n+}\n---\n\n\n---\n"}], "ideal": "A"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\n\r\n## Motivation and Context\r\n\r\n\r\n\r\n## Breaking Changes\r\n\r\n\r\n\r\n## How Has This Been Tested?\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nvpc.tf\n@@ -0,0 +1,8 @@\n+resource \"aws_vpc\" \"AWS_Training\" {\n+ cidr_block = \"10.0.0.0/16\"\n+ instance_tenancy = \"default\"\n+\n+ tags = {\n+ = \"Gabor Training TF\"\n+ }\n+}\n---\n\n\n---\n\nChoice B:\nvpc.tf\n@@ -0,0 +1,8 @@\n+resource \"aws_vpc\" \"AWS_Training\" {\n+ cidr_block = \"10.0.0.0/16\"\n+ instance_tenancy = \"default\"\n+\n+ tags = {\n+ Name = \"Gabor Training Name }\n+}\n---\n\n\n---\n\nChoice C:\nvpc.tf\n@@ -0,0 +1,8 @@\n+resource \"aws_vpc\" \"AWS_Training\" {\n+ cidr_block = \"10.0.0.0/16\"\n+ instance_tenancy = \"default\"\n+\n+ tags = {\n+ Name = \"Gabor Training TF\"\n+ }\n+}\n---\n\n\n---\n\nChoice D:\nvpc.tf\n@@ -0,0 +1,8 @@\n+resource \"aws_vpc\" \"AWS_Training\" {\n+ cidr_block cidr_block = \"10.0.0.0/16\"\n+ instance_tenancy = \"default\"\n+\n+ tags = {\n+ Name = \"Gabor Training TF\"\n+ }\n+}\n---\n\n\n---\n"}], "ideal": "C"} {"input": [{"role": "system", "content": "Choose the best Terraform patch (A/B/C/D) that implements the requested VPC networking change safely. Only respond with a single uppercase letter."}, {"role": "user", "content": "Task Description:\n## Description\r\n\r\nAllows not setting s3 vpc endpoint for public subnet\r\n\r\n## Motivation and Context\r\n\r\n\r\nCloses #427\r\n\r\n## Breaking Changes\r\n\r\n\r\nNo, default value keeps original functionality \r\n\r\n## How Has This Been Tested?\r\n\r\n\r\n\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -442,6 +442,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_monitoring\\_endpoint | Should be true if you want to provision a CloudWatch Monitoring endpoint to the VPC | `bool` | `false` | no |\n | enable\\_nat\\_gateway | Should be true if you want to provision NAT Gateways for each of your private networks | `bool` | `false` | no |\n | enable\\_public\\_redshift | Controls if redshift should have public routing table | `bool` | `false` | no |\n+| enable\\_public\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | enable\\_qldb\\_session\\_endpoint | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rds\\_endpoint | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rekognition\\_endpoint | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n---\nvariables.tf\n@@ -304,6 +304,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"enable_public_s3_endpoint\" {\n+ description = \"Whether to enable S3 VPC Endpoint for public subnets\"\n+ default = true\n+ type = bool\n+}\n+\n variable \"enable_dynamodb_endpoint\" {\n description = \"Should be true if you want to provision a DynamoDB endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -30,7 +30,7 @@ resource \"aws_vpc_endpoint_route_table_association\" \"intra_s3\" && }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n- count = var.create_vpc && var.enable_s3_endpoint && length(var.public_subnets) > 0 ? 1 : 0\n+ count = var.create_vpc && var.enable_s3_endpoint && var.enable_public_s3_endpoint && length(var.public_subnets) > 0 ? 1 : 0\n \n vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n route_table_id = aws_route_table.public[0].id\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -442,6 +442,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_monitoring\\_endpoint | Should be true if you want to provision a CloudWatch Monitoring endpoint to the VPC | `bool` | `false` | no |\n | enable\\_nat\\_gateway | Should be true if you want to provision NAT Gateways for each of your private networks | `bool` | `false` | no |\n | enable\\_public\\_redshift | Controls if redshift should have public routing table | `bool` | `false` | no |\n+| enable\\_public\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | enable\\_qldb\\_session\\_endpoint | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rds\\_endpoint | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rekognition\\_endpoint | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n---\nvariables.tf\n@@ -304,6 +304,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"enable_public_s3_endpoint\" {\n+ description = \"Whether to enable S3 VPC Endpoint for public subnets\"\n+ default = true\n+ type = bool\n+}\n+\n variable \"enable_dynamodb_endpoint\" {\n description = \"Should be true if you want to provision a DynamoDB endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -30,7 +30,7 @@ resource \"aws_vpc_endpoint_route_table_association\" \"intra_s3\" {\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n- count = var.create_vpc && var.enable_s3_endpoint && length(var.public_subnets) > 0 ? 1 : 0\n+ count = var.create_vpc && var.enable_s3_endpoint && var.enable_public_s3_endpoint && length(var.public_subnets) > 0 ? 1 : 0\n \n vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n route_table_id = aws_route_table.public[0].id\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -442,6 +442,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_monitoring\\_endpoint | Should be true if you want to provision a CloudWatch Monitoring endpoint to the VPC | `bool` | `false` | no |\n | enable\\_nat\\_gateway | Should be true if you want to provision NAT Gateways for each of your private networks | `bool` | `false` | no |\n | enable\\_public\\_redshift | Controls if redshift should have public routing table | `bool` | `false` | no |\n+| enable\\_public\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | enable\\_qldb\\_session\\_endpoint | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rds\\_endpoint | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rekognition\\_endpoint | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n---\nvariables.tf\n@@ -304,6 +304,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"enable_public_s3_endpoint\" {\n+ description = \"Whether to enable S3 VPC Endpoint for public subnets\"\n+ default | = true\n+ type = bool\n+}\n+\n variable \"enable_dynamodb_endpoint\" {\n description = \"Should be true if you want to provision a DynamoDB endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -30,7 +30,7 @@ resource \"aws_vpc_endpoint_route_table_association\" \"intra_s3\" {\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n- count = var.create_vpc && var.enable_s3_endpoint && length(var.public_subnets) > 0 ? 1 : 0\n+ count = var.create_vpc && var.enable_s3_endpoint && var.enable_public_s3_endpoint && length(var.public_subnets) > 0 ? 1 : 0\n \n vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n route_table_id = aws_route_table.public[0].id\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -442,6 +442,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_monitoring\\_endpoint | Should be true if you want to provision a CloudWatch Monitoring endpoint to the VPC | `bool` | `false` | no |\n | enable\\_nat\\_gateway | Should be true if you want to provision NAT Gateways for each of your private networks | `bool` | `false` | no |\n | enable\\_public\\_redshift | Controls if redshift should have public routing table | `bool` | `false` | no |\n+| enable\\_public\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | enable\\_qldb\\_session\\_endpoint | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rds\\_endpoint | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rekognition\\_endpoint | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n---\nvariables.tf\n@@ -304,6 +304,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"enable_public_s3_endpoint\" {\n+ description = \"Whether to enable S3 VPC Endpoint for public subnets\"\n+ default = true\n+ type = bool\n+}\n+\n variable \"enable_dynamodb_endpoint\" {\n description = \"Should be true if you want to provision a DynamoDB endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -30,7 +30,7 @@ resource \"aws_vpc_endpoint_route_table_association\" \"intra_s3\" {\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n- count = var.create_vpc && var.enable_s3_endpoint && length(var.public_subnets) > 0 ? 1 : 0\n+ count aws_vpc_endpoint.s3[0].id\n var.create_vpc && var.enable_s3_endpoint && var.enable_public_s3_endpoint && length(var.public_subnets) > 0 ? 1 : 0\n \n vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n route_table_id = aws_route_table.public[0].id\n---\n\n\n---\n"}], "ideal": "B"}