input
listlengths 2
2
| ideal
stringclasses 4
values |
|---|---|
[
{
"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<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
B
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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…ts module\r\n\r\n## Description\r\n<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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"
}
] |
A
|
[
{
"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"
}
] |
A
|
[
{
"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 — has no effect)\n+ - ✅ 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+ - ✅ 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+ - ✅ Behavior depends on private subnet layout — 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+> ⚠️ **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 — has no effect)\n+ - ✅ 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+ - ✅ 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+ - ✅ Behavior depends on private subnet layout — 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+> ⚠️ **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 — has no effect)\n+ - ✅ 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+ - ✅ 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+ - ✅ Behavior depends on private subnet layout — 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+> ⚠️ **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 — has no effect)\n+ - ✅ 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+ - ✅ 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+ - ✅ Behavior depends on private subnet layout — 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+> ⚠️ **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"
}
] |
C
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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"
}
] |
C
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
D
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\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"
}
] |
A
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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<!--- Describe your changes in detail -->\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<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
B
|
[
{
"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"
}
] |
A
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -485,6 +485,7 @@ No modules.\n | <a name=\"input_intra_subnet_private_dns_hostname_type_on_launch\"></a> [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 | <a name=\"input_intra_subnet_suffix\"></a> [intra\\_subnet\\_suffix](#input\\_intra\\_subnet\\_suffix) | Suffix to append to intra subnets name | `string` | `\"intra\"` | no |\n | <a name=\"input_intra_subnet_tags\"></a> [intra\\_subnet\\_tags](#input\\_intra\\_subnet\\_tags) | Additional tags for the intra subnets | `map(string)` | `{}` | no |\n+| <a name=\"input_intra_subnet_tags_per_az\"></a> [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 | <a name=\"input_intra_subnets\"></a> [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_ipv4_ipam_pool_id\"></a> [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 | <a name=\"input_ipv4_netmask_length\"></a> [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 | <a name=\"input_intra_subnet_private_dns_hostname_type_on_launch\"></a> [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 | <a name=\"input_intra_subnet_suffix\"></a> [intra\\_subnet\\_suffix](#input\\_intra\\_subnet\\_suffix) | Suffix to append to intra subnets name | `string` | `\"intra\"` | no |\n | <a name=\"input_intra_subnet_tags\"></a> [intra\\_subnet\\_tags](#input\\_intra\\_subnet\\_tags) | Additional tags for the intra subnets | `map(string)` | `{}` | no |\n+| <a name=\"input_intra_subnet_tags_per_az\"></a> [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 | <a name=\"input_intra_subnets\"></a> [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_ipv4_ipam_pool_id\"></a> [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 | <a name=\"input_ipv4_netmask_length\"></a> [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 | <a name=\"input_intra_subnet_private_dns_hostname_type_on_launch\"></a> [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 | <a name=\"input_intra_subnet_suffix\"></a> [intra\\_subnet\\_suffix](#input\\_intra\\_subnet\\_suffix) | Suffix to append to intra subnets name | `string` | `\"intra\"` | no |\n | <a name=\"input_intra_subnet_tags\"></a> [intra\\_subnet\\_tags](#input\\_intra\\_subnet\\_tags) | Additional tags for the intra subnets | `map(string)` | `{}` | no |\n+| <a name=\"input_intra_subnet_tags_per_az\"></a> [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 | <a name=\"input_intra_subnets\"></a> [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_ipv4_ipam_pool_id\"></a> [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 | <a name=\"input_ipv4_netmask_length\"></a> [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 | <a name=\"input_intra_subnet_private_dns_hostname_type_on_launch\"></a> [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 | <a name=\"input_intra_subnet_suffix\"></a> [intra\\_subnet\\_suffix](#input\\_intra\\_subnet\\_suffix) | Suffix to append to intra subnets name | `string` | `\"intra\"` | no |\n | <a name=\"input_intra_subnet_tags\"></a> [intra\\_subnet\\_tags](#input\\_intra\\_subnet\\_tags) | Additional tags for the intra subnets | `map(string)` | `{}` | no |\n+| <a name=\"input_intra_subnet_tags_per_az\"></a> [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 | <a name=\"input_intra_subnets\"></a> [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_ipv4_ipam_pool_id\"></a> [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 | <a name=\"input_ipv4_netmask_length\"></a> [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"
}
] |
C
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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"
}
] |
B
|
[
{
"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 | <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 1.0 |\n-| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 5.46 |\n+| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 5.83 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 5.46 |\n+| <a name=\"provider_aws\"></a> [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 | <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 1.0 |\n-| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 5.46 |\n+| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 5.83 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 5.46 |\n+| <a name=\"provider_aws\"></a> [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 | <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 1.0 |\n-| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 5.46 |\n+| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 5.83 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 5.46 |\n+| <a name=\"provider_aws\"></a> [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 | <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 1.0 |\n-| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 5.46 |\n+| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 5.83 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 5.46 |\n+| <a name=\"provider_aws\"></a> [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\"></a> }\n }\n }\n---\n\n\n---\n"
}
] |
C
|
[
{
"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 | <a name=\"input_secondary_cidr_blocks\"></a> [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 | <a name=\"input_single_nat_gateway\"></a> [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 | <a name=\"input_tags\"></a> [tags](#input\\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |\n-| <a name=\"input_use_ipam_pool\"></a> [use\\_ipam\\_pool](#input\\_use\\_ipam\\_pool) | Determines whether IPAM pool is used for CIDR allocation | `bool` | `false` | no |\n+| <a name=\"input_use_ipv4_ipam_pool\"></a> [use\\_ipv4\\_ipam\\_pool](#input\\_use\\_ipv4\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv4 CIDR allocation | `bool` | `false` | no |\n+| <a name=\"input_use_ipv6_ipam_pool\"></a> [use\\_ipv6\\_ipam\\_pool](#input\\_use\\_ipv6\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv6 CIDR allocation | `bool` | `false` | no |\n | <a name=\"input_vpc_block_public_access_exclusions\"></a> [vpc\\_block\\_public\\_access\\_exclusions](#input\\_vpc\\_block\\_public\\_access\\_exclusions) | A map of VPC block public access exclusions | `map(any)` | `{}` | no |\n | <a name=\"input_vpc_block_public_access_options\"></a> [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 | <a name=\"input_vpc_flow_log_iam_policy_name\"></a> [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 | <a name=\"input_secondary_cidr_blocks\"></a> [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 | <a name=\"input_single_nat_gateway\"></a> [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 | <a name=\"input_tags\"></a> [tags](#input\\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |\n-| <a name=\"input_use_ipam_pool\"></a> [use\\_ipam\\_pool](#input\\_use\\_ipam\\_pool) | Determines whether IPAM pool is used for CIDR allocation | `bool` | `false` | no |\n+| <a name=\"input_use_ipv4_ipam_pool\"></a> [use\\_ipv4\\_ipam\\_pool](#input\\_use\\_ipv4\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv4 CIDR allocation | `bool` | `false` | no |\n+| <a name=\"input_use_ipv6_ipam_pool\"></a> [use\\_ipv6\\_ipam\\_pool](#input\\_use\\_ipv6\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv6 CIDR allocation | `bool` | `false` | no |\n | <a name=\"input_vpc_block_public_access_exclusions\"></a> [vpc\\_block\\_public\\_access\\_exclusions](#input\\_vpc\\_block\\_public\\_access\\_exclusions) | A map of VPC block public access exclusions | `map(any)` | `{}` | no |\n | <a name=\"input_vpc_block_public_access_options\"></a> [vpc\\_block\\_public\\_access\\_options](#input\\_vpc\\_block\\_public\\_access\\_options) | A map of VPC block public access options | `map(string)` | `{}` | no |\n | <a name=\"input_vpc_flow_log_iam_policy_name\"></a> [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 | <a name=\"input_secondary_cidr_blocks\"></a> [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 | <a name=\"input_single_nat_gateway\"></a> [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 | <a name=\"input_tags\"></a> [tags](#input\\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |\n-| <a name=\"input_use_ipam_pool\"></a> [use\\_ipam\\_pool](#input\\_use\\_ipam\\_pool) | Determines whether IPAM pool is used for CIDR allocation | `bool` | `false` | no |\n+| <a name=\"input_use_ipv4_ipam_pool\"></a> [use\\_ipv4\\_ipam\\_pool](#input\\_use\\_ipv4\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv4 CIDR allocation | `bool` | `false` | no |\n+| <a name=\"input_use_ipv6_ipam_pool\"></a> [use\\_ipv6\\_ipam\\_pool](#input\\_use\\_ipv6\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv6 CIDR allocation | `bool` | `false` | no |\n | <a name=\"input_vpc_block_public_access_exclusions\"></a> [vpc\\_block\\_public\\_access\\_exclusions](#input\\_vpc\\_block\\_public\\_access\\_exclusions) | A map of VPC block public access exclusions | `map(any)` | `{}` | no |\n | <a name=\"input_vpc_block_public_access_options\"></a> [vpc\\_block\\_public\\_access\\_options](#input\\_vpc\\_block\\_public\\_access\\_options) | A map of VPC block public access options | `map(string)` | `{}` | no |\n | <a name=\"input_vpc_flow_log_iam_policy_name\"></a> [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 | <a name=\"input_secondary_cidr_blocks\"></a> [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 | <a name=\"input_single_nat_gateway\"></a> [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 | <a name=\"input_tags\"></a> [tags](#input\\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |\n-| <a name=\"input_use_ipam_pool\"></a> [use\\_ipam\\_pool](#input\\_use\\_ipam\\_pool) | Determines whether IPAM pool is used for CIDR allocation | `bool` | `false` | no |\n+| <a name=\"input_use_ipv4_ipam_pool\"></a> [use\\_ipv4\\_ipam\\_pool](#input\\_use\\_ipv4\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv4 CIDR allocation | `bool` | `false` | no |\n+| <a name=\"input_use_ipv6_ipam_pool\"></a> [use\\_ipv6\\_ipam\\_pool](#input\\_use\\_ipv6\\_ipam\\_pool) | Determines whether IPAM pool is used for IPv6 CIDR allocation | `bool` | `false` | no |\n | <a name=\"input_vpc_block_public_access_exclusions\"></a> [vpc\\_block\\_public\\_access\\_exclusions](#input\\_vpc\\_block\\_public\\_access\\_exclusions) | A map of VPC block public access exclusions | `map(any)` | `{}` | no |\n | <a name=\"input_vpc_block_public_access_options\"></a> [vpc\\_block\\_public\\_access\\_options](#input\\_vpc\\_block\\_public\\_access\\_options) | A map of VPC block public access options | `map(string)` | `{}` | no |\n | <a name=\"input_vpc_flow_log_iam_policy_name\"></a> [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"
}
] |
D
|
[
{
"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"
}
] |
D
|
[
{
"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"
}
] |
C
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
D
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_nat_gateway_tags_per_az\"></a> [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 | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_nat_gateway_tags_per_az\"></a> [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 | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_nat_gateway_tags_per_az\"></a> [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 | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_nat_gateway_tags_per_az\"></a> [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 | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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"
}
] |
A
|
[
{
"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 | <a name=\"input_private_subnet_suffix\"></a> [private\\_subnet\\_suffix](#input\\_private\\_subnet\\_suffix) | Suffix to append to private subnets name | `string` | `\"private\"` | no |\n | <a name=\"input_private_subnet_tags\"></a> [private\\_subnet\\_tags](#input\\_private\\_subnet\\_tags) | Additional tags for the private subnets | `map(string)` | `{}` | no |\n | <a name=\"input_private_subnet_tags_per_az\"></a> [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+| <a name=\"input_private_subnet_tags_per_name\"></a> [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 | <a name=\"input_private_subnets\"></a> [private\\_subnets](#input\\_private\\_subnets) | A list of private subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_propagate_intra_route_tables_vgw\"></a> [propagate\\_intra\\_route\\_tables\\_vgw](#input\\_propagate\\_intra\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n | <a name=\"input_propagate_private_route_tables_vgw\"></a> [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 | <a name=\"input_public_subnet_suffix\"></a> [public\\_subnet\\_suffix](#input\\_public\\_subnet\\_suffix) | Suffix to append to public subnets name | `string` | `\"public\"` | no |\n | <a name=\"input_public_subnet_tags\"></a> [public\\_subnet\\_tags](#input\\_public\\_subnet\\_tags) | Additional tags for the public subnets | `map(string)` | `{}` | no |\n | <a name=\"input_public_subnet_tags_per_az\"></a> [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+| <a name=\"input_public_subnet_tags_per_name\"></a> [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 | <a name=\"input_public_subnets\"></a> [public\\_subnets](#input\\_public\\_subnets) | A list of public subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_putin_khuylo\"></a> [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 | <a name=\"input_redshift_acl_tags\"></a> [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 | <a name=\"input_private_subnet_suffix\"></a> [private\\_subnet\\_suffix](#input\\_private\\_subnet\\_suffix) | Suffix to append to private subnets name | `string` | `\"private\"` | no |\n | <a name=\"input_private_subnet_tags\"></a> [private\\_subnet\\_tags](#input\\_private\\_subnet\\_tags) | Additional tags for the private subnets | `map(string)` | `{}` | no |\n | <a name=\"input_private_subnet_tags_per_az\"></a> [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+| <a name=\"input_private_subnet_tags_per_name\"></a> [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 | <a name=\"input_private_subnets\"></a> [private\\_subnets](#input\\_private\\_subnets) | A list of private subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_propagate_intra_route_tables_vgw\"></a> [propagate\\_intra\\_route\\_tables\\_vgw](#input\\_propagate\\_intra\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n | <a name=\"input_propagate_private_route_tables_vgw\"></a> [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 | <a name=\"input_public_subnet_suffix\"></a> [public\\_subnet\\_suffix](#input\\_public\\_subnet\\_suffix) | Suffix to append to public subnets name | `string` | `\"public\"` | no |\n | <a name=\"input_public_subnet_tags\"></a> [public\\_subnet\\_tags](#input\\_public\\_subnet\\_tags) | Additional tags for the public subnets | `map(string)` | `{}` | no |\n | <a name=\"input_public_subnet_tags_per_az\"></a> [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+| <a name=\"input_public_subnet_tags_per_name\"></a> [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 | <a name=\"input_public_subnets\"></a> [public\\_subnets](#input\\_public\\_subnets) | A list of public subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_putin_khuylo\"></a> [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 | <a name=\"input_redshift_acl_tags\"></a> [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 | <a name=\"input_private_subnet_suffix\"></a> [private\\_subnet\\_suffix](#input\\_private\\_subnet\\_suffix) | Suffix to append to private subnets name | `string` | `\"private\"` | no |\n | <a name=\"input_private_subnet_tags\"></a> [private\\_subnet\\_tags](#input\\_private\\_subnet\\_tags) | Additional tags for the private subnets | `map(string)` | `{}` | no |\n | <a name=\"input_private_subnet_tags_per_az\"></a> [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+| <a name=\"input_private_subnet_tags_per_name\"></a> [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 | <a name=\"input_private_subnets\"></a> [private\\_subnets](#input\\_private\\_subnets) | A list of private subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_propagate_intra_route_tables_vgw\"></a> [propagate\\_intra\\_route\\_tables\\_vgw](#input\\_propagate\\_intra\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n | <a name=\"input_propagate_private_route_tables_vgw\"></a> [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 | <a name=\"input_public_subnet_suffix\"></a> [public\\_subnet\\_suffix](#input\\_public\\_subnet\\_suffix) | Suffix to append to public subnets name | `string` | `\"public\"` | no |\n | <a name=\"input_public_subnet_tags\"></a> [public\\_subnet\\_tags](#input\\_public\\_subnet\\_tags) | Additional tags for the public subnets | `map(string)` | `{}` | no |\n | <a name=\"input_public_subnet_tags_per_az\"></a> [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+| <a name=\"input_public_subnet_tags_per_name\"></a> [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 | <a name=\"input_public_subnets\"></a> [public\\_subnets](#input\\_public\\_subnets) | A list of public subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_putin_khuylo\"></a> [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 | <a name=\"input_redshift_acl_tags\"></a> [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 | <a name=\"input_private_subnet_suffix\"></a> [private\\_subnet\\_suffix](#input\\_private\\_subnet\\_suffix) | Suffix to append to private subnets name | `string` | `\"private\"` | no |\n | <a name=\"input_private_subnet_tags\"></a> [private\\_subnet\\_tags](#input\\_private\\_subnet\\_tags) | Additional tags for the private subnets | `map(string)` | `{}` | no |\n | <a name=\"input_private_subnet_tags_per_az\"></a> [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+| <a name=\"input_private_subnet_tags_per_name\"></a> [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 = <a name=\"input_private_subnets\"></a> [private\\_subnets](#input\\_private\\_subnets) | A list of private subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_propagate_intra_route_tables_vgw\"></a> [propagate\\_intra\\_route\\_tables\\_vgw](#input\\_propagate\\_intra\\_route\\_tables\\_vgw) | Should be true if you want route table propagation | `bool` | `false` | no |\n | <a name=\"input_propagate_private_route_tables_vgw\"></a> [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 | <a name=\"input_public_subnet_suffix\"></a> [public\\_subnet\\_suffix](#input\\_public\\_subnet\\_suffix) | Suffix to append to public subnets name | `string` | `\"public\"` | no |\n | <a name=\"input_public_subnet_tags\"></a> [public\\_subnet\\_tags](#input\\_public\\_subnet\\_tags) | Additional tags for the public subnets | `map(string)` | `{}` | no |\n | <a name=\"input_public_subnet_tags_per_az\"></a> [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+| <a name=\"input_public_subnet_tags_per_name\"></a> [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 | <a name=\"input_public_subnets\"></a> [public\\_subnets](#input\\_public\\_subnets) | A list of public subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_putin_khuylo\"></a> [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 | <a name=\"input_redshift_acl_tags\"></a> [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"
}
] |
B
|
[
{
"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 | <a name=\"input_external_nat_ip_ids\"></a> [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 | <a name=\"input_external_nat_ips\"></a> [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 | <a name=\"input_flow_log_cloudwatch_iam_role_arn\"></a> [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+| <a name=\"input_flow_log_cloudwatch_iam_role_conditions\"></a> [flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions) | Additional conditions of the CloudWatch role assumption policy | <pre>list(object({<br/> test = string<br/> variable = string<br/> values = list(string)<br/> }))</pre> | `[]` | no |\n | <a name=\"input_flow_log_cloudwatch_log_group_class\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_kms_key_id\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_name_prefix\"></a> [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 | <a name=\"input_external_nat_ip_ids\"></a> [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 | <a name=\"input_external_nat_ips\"></a> [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 | <a name=\"input_flow_log_cloudwatch_iam_role_arn\"></a> [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+| <a name=\"input_flow_log_cloudwatch_iam_role_conditions\"></a> [flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions) | Additional conditions of the CloudWatch role assumption policy | <pre>list(object({<br/> test = string<br/> variable = string<br/> values = list(string)<br/> }))</pre> | `[]` | no |\n | <a name=\"input_flow_log_cloudwatch_log_group_class\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_kms_key_id\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_name_prefix\"></a> [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 | <a name=\"input_external_nat_ip_ids\"></a> [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 | <a name=\"input_external_nat_ips\"></a> [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 | <a name=\"input_flow_log_cloudwatch_iam_role_arn\"></a> [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+| <a name=\"input_flow_log_cloudwatch_iam_role_conditions\"></a> [flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions) | Additional conditions of the CloudWatch role assumption policy | <pre>list(object({<br/> test = string<br/> variable = string<br/> values = list(string)<br/> }))</pre> | `[]` | no |\n | <a name=\"input_flow_log_cloudwatch_log_group_class\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_kms_key_id\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_name_prefix\"></a> [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 | <a name=\"input_external_nat_ip_ids\"></a> [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 | <a name=\"input_external_nat_ips\"></a> [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 | <a name=\"input_flow_log_cloudwatch_iam_role_arn\"></a> [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+| <a name=\"input_flow_log_cloudwatch_iam_role_conditions\"></a> [flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions](#input\\_flow\\_log\\_cloudwatch\\_iam\\_role\\_conditions) | Additional conditions of the CloudWatch role assumption policy | <pre>list(object({<br/> test = string<br/> | = string<br/> values = list(string)<br/> }))</pre> | `[]` | no |\n | <a name=\"input_flow_log_cloudwatch_log_group_class\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_kms_key_id\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_name_prefix\"></a> [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"
}
] |
A
|
[
{
"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<!-- Does this break backwards compatibility with the current major version? -->\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 | <a name=\"input_create_igw\"></a> [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 | <a name=\"input_create_multiple_intra_route_tables\"></a> [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 | <a name=\"input_create_multiple_public_route_tables\"></a> [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+| <a name=\"input_create_private_nat_gateway_route\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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 | <a name=\"input_create_igw\"></a> [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 | <a name=\"input_create_multiple_intra_route_tables\"></a> [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 | <a name=\"input_create_multiple_public_route_tables\"></a> [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+| <a name=\"input_create_private_nat_gateway_route\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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 | <a name=\"input_create_igw\"></a> [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 | <a name=\"input_create_multiple_intra_route_tables\"></a> [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 | <a name=\"input_create_multiple_public_route_tables\"></a> [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+| <a name=\"input_create_private_nat_gateway_route\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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 | <a name=\"input_create_igw\"></a> [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 | <a name=\"input_create_multiple_intra_route_tables\"></a> [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 | <a name=\"input_create_multiple_public_route_tables\"></a> [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+| <a name=\"input_create_private_nat_gateway_route\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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"
}
] |
C
|
[
{
"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<!--- Describe your changes in detail -->\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<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\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<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [X] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -447,6 +447,7 @@ No modules.\n | <a name=\"input_enable_ipv6\"></a> [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 | <a name=\"input_enable_nat_gateway\"></a> [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 | <a name=\"input_enable_network_address_usage_metrics\"></a> [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+| <a name=\"input_enable_public_igw_route\"></a> [enable\\_public\\_igw\\_route](#input\\_enable\\_public\\_igw\\_route) | Controls if public route tables should have route to internet gateway. | `bool` | `true` | no |\n | <a name=\"input_enable_public_redshift\"></a> [enable\\_public\\_redshift](#input\\_enable\\_public\\_redshift) | Controls if redshift should have public routing table | `bool` | `false` | no |\n | <a name=\"input_enable_vpn_gateway\"></a> [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 | <a name=\"input_external_nat_ip_ids\"></a> [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 | <a name=\"input_enable_ipv6\"></a> [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 | <a name=\"input_enable_nat_gateway\"></a> [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 | <a name=\"input_enable_network_address_usage_metrics\"></a> [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+| <a name=\"input_enable_public_igw_route\"></a> [enable\\_public\\_igw\\_route](#input\\_enable\\_public\\_igw\\_route) | Controls if public route tables should have route to internet gateway. | `bool` | `true` | no |\n | <a name=\"input_enable_public_redshift\"></a> [enable\\_public\\_redshift](#input\\_enable\\_public\\_redshift) | Controls if redshift should have public routing table | `bool` | `false` no |\n | <a name=\"input_enable_vpn_gateway\"></a> [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 | <a name=\"input_external_nat_ip_ids\"></a> [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 | <a name=\"input_enable_ipv6\"></a> [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 | <a name=\"input_enable_nat_gateway\"></a> [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 | <a name=\"input_enable_network_address_usage_metrics\"></a> [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+| <a name=\"input_enable_public_igw_route\"></a> [enable\\_public\\_igw\\_route](#input\\_enable\\_public\\_igw\\_route) | Controls if public route tables should have route to internet gateway. | `bool` | `true` | no |\n | <a name=\"input_enable_public_redshift\"></a> [enable\\_public\\_redshift](#input\\_enable\\_public\\_redshift) | Controls if redshift should have public routing table | `bool` | `false` | no |\n | <a name=\"input_enable_vpn_gateway\"></a> [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 | <a name=\"input_external_nat_ip_ids\"></a> [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 | <a name=\"input_enable_ipv6\"></a> [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 | <a name=\"input_enable_nat_gateway\"></a> [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 | <a name=\"input_enable_network_address_usage_metrics\"></a> [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+| <a name=\"input_enable_public_igw_route\"></a> [enable\\_public\\_igw\\_route](#input\\_enable\\_public\\_igw\\_route) | Controls if public route tables should have route to internet gateway. | `bool` | `true` | no |\n | <a name=\"input_enable_public_redshift\"></a> [enable\\_public\\_redshift](#input\\_enable\\_public\\_redshift) | Controls if redshift should have public routing table | `bool` | `false` | no |\n | <a name=\"input_enable_vpn_gateway\"></a> [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 | <a name=\"input_external_nat_ip_ids\"></a> [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"
}
] |
C
|
[
{
"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<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
B
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\r\n\r\nThank you.\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -500,6 +500,7 @@ No modules.\n | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_nat_gateway_tags_per_az\"></a> [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 | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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 | <a name=\"input_private_inbound_acl_rules\"></a> [private\\_inbound\\_acl\\_rules](#input\\_private\\_inbound\\_acl\\_rules) | Private subnets inbound network ACLs | `list(map(string))` | <pre>[<br> {<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_action\": \"allow\",<br> \"rule_number\": 100,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_private_outbound_acl_rules\"></a> [private\\_outbound\\_acl\\_rules](#input\\_private\\_outbound\\_acl\\_rules) | Private subnets outbound network ACLs | `list(map(string))` | <pre>[<br> {<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_action\": \"allow\",<br> \"rule_number\": 100,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_private_route_table_tags\"></a> [private\\_route\\_table\\_tags](#input\\_private\\_route\\_table\\_tags) | Additional tags for the private route tables | `map(string)` | `{}` | no |\n+| <a name=\"input_private_route_table_tags_per_az\"></a> [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 | <a name=\"input_private_subnet_assign_ipv6_address_on_creation\"></a> [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 | <a name=\"input_private_subnet_enable_dns64\"></a> [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 | <a name=\"input_private_subnet_enable_resource_name_dns_a_record_on_launch\"></a> [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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_nat_gateway_tags_per_az\"></a> [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 | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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 | <a name=\"input_private_inbound_acl_rules\"></a> [private\\_inbound\\_acl\\_rules](#input\\_private\\_inbound\\_acl\\_rules) | Private subnets inbound network ACLs | `list(map(string))` | <pre>[<br> {<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_action\": \"allow\",<br> \"rule_number\": 100,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_private_outbound_acl_rules\"></a> [private\\_outbound\\_acl\\_rules](#input\\_private\\_outbound\\_acl\\_rules) | Private subnets outbound network ACLs | `list(map(string))` | <pre>[<br> {<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_action\": \"allow\",<br> \"rule_number\": 100,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_private_route_table_tags\"></a> [private\\_route\\_table\\_tags](#input\\_private\\_route\\_table\\_tags) | Additional tags for the private route tables | `map(string)` | `{}` | no |\n+| <a name=\"input_private_route_table_tags_per_az\"></a> [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 | <a name=\"input_private_subnet_assign_ipv6_address_on_creation\"></a> [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 | <a name=\"input_private_subnet_enable_dns64\"></a> [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 | <a name=\"input_private_subnet_enable_resource_name_dns_a_record_on_launch\"></a> [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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_nat_gateway_tags_per_az\"></a> [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 | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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 | <a name=\"input_private_inbound_acl_rules\"></a> [private\\_inbound\\_acl\\_rules](#input\\_private\\_inbound\\_acl\\_rules) | Private subnets inbound network ACLs | `list(map(string))` | <pre>[<br> {<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_action\": \"allow\",<br> \"rule_number\": 100,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_private_outbound_acl_rules\"></a> [private\\_outbound\\_acl\\_rules](#input\\_private\\_outbound\\_acl\\_rules) | Private subnets outbound network ACLs | `list(map(string))` | <pre>[<br> {<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_action\": \"allow\",<br> \"rule_number\": 100,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_private_route_table_tags\"></a> [private\\_route\\_table\\_tags](#input\\_private\\_route\\_table\\_tags) | Additional tags for the private route tables | `map(string)` | `{}` | no |\n+| <a name=\"input_private_route_table_tags_per_az\"></a> [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 | <a name=\"input_private_subnet_assign_ipv6_address_on_creation\"></a> [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 | <a name=\"input_private_subnet_enable_dns64\"></a> [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 | <a name=\"input_private_subnet_enable_resource_name_dns_a_record_on_launch\"></a> [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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_nat_gateway_tags_per_az\"></a> [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 | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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 | <a name=\"input_private_inbound_acl_rules\"></a> [private\\_inbound\\_acl\\_rules](#input\\_private\\_inbound\\_acl\\_rules) | Private subnets inbound network ACLs | `list(map(string))` | <pre>[<br> {<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_action\": \"allow\",<br> \"rule_number\": 100,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_private_outbound_acl_rules\"></a> [private\\_outbound\\_acl\\_rules](#input\\_private\\_outbound\\_acl\\_rules) | Private subnets outbound network ACLs | `list(map(string))` | <pre>[<br> {<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_action\": \"allow\",<br> \"rule_number\": 100,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_private_route_table_tags\"></a> [private\\_route\\_table\\_tags](#input\\_private\\_route\\_table\\_tags) | Additional tags for the private route tables | `map(string)` | `{}` | no |\n+| <a name=\"input_private_route_table_tags_per_az\"></a> [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 | <a name=\"input_private_subnet_assign_ipv6_address_on_creation\"></a> [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 | <a name=\"input_private_subnet_enable_dns64\"></a> [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 | <a name=\"input_private_subnet_enable_resource_name_dns_a_record_on_launch\"></a> [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"
}
] |
B
|
[
{
"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… 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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [X] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
B
|
[
{
"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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_number_of_secondary_eips_per_gateway\"></a> [number\\_of\\_secondary\\_eips\\_per\\_gateway](#input\\_number\\_of\\_secondary\\_eips\\_per\\_gateway) | how many secondary eips per NAT Gateway | `number` | `0` | no |\n | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags name=\"input_one_nat_gateway_per_az\"></a> the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_number_of_secondary_eips_per_gateway\"></a> [number\\_of\\_secondary\\_eips\\_per\\_gateway](#input\\_number\\_of\\_secondary\\_eips\\_per\\_gateway) | how many secondary eips per NAT Gateway | `number` | `0` | no |\n | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_number_of_secondary_eips_per_gateway\"></a> [number\\_of\\_secondary\\_eips\\_per\\_gateway](#input\\_number\\_of\\_secondary\\_eips\\_per\\_gateway) | how many secondary eips per NAT Gateway | `number` | `0` | no |\n | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_number_of_secondary_eips_per_gateway\"></a> [number\\_of\\_secondary\\_eips\\_per\\_gateway](#input\\_number\\_of\\_secondary\\_eips\\_per\\_gateway) | how many secondary eips per NAT Gateway | `number` | `0` | no |\n | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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"
}
] |
D
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [X] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
D
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ x ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -371,6 +371,7 @@ No modules.\n | <a name=\"input_create_igw\"></a> [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 | <a name=\"input_create_multiple_intra_route_tables\"></a> [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 | <a name=\"input_create_multiple_public_route_tables\"></a> [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+| <a name=\"input_create_private_nat_gateway_route\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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 | <a name=\"input_create_igw\"></a> [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 | <a name=\"input_create_multiple_intra_route_tables\"></a> [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 | <a name=\"input_create_multiple_public_route_tables\"></a> [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+| <a name=\"input_create_private_nat_gateway_route\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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 | <a name=\"input_create_igw\"></a> [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 | <a name=\"input_create_multiple_intra_route_tables\"></a> [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 | <a name=\"input_create_multiple_public_route_tables\"></a> [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+| <a name=\"input_create_private_nat_gateway_route\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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 | <a name=\"input_create_igw\"></a> [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 | <a name=\"input_create_multiple_intra_route_tables\"></a> [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 | <a name=\"input_create_multiple_public_route_tables\"></a> [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+| <a name=\"input_create_private_nat_gateway_route\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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"
}
] |
A
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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 reposiotory.\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’s 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 reposiotory.\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’s 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 reposiotory.\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’s 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 reposiotory.\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’s 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"
}
] |
D
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [*] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
D
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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"
}
] |
C
|
[
{
"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"
}
] |
C
|
[
{
"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<!--- Describe your changes in detail -->\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<!--- Why is this change required? What problem does it solve? -->\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<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n\r\nThere is no breaking changes.\r\n\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -369,6 +369,7 @@ No modules.\n | <a name=\"input_create_flow_log_cloudwatch_iam_role\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_log_group\"></a> [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 | <a name=\"input_create_igw\"></a> [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+| <a name=\"input_create_intra_subnet_route_table\"></a> [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 | <a name=\"input_create_multiple_intra_route_tables\"></a> [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 | <a name=\"input_create_multiple_public_route_tables\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_iam_role\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_log_group\"></a> [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 | <a name=\"input_create_igw\"></a> [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+| <a name=\"input_create_intra_subnet_route_table\"></a> [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 | <a name=\"input_create_multiple_intra_route_tables\"></a> [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 | <a name=\"input_create_multiple_public_route_tables\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_iam_role\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_log_group\"></a> [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 | <a name=\"input_create_igw\"></a> [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+| <a name=\"input_create_intra_subnet_route_table\"></a> [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 | <a name=\"input_create_multiple_intra_route_tables\"></a> [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 | <a name=\"input_create_multiple_public_route_tables\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_iam_role\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_log_group\"></a> [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 | <a name=\"input_create_igw\"></a> [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+| <a name=\"input_create_intra_subnet_route_table\"></a> [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 | <a name=\"input_create_multiple_intra_route_tables\"></a> [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 | <a name=\"input_create_multiple_public_route_tables\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [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"
}
] |
B
|
[
{
"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"
}
] |
D
|
[
{
"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 <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->\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 <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->\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 <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->\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 <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->\n ## Requirements\n---\n\n\n---\n"
}
] |
A
|
[
{
"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[](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\nUsers should update at least one of the existing example projects, deploy it, and compare their changes against the initial state.\r\nThis will help highlight any breaking/disruptive changes. Once changes are reviewed, they should be tested for verification.\r\nPlease refer to the pre-commit instructions here: https://github.com/antonbabenko/pre-commit-terraform#how-to-install\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"
}
] |
A
|
[
{
"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"
}
] |
A
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_nat_gateways\"></a> [nat\\_gateways](#input\\_nat\\_gateways) | Pass the amount of public NAT gateways you would like to create. | `number` | `1` | no |\n | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_nat_gateways\"></a> [nat\\_gateways](#input\\_nat\\_gateways) | Pass the amount of public NAT gateways you would like to create. | `number` | `1` | no |\n | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_nat_gateways\"></a> [nat\\_gateways](#input\\_nat\\_gateways) | Pass the amount of public NAT gateways you would like to create. | `number` | `1` | no |\n | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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 | <a name=\"input_nat_eip_tags\"></a> [nat\\_eip\\_tags](#input\\_nat\\_eip\\_tags) | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | <a name=\"input_nat_gateway_destination_cidr_block\"></a> [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 | <a name=\"input_nat_gateway_tags\"></a> [nat\\_gateway\\_tags](#input\\_nat\\_gateway\\_tags) | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| <a name=\"input_nat_gateways\"></a> [nat\\_gateways](#input\\_nat\\_gateways) | Pass the amount of public NAT gateways you would like to create. | `number` | `1` | no |\n | <a name=\"input_one_nat_gateway_per_az\"></a> [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 | <a name=\"input_outpost_acl_tags\"></a> [outpost\\_acl\\_tags](#input\\_outpost\\_acl\\_tags) | Additional tags for the outpost subnets network ACL | `map(string)` | `{}` | no |\n | <a name=\"input_outpost_arn\"></a> [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"
}
] |
B
|
[
{
"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<!--- Describe your changes in detail -->\r\ndatabase/redshift/elasticache subnets can use private route tables.\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n- https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/944\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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<!--- Describe your changes in detail -->\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<!--- Why is this change required? What problem does it solve? -->\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<!--- If it fixes an open issue, please link to the issue here. -->\r\n- Resolves #1061 \r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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"
}
] |
A
|
[
{
"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<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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<!--- Describe your changes in detail -->\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<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\nfixes #1054 \r\n\r\n\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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"
}
] |
A
|
[
{
"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"
}
] |
A
|
[
{
"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<!--- Describe your changes in detail -->\r\nSupport for multiple route tables when creating public and intra subnets.\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\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<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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 | <a name=\"input_create_flow_log_cloudwatch_iam_role\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_log_group\"></a> [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 | <a name=\"input_create_igw\"></a> [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+| <a name=\"input_create_multiple_intra_route_tables\"></a> [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+| <a name=\"input_create_multiple_public_route_tables\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_iam_role\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_log_group\"></a> [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 | <a name=\"input_create_igw\"></a> [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+| <a name=\"input_create_multiple_intra_route_tables\"></a> [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+| <a name=\"input_create_multiple_public_route_tables\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_iam_role\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_log_group\"></a> [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 | <a name=\"input_create_igw\"></a> [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+| <a name=\"input_create_multiple_intra_route_tables\"></a> [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+| <a name=\"input_create_multiple_public_route_tables\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_iam_role\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_log_group\"></a> [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 | <a name=\"input_create_igw\"></a> [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+| <a name=\"input_create_multiple_intra_route_tables\"></a> [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+| <a name=\"input_create_multiple_public_route_tables\"></a> [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 | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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"
}
] |
C
|
[
{
"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<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -646,6 +646,7 @@ No modules.\n | <a name=\"output_outpost_subnets_cidr_blocks\"></a> [outpost\\_subnets\\_cidr\\_blocks](#output\\_outpost\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of outpost subnets |\n | <a name=\"output_outpost_subnets_ipv6_cidr_blocks\"></a> [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 | <a name=\"output_private_ipv6_egress_route_ids\"></a> [private\\_ipv6\\_egress\\_route\\_ids](#output\\_private\\_ipv6\\_egress\\_route\\_ids) | List of IDs of the ipv6 egress route |\n+| <a name=\"output_private_nat_gateway_ips\"></a> [private\\_nat\\_gateway\\_ips](#output\\_private\\_nat\\_gateway\\_ips) | List of private nat gateway ip's |\n | <a name=\"output_private_nat_gateway_route_ids\"></a> [private\\_nat\\_gateway\\_route\\_ids](#output\\_private\\_nat\\_gateway\\_route\\_ids) | List of IDs of the private nat gateway route |\n | <a name=\"output_private_network_acl_arn\"></a> [private\\_network\\_acl\\_arn](#output\\_private\\_network\\_acl\\_arn) | ARN of the private network ACL |\n | <a name=\"output_private_network_acl_id\"></a> [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 | <a name=\"output_outpost_subnets_cidr_blocks\"></a> [outpost\\_subnets\\_cidr\\_blocks](#output\\_outpost\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of outpost subnets |\n | <a name=\"output_outpost_subnets_ipv6_cidr_blocks\"></a> [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 | <a name=\"output_private_ipv6_egress_route_ids\"></a> [private\\_ipv6\\_egress\\_route\\_ids](#output\\_private\\_ipv6\\_egress\\_route\\_ids) | List of IDs of the ipv6 egress route |\n+| <a name=\"output_private_nat_gateway_ips\"></a> [private\\_nat\\_gateway\\_ips](#output\\_private\\_nat\\_gateway\\_ips) | List of private nat gateway ip's |\n | <a name=\"output_private_nat_gateway_route_ids\"></a> [private\\_nat\\_gateway\\_route\\_ids](#output\\_private\\_nat\\_gateway\\_route\\_ids) | List of IDs of the private nat gateway route |\n | <a name=\"output_private_network_acl_arn\"></a> [private\\_network\\_acl\\_arn](#output\\_private\\_network\\_acl\\_arn) | ARN of the private network ACL |\n | <a name=\"output_private_network_acl_id\"></a> 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 | <a name=\"output_outpost_subnets_cidr_blocks\"></a> [outpost\\_subnets\\_cidr\\_blocks](#output\\_outpost\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of outpost subnets |\n | <a name=\"output_outpost_subnets_ipv6_cidr_blocks\"></a> [outpost\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_outpost\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 of outpost subnets in an IPv6 enabled VPC |\n | <a name=\"output_private_ipv6_egress_route_ids\"></a> [private\\_ipv6\\_egress\\_route\\_ids](#output\\_private\\_ipv6\\_egress\\_route\\_ids) | List of IDs of the ipv6 egress route |\n+| <a name=\"output_private_nat_gateway_ips\"></a> [private\\_nat\\_gateway\\_ips](#output\\_private\\_nat\\_gateway\\_ips) | List of private nat gateway ip's |\n | <a name=\"output_private_nat_gateway_route_ids\"></a> [private\\_nat\\_gateway\\_route\\_ids](#output\\_private\\_nat\\_gateway\\_route\\_ids) | List of IDs of the private nat gateway route |\n | <a name=\"output_private_network_acl_arn\"></a> [private\\_network\\_acl\\_arn](#output\\_private\\_network\\_acl\\_arn) | ARN of the private network ACL |\n | <a name=\"output_private_network_acl_id\"></a> [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 | <a name=\"output_outpost_subnets_cidr_blocks\"></a> [outpost\\_subnets\\_cidr\\_blocks](#output\\_outpost\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of outpost subnets |\n | <a name=\"output_outpost_subnets_ipv6_cidr_blocks\"></a> [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 | <a name=\"output_private_ipv6_egress_route_ids\"></a> [private\\_ipv6\\_egress\\_route\\_ids](#output\\_private\\_ipv6\\_egress\\_route\\_ids) | List of IDs of the ipv6 egress route |\n+| <a name=\"output_private_nat_gateway_ips\"></a> [private\\_nat\\_gateway\\_ips](#output\\_private\\_nat\\_gateway\\_ips) | List of private nat gateway ip's |\n | <a name=\"output_private_nat_gateway_route_ids\"></a> [private\\_nat\\_gateway\\_route\\_ids](#output\\_private\\_nat\\_gateway\\_route\\_ids) | List of IDs of the private nat gateway route |\n | <a name=\"output_private_network_acl_arn\"></a> [private\\_network\\_acl\\_arn](#output\\_private\\_network\\_acl\\_arn) | ARN of the private network ACL |\n | <a name=\"output_private_network_acl_id\"></a> [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"
}
] |
A
|
[
{
"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<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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│ Error: deleting EC2 Customer Gateway (cgw-xxxxxxxxx): IncorrectState: The customer gateway is in use.\r\n│ 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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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╷\r\n│ Error: Unsupported attribute\r\n│\r\n│ on .terraform/modules/endpoints/modules/vpc-endpoints/main.tf line 42, in resource \"aws_vpc_endpoint\" \"this\":\r\n│ 42: private_dns_only_for_inbound_resolver_endpoint = dns_options.value.private_dns_only_for_inbound_resolver_endpoint\r\n│ ├────────────────\r\n│ │ dns_options.value is false\r\n│\r\n│ 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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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 | <a name=\"input_create_flow_log_cloudwatch_iam_role\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_log_group\"></a> [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 | <a name=\"input_create_igw\"></a> [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+| <a name=\"input_create_multiple_public_route_tables\"></a> [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Creating multiple public route tables | `bool` | `false` | no |\n | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_iam_role\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_log_group\"></a> [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 | <a name=\"input_create_igw\"></a> [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+| <a name=\"input_create_multiple_public_route_tables\"></a> [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Creating multiple public route tables | `bool` | `false` | no |\n | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_iam_role\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_log_group\"></a> [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 | <a name=\"input_create_igw\"></a> [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+| <a name=\"input_create_multiple_public_route_tables\"></a> [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Creating multiple public route tables | `bool` | `false` | no |\n | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_iam_role\"></a> [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 | <a name=\"input_create_flow_log_cloudwatch_log_group\"></a> [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 | <a name=\"input_create_igw\"></a> [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+| <a name=\"input_create_multiple_public_route_tables\"></a> [create\\_multiple\\_public\\_route\\_tables](#input\\_create\\_multiple\\_public\\_route\\_tables) | Creating multiple public route tables | `bool` | `false` | no |\n | <a name=\"input_create_redshift_subnet_group\"></a> [create\\_redshift\\_subnet\\_group](#input\\_create\\_redshift\\_subnet\\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no |\n | <a name=\"input_create_redshift_subnet_route_table\"></a> [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 | <a name=\"input_create_vpc\"></a> [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"
}
] |
B
|
[
{
"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…' 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"
}
] |
C
|
[
{
"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<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\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<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
B
|
[
{
"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"
}
] |
B
|
[
{
"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 | <a name=\"input_flow_log_cloudwatch_log_group_name_suffix\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_retention_in_days\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_skip_destroy\"></a> [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+| <a name=\"input_flow_log_deliver_cross_account_role\"></a> [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 | <a name=\"input_flow_log_destination_arn\"></a> [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-| <a name=\"input_flow_log_destination_type\"></a> [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+| <a name=\"input_flow_log_destination_type\"></a> [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 | <a name=\"input_flow_log_file_format\"></a> [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 | <a name=\"input_flow_log_hive_compatible_partitions\"></a> [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 | <a name=\"input_flow_log_log_format\"></a> [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 | <a name=\"output_vpc_enable_dns_hostnames\"></a> [vpc\\_enable\\_dns\\_hostnames](#output\\_vpc\\_enable\\_dns\\_hostnames) | Whether or not the VPC has DNS hostname support |\n | <a name=\"output_vpc_enable_dns_support\"></a> [vpc\\_enable\\_dns\\_support](#output\\_vpc\\_enable\\_dns\\_support) | Whether or not the VPC has DNS support |\n | <a name=\"output_vpc_flow_log_cloudwatch_iam_role_arn\"></a> [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+| <a name=\"output_vpc_flow_log_deliver_cross_account_role\"></a> argument | The ARN of the IAM role used when pushing logs cross account |\n | <a name=\"output_vpc_flow_log_destination_arn\"></a> [vpc\\_flow\\_log\\_destination\\_arn](#output\\_vpc\\_flow\\_log\\_destination\\_arn) | The ARN of the destination for VPC Flow Logs |\n | <a name=\"output_vpc_flow_log_destination_type\"></a> [vpc\\_flow\\_log\\_destination\\_type](#output\\_vpc\\_flow\\_log\\_destination\\_type) | The type of the destination for VPC Flow Logs |\n | <a name=\"output_vpc_flow_log_id\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_name_suffix\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_retention_in_days\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_skip_destroy\"></a> [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+| <a name=\"input_flow_log_deliver_cross_account_role\"></a> [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 | <a name=\"input_flow_log_destination_arn\"></a> [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-| <a name=\"input_flow_log_destination_type\"></a> [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+| <a name=\"input_flow_log_destination_type\"></a> [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 | <a name=\"input_flow_log_file_format\"></a> [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 | <a name=\"input_flow_log_hive_compatible_partitions\"></a> [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 | <a name=\"input_flow_log_log_format\"></a> [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 | <a name=\"output_vpc_enable_dns_hostnames\"></a> [vpc\\_enable\\_dns\\_hostnames](#output\\_vpc\\_enable\\_dns\\_hostnames) | Whether or not the VPC has DNS hostname support |\n | <a name=\"output_vpc_enable_dns_support\"></a> [vpc\\_enable\\_dns\\_support](#output\\_vpc\\_enable\\_dns\\_support) | Whether or not the VPC has DNS support |\n | <a name=\"output_vpc_flow_log_cloudwatch_iam_role_arn\"></a> [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+| <a name=\"output_vpc_flow_log_deliver_cross_account_role\"></a> [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 | <a name=\"output_vpc_flow_log_destination_arn\"></a> [vpc\\_flow\\_log\\_destination\\_arn](#output\\_vpc\\_flow\\_log\\_destination\\_arn) | The ARN of the destination for VPC Flow Logs |\n | <a name=\"output_vpc_flow_log_destination_type\"></a> [vpc\\_flow\\_log\\_destination\\_type](#output\\_vpc\\_flow\\_log\\_destination\\_type) | The type of the destination for VPC Flow Logs |\n | <a name=\"output_vpc_flow_log_id\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_name_suffix\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_retention_in_days\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_skip_destroy\"></a> [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+| <a name=\"input_flow_log_deliver_cross_account_role\"></a> [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 | <a name=\"input_flow_log_destination_arn\"></a> [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-| <a name=\"input_flow_log_destination_type\"></a> [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+| <a name=\"input_flow_log_destination_type\"></a> [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 | <a name=\"input_flow_log_file_format\"></a> [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 | <a name=\"input_flow_log_hive_compatible_partitions\"></a> [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 | <a name=\"input_flow_log_log_format\"></a> [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 | <a name=\"output_vpc_enable_dns_hostnames\"></a> [vpc\\_enable\\_dns\\_hostnames](#output\\_vpc\\_enable\\_dns\\_hostnames) | Whether or not the VPC has DNS hostname support |\n | <a name=\"output_vpc_enable_dns_support\"></a> [vpc\\_enable\\_dns\\_support](#output\\_vpc\\_enable\\_dns\\_support) | Whether or not the VPC has DNS support |\n | <a name=\"output_vpc_flow_log_cloudwatch_iam_role_arn\"></a> [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+| <a name=\"output_vpc_flow_log_deliver_cross_account_role\"></a> [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 | <a name=\"output_vpc_flow_log_destination_arn\"></a> [vpc\\_flow\\_log\\_destination\\_arn](#output\\_vpc\\_flow\\_log\\_destination\\_arn) | The ARN of the destination for VPC Flow Logs |\n | <a name=\"output_vpc_flow_log_destination_type\"></a> [vpc\\_flow\\_log\\_destination\\_type](#output\\_vpc\\_flow\\_log\\_destination\\_type) | The type of the destination for VPC Flow Logs |\n | <a name=\"output_vpc_flow_log_id\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_name_suffix\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_retention_in_days\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_skip_destroy\"></a> [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+| <a name=\"input_flow_log_deliver_cross_account_role\"></a> [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 | <a name=\"input_flow_log_destination_arn\"></a> [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-| <a name=\"input_flow_log_destination_type\"></a> [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+| <a name=\"input_flow_log_destination_type\"></a> [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 | <a name=\"input_flow_log_file_format\"></a> [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 | <a name=\"input_flow_log_hive_compatible_partitions\"></a> [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 | <a name=\"input_flow_log_log_format\"></a> [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 | <a name=\"output_vpc_enable_dns_hostnames\"></a> [vpc\\_enable\\_dns\\_hostnames](#output\\_vpc\\_enable\\_dns\\_hostnames) | Whether or not the VPC has DNS hostname support |\n | <a name=\"output_vpc_enable_dns_support\"></a> [vpc\\_enable\\_dns\\_support](#output\\_vpc\\_enable\\_dns\\_support) | Whether or not the VPC has DNS support |\n | <a name=\"output_vpc_flow_log_cloudwatch_iam_role_arn\"></a> [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+| <a name=\"output_vpc_flow_log_deliver_cross_account_role\"></a> [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 | <a name=\"output_vpc_flow_log_destination_arn\"></a> [vpc\\_flow\\_log\\_destination\\_arn](#output\\_vpc\\_flow\\_log\\_destination\\_arn) | The ARN of the destination for VPC Flow Logs |\n | <a name=\"output_vpc_flow_log_destination_type\"></a> [vpc\\_flow\\_log\\_destination\\_type](#output\\_vpc\\_flow\\_log\\_destination\\_type) | The type of the destination for VPC Flow Logs |\n | <a name=\"output_vpc_flow_log_id\"></a> [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"
}
] |
C
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -449,6 +449,7 @@ No modules.\n | <a name=\"input_flow_log_cloudwatch_log_group_name_prefix\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_name_suffix\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_retention_in_days\"></a> [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+| <a name=\"input_flow_log_cloudwatch_log_group_skip_destroy\"></a> [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 | <a name=\"input_flow_log_destination_arn\"></a> [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 | <a name=\"input_flow_log_destination_type\"></a> [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 | <a name=\"input_flow_log_file_format\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_name_prefix\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_name_suffix\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_retention_in_days\"></a> [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+| <a name=\"input_flow_log_cloudwatch_log_group_skip_destroy\"></a> [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 | <a name=\"input_flow_log_destination_arn\"></a> [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 | <a name=\"input_flow_log_destination_type\"></a> [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 | <a name=\"input_flow_log_file_format\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_name_prefix\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_name_suffix\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_retention_in_days\"></a> [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+| <a name=\"input_flow_log_cloudwatch_log_group_skip_destroy\"></a> [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 | <a name=\"input_flow_log_destination_arn\"></a> [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 | <a name=\"input_flow_log_destination_type\"></a> [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 | <a name=\"input_flow_log_file_format\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_name_prefix\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_name_suffix\"></a> [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 | <a name=\"input_flow_log_cloudwatch_log_group_retention_in_days\"></a> [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+| <a name=\"input_flow_log_cloudwatch_log_group_skip_destroy\"></a> [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 | <a name=\"input_flow_log_destination_arn\"></a> [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 | <a name=\"input_flow_log_destination_type\"></a> [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 | <a name=\"input_flow_log_file_format\"></a> [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"
}
] |
C
|
[
{
"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 | <a name=\"output_nat_ids\"></a> [nat\\_ids](#output\\_nat\\_ids) | List of allocation ID of Elastic IPs created for AWS NAT Gateway |\n | <a name=\"output_nat_public_ips\"></a> [nat\\_public\\_ips](#output\\_nat\\_public\\_ips) | List of public Elastic IPs created for AWS NAT Gateway |\n | <a name=\"output_natgw_ids\"></a> [natgw\\_ids](#output\\_natgw\\_ids) | List of NAT Gateway IDs |\n+| <a name=\"output_natgw_interface_ids\"></a> [natgw\\_interface\\_ids](#output\\_natgw\\_interface\\_ids) | List of Network Interface IDs assigned to NAT Gateways |\n | <a name=\"output_outpost_network_acl_arn\"></a> [outpost\\_network\\_acl\\_arn](#output\\_outpost\\_network\\_acl\\_arn) | ARN of the outpost network ACL |\n | <a name=\"output_outpost_network_acl_id\"></a> [outpost\\_network\\_acl\\_id](#output\\_outpost\\_network\\_acl\\_id) | ID of the outpost network ACL |\n | <a name=\"output_outpost_subnet_arns\"></a> [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 | <a name=\"output_nat_ids\"></a> [nat\\_ids](#output\\_nat\\_ids) | List of allocation ID of Elastic IPs created for AWS NAT Gateway |\n | <a name=\"output_nat_public_ips\"></a> [nat\\_public\\_ips](#output\\_nat\\_public\\_ips) | List of public Elastic IPs created for AWS NAT Gateway |\n | <a name=\"output_natgw_ids\"></a> [natgw\\_ids](#output\\_natgw\\_ids) | List of NAT Gateway IDs |\n+| <a name=\"output_natgw_interface_ids\"></a> [natgw\\_interface\\_ids](#output\\_natgw\\_interface\\_ids) | List of Network Interface IDs assigned to NAT Gateways |\n | <a name=\"output_outpost_network_acl_arn\"></a> [outpost\\_network\\_acl\\_arn](#output\\_outpost\\_network\\_acl\\_arn) | ARN of the outpost to ACL |\n | <a name=\"output_outpost_network_acl_id\"></a> [outpost\\_network\\_acl\\_id](#output\\_outpost\\_network\\_acl\\_id) | ID of the outpost network ACL |\n | <a name=\"output_outpost_subnet_arns\"></a> [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 | <a name=\"output_nat_ids\"></a> [nat\\_ids](#output\\_nat\\_ids) | List of allocation ID of Elastic IPs created for AWS NAT Gateway |\n | <a name=\"output_nat_public_ips\"></a> [nat\\_public\\_ips](#output\\_nat\\_public\\_ips) | List of public Elastic IPs created for AWS NAT Gateway |\n | <a name=\"output_natgw_ids\"></a> [natgw\\_ids](#output\\_natgw\\_ids) | List of NAT Gateway IDs |\n+| <a name=\"output_natgw_interface_ids\"></a> [natgw\\_interface\\_ids](#output\\_natgw\\_interface\\_ids) | List of Network Interface IDs assigned to NAT Gateways |\n | <a name=\"output_outpost_network_acl_arn\"></a> [outpost\\_network\\_acl\\_arn](#output\\_outpost\\_network\\_acl\\_arn) | ARN of the outpost network ACL |\n | <a name=\"output_outpost_network_acl_id\"></a> [outpost\\_network\\_acl\\_id](#output\\_outpost\\_network\\_acl\\_id) | ID of the outpost network ACL |\n | <a name=\"output_outpost_subnet_arns\"></a> [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 | <a name=\"output_nat_ids\"></a> [nat\\_ids](#output\\_nat\\_ids) | List of allocation ID of Elastic IPs created for AWS NAT Gateway |\n | <a name=\"output_nat_public_ips\"></a> [nat\\_public\\_ips](#output\\_nat\\_public\\_ips) | List of public Elastic IPs created for AWS NAT Gateway |\n | <a name=\"output_natgw_ids\"></a> [natgw\\_ids](#output\\_natgw\\_ids) | List of NAT Gateway IDs |\n+| <a name=\"output_natgw_interface_ids\"></a> [natgw\\_interface\\_ids](#output\\_natgw\\_interface\\_ids) | List of Network Interface IDs assigned to NAT Gateways |\n | <a name=\"output_outpost_network_acl_arn\"></a> [outpost\\_network\\_acl\\_arn](#output\\_outpost\\_network\\_acl\\_arn) | ARN of the outpost network ACL |\n | <a name=\"output_outpost_network_acl_id\"></a> [outpost\\_network\\_acl\\_id](#output\\_outpost\\_network\\_acl\\_id) | ID of the outpost network ACL |\n | <a name=\"output_outpost_subnet_arns\"></a> [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"
}
] |
D
|
[
{
"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<!--- Describe your changes in detail -->\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<!--- Why is this change required? What problem does it solve? -->\r\nThis will add a more clear docs on how to create a gateway endpoint\r\n\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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<!--- Users should start with an existing example as it's written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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\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"
}
] |
C
|
[
{
"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"
}
] |
C
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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"
}
] |
A
|
[
{
"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│ \r\n│ 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│ set of keys that will identify the instances of this resource.\r\n│ \r\n│ 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│ in the map values.\r\n│ \r\n│ 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│ 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"
}
] |
A
|
[
{
"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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -392,6 +392,7 @@ No modules.\n | <a name=\"input_database_subnet_private_dns_hostname_type_on_launch\"></a> [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 | <a name=\"input_database_subnet_suffix\"></a> [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n | <a name=\"input_database_subnet_tags\"></a> [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| <a name=\"input_database_subnet_tags_per_az\"></a> [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 | <a name=\"input_database_subnets\"></a> [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_default_network_acl_egress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_default_network_acl_ingress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | 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 | <a name=\"input_database_subnet_private_dns_hostname_type_on_launch\"></a> [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 | <a name=\"input_database_subnet_suffix\"></a> [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` default no |\n | <a name=\"input_database_subnet_tags\"></a> [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| <a name=\"input_database_subnet_tags_per_az\"></a> [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 | <a name=\"input_database_subnets\"></a> [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_default_network_acl_egress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_default_network_acl_ingress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | 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 | <a name=\"input_database_subnet_private_dns_hostname_type_on_launch\"></a> [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 | <a name=\"input_database_subnet_suffix\"></a> [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n | <a name=\"input_database_subnet_tags\"></a> [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| <a name=\"input_database_subnet_tags_per_az\"></a> [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 | <a name=\"input_database_subnets\"></a> [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_default_network_acl_egress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_default_network_acl_ingress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | 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 | <a name=\"input_database_subnet_private_dns_hostname_type_on_launch\"></a> [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 | <a name=\"input_database_subnet_suffix\"></a> [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n | <a name=\"input_database_subnet_tags\"></a> [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| <a name=\"input_database_subnet_tags_per_az\"></a> [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 | <a name=\"input_database_subnets\"></a> [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_default_network_acl_egress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_default_network_acl_ingress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | 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"
}
] |
C
|
[
{
"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"
}
] |
C
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
A
|
[
{
"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<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as it's written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\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\r\n- [ x ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as it's written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\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\r\n- [ x ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as it's written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\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\r\n- [ x ] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
C
|
[
{
"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"
}
] |
B
|
[
{
"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"
}
] |
B
|
[
{
"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 <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->\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 <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->\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 <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->\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 <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->\n ## Requirements\n---\n\n\n---\n"
}
] |
B
|
[
{
"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"
}
] |
C
|
[
{
"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"
}
] |
A
|
[
{
"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<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\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<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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│ Error: Invalid for_each argument\r\n│ \r\n│ on main.tf line 110, in resource \"aws_route\" \"tgw\":\r\n│ 110: for_each = local.subnet_route_tables\r\n│ ├────────────────\r\n│ │ local.subnet_route_tables will be known only after apply\r\n│ \r\n│ 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│ \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"
}
] |
C
|
[
{
"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<!--- Describe your changes in detail -->\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<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\nFixes #923 \r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
B
|
[
{
"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\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"
}
] |
B
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -390,6 +390,7 @@ No modules.\n | <a name=\"input_database_subnet_private_dns_hostname_type_on_launch\"></a> [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 | <a name=\"input_database_subnet_suffix\"></a> [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n | <a name=\"input_database_subnet_tags\"></a> [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| <a name=\"input_database_subnet_tags_per_az\"></a> [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 | <a name=\"input_database_subnets\"></a> [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_default_network_acl_egress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_default_network_acl_ingress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | 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 | <a name=\"input_database_subnet_private_dns_hostname_type_on_launch\"></a> [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 | <a name=\"input_database_subnet_suffix\"></a> [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n | <a name=\"input_database_subnet_tags\"></a> [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| <a name=\"input_database_subnet_tags_per_az\"></a> [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 | <a name=\"input_database_subnets\"></a> [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_default_network_acl_egress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_default_network_acl_ingress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | 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 | <a name=\"input_database_subnet_private_dns_hostname_type_on_launch\"></a> [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 | <a name=\"input_database_subnet_suffix\"></a> [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n | <a name=\"input_database_subnet_tags\"></a> [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| <a name=\"input_database_subnet_tags_per_az\"></a> [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 | <a name=\"input_database_subnets\"></a> [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_default_network_acl_egress\"></a> [default\\_network\\_acl\\_egress](#input\\_default\\_network\\_acl\\_egress) | List of maps of egress rules set on the Default Network ACL | `list(map(string))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_default_network_acl_ingress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | 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 | <a name=\"input_database_subnet_private_dns_hostname_type_on_launch\"></a> [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 | <a name=\"input_database_subnet_suffix\"></a> [database\\_subnet\\_suffix](#input\\_database\\_subnet\\_suffix) | Suffix to append to database subnets name | `string` | `\"db\"` | no |\n | <a name=\"input_database_subnet_tags\"></a> [database\\_subnet\\_tags](#input\\_database\\_subnet\\_tags) | Additional tags for the database subnets | `map(string)` | `{}` | no |\n+| <a name=\"input_database_subnet_tags_per_az\"></a> [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 | <a name=\"input_database_subnets\"></a> [database\\_subnets](#input\\_database\\_subnets) | A list of database subnets inside the VPC | `list(string)` | `[]` | no |\n | <a name=\"input_default_network_acl_egress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | no |\n | <a name=\"input_default_network_acl_ingress\"></a> [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))` | <pre>[<br> {<br> \"action\": \"allow\",<br> \"cidr_block\": \"0.0.0.0/0\",<br> \"from_port\": 0,<br> \"protocol\": \"-1\",<br> \"rule_no\": 100,<br> \"to_port\": 0<br> },<br> {<br> \"action\": \"allow\",<br> \"from_port\": 0,<br> \"ipv6_cidr_block\": \"::/0\",<br> \"protocol\": \"-1\",<br> \"rule_no\": 101,<br> \"to_port\": 0<br> }<br>]</pre> | 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"
}
] |
B
|
[
{
"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<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\nFound a typo and think of fixing it.\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\n\r\n## Breaking Changes\r\nNo\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\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<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\r\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\r\n<!--- Please describe how you tested your changes -->\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\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"
}
] |
B
|
[
{
"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 | <a name=\"input_amazon_side_asn\"></a> [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 | <a name=\"input_azs\"></a> [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n-| <a name=\"input_cidr\"></a> [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+| <a name=\"input_cidr\"></a> [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 | <a name=\"input_create_database_internet_gateway_route\"></a> [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 | <a name=\"input_create_database_nat_gateway_route\"></a> [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 | <a name=\"input_create_database_subnet_group\"></a> [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 | <a name=\"input_ipv4_netmask_length\"></a> [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 | <a name=\"input_ipv6_cidr\"></a> [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 | <a name=\"input_ipv6_cidr_block_network_border_group\"></a> [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-| <a name=\"input_ipv6_ipam_pool_id\"></a> [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-| <a name=\"input_ipv6_netmask_length\"></a> [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+| <a name=\"input_ipv6_ipam_pool_id\"></a> [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+| <a name=\"input_ipv6_netmask_length\"></a> [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 | <a name=\"input_manage_default_network_acl\"></a> [manage\\_default\\_network\\_acl](#input\\_manage\\_default\\_network\\_acl) | Should be true to adopt and manage Default Network ACL | `bool` | `true` | no |\n | <a name=\"input_manage_default_route_table\"></a> [manage\\_default\\_route\\_table](#input\\_manage\\_default\\_route\\_table) | Should be true to manage default route table | `bool` | `true` | no |\n | <a name=\"input_manage_default_security_group\"></a> [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 | <a name=\"input_amazon_side_asn\"></a> [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 | <a name=\"input_azs\"></a> [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n-| <a name=\"input_cidr\"></a> [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+| <a name=\"input_cidr\"></a> [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 | <a name=\"input_create_database_internet_gateway_route\"></a> [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 | <a name=\"input_create_database_nat_gateway_route\"></a> [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 | <a name=\"input_create_database_subnet_group\"></a> [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 | <a name=\"input_ipv4_netmask_length\"></a> [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 | <a name=\"input_ipv6_cidr\"></a> [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 | <a name=\"input_ipv6_cidr_block_network_border_group\"></a> [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-| <a name=\"input_ipv6_ipam_pool_id\"></a> [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-| <a name=\"input_ipv6_netmask_length\"></a> [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+| <a name=\"input_ipv6_ipam_pool_id\"></a> [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+| <a name=\"input_ipv6_netmask_length\"></a> [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 | <a name=\"input_manage_default_network_acl\"></a> [manage\\_default\\_network\\_acl](#input\\_manage\\_default\\_network\\_acl) | Should be true to adopt and manage Default Network ACL | `bool` | `true` | no |\n | <a name=\"input_manage_default_route_table\"></a> [manage\\_default\\_route\\_table](#input\\_manage\\_default\\_route\\_table) | Should be true to manage default route table | `bool` | `true` | no |\n | <a name=\"input_manage_default_security_group\"></a> [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 | <a name=\"input_amazon_side_asn\"></a> [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 | <a name=\"input_azs\"></a> [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n-| <a name=\"input_cidr\"></a> [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+| <a name=\"input_cidr\"></a> [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 | <a name=\"input_create_database_internet_gateway_route\"></a> [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 | <a name=\"input_create_database_nat_gateway_route\"></a> [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 | <a name=\"input_create_database_subnet_group\"></a> [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 | <a name=\"input_ipv4_netmask_length\"></a> [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 | <a name=\"input_ipv6_cidr\"></a> [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 | <a name=\"input_ipv6_cidr_block_network_border_group\"></a> [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-| <a name=\"input_ipv6_ipam_pool_id\"></a> [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-| <a name=\"input_ipv6_netmask_length\"></a> [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+| <a name=\"input_ipv6_ipam_pool_id\"></a> [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+| <a name=\"input_ipv6_netmask_length\"></a> [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 | <a name=\"input_manage_default_network_acl\"></a> [manage\\_default\\_network\\_acl](#input\\_manage\\_default\\_network\\_acl) | Should be true to adopt and manage Default Network ACL | `bool` | `true` | no |\n | <a name=\"input_manage_default_route_table\"></a> [manage\\_default\\_route\\_table](#input\\_manage\\_default\\_route\\_table) | Should be true to manage default route table | `bool` | `true` | no |\n | <a name=\"input_manage_default_security_group\"></a> [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 | <a name=\"input_amazon_side_asn\"></a> [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 | <a name=\"input_azs\"></a> [azs](#input\\_azs) | A list of availability zones names or ids in the region | `list(string)` | `[]` | no |\n-| <a name=\"input_cidr\"></a> [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+| <a name=\"input_cidr\"></a> [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 | <a name=\"input_create_database_internet_gateway_route\"></a> [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 | <a name=\"input_create_database_nat_gateway_route\"></a> [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 | <a name=\"input_create_database_subnet_group\"></a> [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 | <a name=\"input_ipv4_netmask_length\"></a> [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 | <a name=\"input_ipv6_cidr\"></a> [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 | <a name=\"input_ipv6_cidr_block_network_border_group\"></a> [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-| <a name=\"input_ipv6_ipam_pool_id\"></a> [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-| <a name=\"input_ipv6_netmask_length\"></a> [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+| <a name=\"input_ipv6_ipam_pool_id\"></a> [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+| <a name=\"input_ipv6_netmask_length\"></a> [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 | <a name=\"input_manage_default_network_acl\"></a> [manage\\_default\\_network\\_acl](#input\\_manage\\_default\\_network\\_acl) | Should be true to adopt and manage Default Network ACL | `bool` | `true` | no |\n | <a name=\"input_manage_default_route_table\"></a> [manage\\_default\\_route\\_table](#input\\_manage\\_default\\_route\\_table) | Should be true to manage default route table | `bool` | `true` | no |\n | <a name=\"input_manage_default_security_group\"></a> [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"
}
] |
C
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.