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\n*cidr_block* parameter is set to `null` when *use_ipam_pool* varaiable is set to true. Thus, only *ipv4_netmask_length* is available when you want to use IPAM. However, it is possible to chose the CIDR rather than the netmask length as the [example](https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/master/examples/ipam-vpc/main.tf) shows at line 44. \r\n\r\n## Motivation and Context\r\nWant to be able to use IPAM with CIDR selection, not only with netmask length selection.\r\n\r\n## Breaking Changes\r\nNo breaking changes.\r\n\r\n## How Has This Been Tested?\r\n- [x] Test with *cidr* provisioned as [example](https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/master/examples/ipam-vpc/main.tf) shows at line 44\r\n- [x] Test with *ipv4_netmask_length* provisioned as [example](https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/master/examples/ipam-vpc/main.tf) shows at line 24\r\n- [x] Test with *use_ipam_pool* set to *false*\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -20,7 +20,7 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool ? null : var.cidr\n+ cidr_block = var.use_ipam_pool && var.ipv4_netmask_length != null ? null : ? ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -20,7 +20,7 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool && null : var.cidr\n+ cidr_block = var.use_ipam_pool && var.ipv4_netmask_length != null ? null : var.cidr\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -20,7 +20,7 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool ? null : var.cidr\n+ cidr_block = var.use_ipam_pool && var.ipv4_netmask_length != null ? null : var.cidr\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -20,7 +20,7 @@ locals {\n resource \"aws_vpc\" \"this\" {\n count = local.create_vpc ? 1 : 0\n \n- cidr_block = var.use_ipam_pool ? null : var.cidr\n+ cidr_block = var.use_ipam_pool && var.ipv4_netmask_length != null ? : var.cidr\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n---\n\n\n---\n" } ]
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 a typo in the condition inside the complete vpc example.\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -208,7 +208,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n }\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -208,7 +208,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n data test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n }\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -208,7 +208,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n }\n---\n\n\n---\n\nChoice D:\n -208,7 +208,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:sourceVpc\"\n \n values = [module.vpc.vpc_id]\n }\n---\n\n\n---\n" } ]
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:\nEnable TLS inbound for Session Manager\r\n\r\n## Description\r\nI use Session Manager quite extensively as it avoids the need for managing SSH Key pairs. The complete example had all of the endpoints but was missing the security group definitions for a couple, so I added them here.\r\n\r\n## Motivation and Context\r\nEnable testers to spin up EC2 instances without the need for SSH Key Pairs\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\nI've validated that this works in 2 separate AWS accounts.\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -114,6 +114,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -141,6 +142,7 @@ module \"vpc_endpoints\" {\n service = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = {\n lambda service = \"ecr.api\"\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -114,6 +114,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -141,6 @@ module \"vpc_endpoints\" {\n service = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = {\n service = \"ecr.api\"\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -114,6 +114,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -141,6 +142,7 @@ module \"vpc_endpoints\" {\n service = = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = {\n service = \"ecr.api\"\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -114,6 +114,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -141,6 +142,7 @@ module \"vpc_endpoints\" {\n service = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = {\n service = \"ecr.api\"\n---\n\n\n---\n" } ]
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\nBefore IPAM, users were still able to BYOIPv6. This change allows these users to use this module.\r\n\r\n## Motivation and Context\r\n\r\nWe used AWS BYOIPv6 before the AWS IPAM feature so we have to pass `ipv6_ipam_pool_id` AND pass `null` to `assign_generated_ipv6_cidr_block`. Currently the code for `assign_generated_ipv6_cidr_block` is:\r\n\r\n```\r\n assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\r\n```\r\n\r\nso there is no way for us to pass `assign_generated_ipv6_cidr_block = null` without setting `use_ipam_pool` which has it's own implications since:\r\n\r\n```\r\n cidr_block = var.use_ipam_pool ? null : var.cidr\r\n```\r\n\r\n## Breaking Changes\r\n\r\nNo, I double checked that this shouldn't break anything or change existing behavior.\r\n\r\n## How Has This Been Tested?\r\n\r\n### I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n\r\nI haven't done this because the developer (or CI/CD) needs to have BYOIPv6 setup.\r\n\r\n### I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\nI haven't done this because the developer (or CI/CD) needs to have BYOIPv6 setup.\r\n\r\nInstead, I have done some manual testing...\r\n\r\n#### Existing code\r\n\r\n```\r\nassign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\r\n```\r\n\r\n#### Tests\r\n\r\n##### Existing functionality\r\n\r\nThe input, `assign_generated_ipv6_cidr_block`, is only true when `enable_ipv6` is `true` and `use_ipam_pool` is `false`; otherwise it's `null`. This is expected since we only want AWS to generate an IPv6 CIDR when IPv6 is enabled and we aren't using an IPAM pool.\r\n\r\n##### `enable_ipv6 = true` && `use_ipam_pool = true`\r\n\r\n```CONSOLE\r\n> true && !true ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### `enable_ipv6 = true` && `use_ipam_pool = false`\r\n\r\n```CONSOLE\r\n> true && !false ? true : null\r\ntrue\r\n```\r\n\r\n##### `enable_ipv6 = false` && `use_ipam_pool = true`\r\n\r\n```CONSOLE\r\n> false && !true ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### `enable_ipv6 = false` && `use_ipam_pool = false`\r\n\r\n```CONSOLE\r\n> false && !false ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### Ensure we don't break existing functionality\r\n\r\nFunctionality is the same. If the user doesn't pass `assign_generated_ipv6_cidr_block`, then the only time we ask AWS to generate an IPv6 CIDR is when IPv6 is enabled and we aren't using an IPAM pool.\r\n\r\n##### `enable_ipv6 = true` && `use_ipam_pool = true` && `assign_generated_ipv6_cidr_block = null`\r\n\r\n```CONSOLE\r\n> true && coalesce(null, true) && !true ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### `enable_ipv6 = true` && `use_ipam_pool = false` && `assign_generated_ipv6_cidr_block = null`\r\n\r\n```CONSOLE\r\n> true && coalesce(null, true) && !false ? true : null\r\ntrue\r\n```\r\n\r\n##### `enable_ipv6 = false` && `use_ipam_pool = true` && `assign_generated_ipv6_cidr_block = null`\r\n\r\n```CONSOLE\r\n> false && coalesce(null, true) && !true ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### `enable_ipv6 = false` && `use_ipam_pool = false` && `assign_generated_ipv6_cidr_block = null`\r\n\r\n```CONSOLE\r\n> false && coalesce(null, true) && !false ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### Ensure that if `assign_generated_ipv6_cidr_block = false`, we never ask AWS to generate an IPv6 CIDR block\r\n\r\nIf `assign_generated_ipv6_cidr_block = false`, we never ask AWS to generate an IPv6 CIDR block.\r\n\r\n##### `enable_ipv6 = true` && `use_ipam_pool = true` && `assign_generated_ipv6_cidr_block = false`\r\n\r\n```CONSOLE\r\n> true && coalesce(false, true) && !true ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### `enable_ipv6 = true` && `use_ipam_pool = false` && `assign_generated_ipv6_cidr_block = false`\r\n\r\n```CONSOLE\r\n> true && coalesce(false, true) && !false ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### `enable_ipv6 = false` && `use_ipam_pool = true` && `assign_generated_ipv6_cidr_block = false`\r\n\r\n```CONSOLE\r\n> false && coalesce(false, true) && !true ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### `enable_ipv6 = false` && `use_ipam_pool = false` && `assign_generated_ipv6_cidr_block = false`\r\n\r\n```CONSOLE\r\n> false && coalesce(false, true) && !false ? true : null\r\ntobool(null)\r\n```\r\n\r\n##### Ensure that if `assign_generated_ipv6_cidr_block = true`, things are handled as they are today\r\n\r\nWe can be certain that since things were the same when `assign_generated_ipv6_cidr_block` was `null` (and the default value was `true`, that when `assign_generated_ipv6_cidr_block = true`, things are handled as they are today; we would only ask AWS to generate an IPv6 CIDR if IPv6 is enabled, and we aren't using an IPAM pool.\r\n\r\n#### What about when `ipv6_ipam_pool_id` is not `null`?\r\n\r\nThe only time there is a conflict is when `ipv6_ipam_pool_id` is not `null` (and `assign_generated_ipv6_cidr_block` evaluates to `true`).\r\n\r\nIf a user passes `ipv6_ipam_pool_id`, and leaves `assign_generated_ipv6_cidr_block` as `null`, then the only time `assign_generated_ipv6_cidr_block` is not `null` is when `enable_ipv6` is `true` and `use_ipam_pool` is `false`. In this case, it works the same as today and the user should set `use_ipam_pool` to `true` since they are passing a value for `assign_generated_ipv6_cidr_block`.\r\n\r\nIf a user passes `ipv6_ipam_pool_id`, and sets `assign_generated_ipv6_cidr_block` to `true`, then the only time `assign_generated_ipv6_cidr_block` is not `null` is when `enable_ipv6` is `true` and `use_ipam_pool` is `false`. In this case, the user messed up 2x, they should NOT have set `assign_generated_ipv6_cidr_block` to `true` AND they SHOULD have set `use_ipam_pool` to `true`; fixing either mistake will resolve the conflict.\r\n\r\n## I have executed `pre-commit run -a` on my pull request\r\n\r\n```\r\nnicholas7DYYW:terraform-aws-vpc hnicholas$ git status\r\nOn branch support-legacy-ipam\r\nYour branch is up to date with 'origin/support-legacy-ipam'.\r\n\r\nnothing to commit, working tree clean\r\n```\r\n\r\n```\r\nhnicholas7DYYW:terraform-aws-vpc hnicholas$ pre-commit run -a\r\nTerraform fmt............................................................Passed\r\nTerraform validate.......................................................Passed\r\nTerraform docs...........................................................Passed\r\nTerraform validate with tflint...........................................Passed\r\ncheck for merge conflicts................................................Passed\r\nfix end of files.........................................................Passed\r\n```\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -353,6 +353,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | <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_assign_generated_ipv6_cidr_block\"></a> [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `null` | no |\n | <a name=\"input_assign_ipv6_address_on_creation\"></a> [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | <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` | `\"0.0.0.0/0\"` | no |\n---\nmain.tf\n@@ -11,6 +11,8 @@ locals {\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ assign_generated_ipv6_cidr_block = coalesce(var.assign_generated_ipv6_cidr_block, true)\n }\n \n ################################################################################\n@@ -24,7 +26,7 @@ resource \"aws_vpc\" \"this\" {\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 | !var.use_ipam_pool && local.assign_generated_ipv6_cidr_block ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -22,6 +22,12 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -353,6 +353,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | <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_assign_generated_ipv6_cidr_block\"></a> [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `null` | no |\n | <a name=\"input_assign_ipv6_address_on_creation\"></a> [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | <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` | `\"0.0.0.0/0\"` | no |\n---\nmain.tf\n@@ -11,6 +11,8 @@ locals {\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ assign_generated_ipv6_cidr_block = coalesce(var.assign_generated_ipv6_cidr_block, true)\n }\n \n ################################################################################\n@@ -24,7 +26,7 @@ resource \"aws_vpc\" \"this\" {\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = an && !var.use_ipam_pool && local.assign_generated_ipv6_cidr_block ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -22,6 +22,12 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -353,6 +353,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | <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_assign_generated_ipv6_cidr_block\"></a> [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `null` | no |\n | <a name=\"input_assign_ipv6_address_on_creation\"></a> [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | <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` | `\"0.0.0.0/0\"` | no |\n---\nmain.tf\n@@ -11,6 +11,8 @@ locals {\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ assign_generated_ipv6_cidr_block = coalesce(var.assign_generated_ipv6_cidr_block, true)\n }\n \n ################################################################################\n@@ -24,7 +26,7 @@ resource \"aws_vpc\" \"this\" {\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool && local.assign_generated_ipv6_cidr_block ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -22,6 +22,12 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -353,6 +353,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | <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_assign_generated_ipv6_cidr_block\"></a> [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `null` | no |\n | <a name=\"input_assign_ipv6_address_on_creation\"></a> [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | <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` | `\"0.0.0.0/0\"` | no |\n---\nmain.tf\n@@ -11,6 +11,8 @@ locals {\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ assign_generated_ipv6_cidr_block = coalesce(var.assign_generated_ipv6_cidr_block, true)\n }\n \n ################################################################################\n@@ -24,7 +26,7 @@ resource \"aws_vpc\" \"this\" {\n ipv4_ipam_pool_id = var.ipv4_ipam_pool_id\n ipv4_netmask_length = var.ipv4_netmask_length\n \n- assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool ? true : null\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && !var.use_ipam_pool && local.assign_generated_ipv6_cidr_block ? true : null\n ipv6_cidr_block = var.ipv6_cidr\n ipv6_ipam_pool_id Number = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n---\nvariables.tf\n@@ -22,6 +22,12 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n" } ]
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\nThis PR separates creation of the internet gateway (IGW) from attachment to the VPC.\r\n\r\nBy doing this, an implicit dependency is avoided, allowing `terraform destroy` on a VPC+IGW created by this module.\r\n\r\n## Motivation and Context\r\n<!--- 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: #883 \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\nThe new resource `aws_internet_gateway_attachment` requires version 4.3.0 of the Terraform provider for AWS.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- 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@@ -127,15 +127,19 @@ resource \"aws_vpc_dhcp_options_association\" \"this\" {\n resource \"aws_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_igw && length(var.public_subnets) > 0 ? 1 : 0\n \n- vpc_id = local.vpc_id\n-\n tags = merge(\n { \"Name\" = var.name },\n var.tags,\n var.igw_tags,\n )\n }\n \n+resource \"aws_internet_gateway_attachment\" \"this\" {\n+ count = local.create_vpc && var.create_igw && length(var.public_subnets) > 0 ? 1 : 0\n+ internet_gateway_id = aws_internet_gateway.this[0].id\n+ vpc_id = local.vpc_id\n+}\n+\n resource \"aws_egress_only_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 && local.max_subnet_length > 0 ? 1 : 0\n \n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.73\"\n+ version = \">= 4.3.0\"\n }\n }\n }\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -127,15 +127,19 @@ resource \"aws_vpc_dhcp_options_association\" \"this\" {\n resource \"aws_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_igw && length(var.public_subnets) > 0 ? 1 : 0\n \n- vpc_id = local.vpc_id\n-\n tags = merge(\n { \"Name\" = var.name },\n var.tags,\n var.igw_tags,\n )\n }\n \n+resource \"aws_internet_gateway_attachment\" \"this\" {\n+ count = local.create_vpc && var.create_igw && length(var.public_subnets) aws_internet_gateway.this[0].id\n+ 0 ? 1 : 0\n+ internet_gateway_id = aws_internet_gateway.this[0].id\n+ vpc_id = local.vpc_id\n+}\n+\n resource \"aws_egress_only_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 && local.max_subnet_length > 0 ? 1 : 0\n \n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.73\"\n+ version = \">= 4.3.0\"\n }\n }\n }\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -127,15 +127,19 @@ resource \"aws_vpc_dhcp_options_association\" \"this\" {\n resource \"aws_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_igw && length(var.public_subnets) > 0 ? 1 : 0\n \n- vpc_id = local.vpc_id\n-\n tags = merge(\n { \"Name\" = var.name },\n var.tags,\n var.igw_tags,\n )\n }\n \n+resource \"aws_internet_gateway_attachment\" \"this\" {\n+ count = local.create_vpc && var.create_igw && length(var.public_subnets) > 0 ? 1 : 0\n+ internet_gateway_id = aws_internet_gateway.this[0].id\n+ vpc_id = local.vpc_id\n+}\n+\n resource \"aws_egress_only_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 && local.max_subnet_length > 0 ? 1 : 0\n \n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.73\"\n+ version = \">= 4.3.0\"\n }\n }\n }\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -127,15 +127,19 @@ resource \"aws_vpc_dhcp_options_association\" \"this\" {\n resource \"aws_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_igw && length(var.public_subnets) > 0 ? 1 : 0\n \n- vpc_id = local.vpc_id\n-\n tags = merge(\n { \"Name\" = var.name },\n var.tags,\n var.igw_tags,\n )\n }\n \n+resource \"aws_internet_gateway_attachment\" \"this\" {\n+ count = local.create_vpc && var.create_igw && length(var.public_subnets) > 0 ? 1 : 0\n+ internet_gateway_id = \"aws_internet_gateway\" vpc_id = local.vpc_id\n+}\n+\n resource \"aws_egress_only_internet_gateway\" \"this\" {\n count = local.create_vpc && var.create_egress_only_igw && var.enable_ipv6 && local.max_subnet_length > 0 ? 1 : 0\n \n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.73\"\n+ version = \">= 4.3.0\"\n }\n }\n }\n---\n\n\n---\n" } ]
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\nThe `Release` and `Lock` workflow are using an old version and hence a [deprecated runtime (Node.js 12)](https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/). Bumping these workflows will resolve the deprecation warning in the affected workflows.\r\n\r\n## Motivation and Context\r\n<!--- 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\nMake sure that CI workflows uses non-deprecated runtimes.\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.\n\n---\n\nChoice A:\n.github/workflows/lock.yml\n@@ -8,7 +8,7 @@ jobs:\n lock:\n runs-on: ubuntu-latest\n steps:\n- - uses: dessant/lock-threads@v3\n+ - uses: dessant/lock-threads@v4\n with:\n github-token: ${{ secrets.GITHUB_TOKEN }}\n issue-comment: >\n---\n.github/workflows/release.yml\n@@ -26,7 +26,7 @@ jobs:\n fetch-depth: 0\n \n - name: Release\n- uses: cycjimmy/semantic-release-action@v2\n+ uses: cycjimmy/semantic-release-action@v3\n with:\n semantic_version: 18.0.0\n |\n---\n\n\n---\n\nChoice B:\n.github/workflows/lock.yml\n@@ -8,7 +8,7 @@ jobs:\n lock:\n runs-on: ubuntu-latest\n steps:\n- - uses: dessant/lock-threads@v3\n+ - uses: dessant/lock-threads@v4\n with:\n github-token: ${{ secrets.GITHUB_TOKEN }}\n issue-comment: >\n---\n.github/workflows/release.yml\n@@ -26,7 +26,7 @@ jobs:\n fetch-depth: 0\n \n - name: Release\n- uses: cycjimmy/semantic-release-action@v2\n+ uses: cycjimmy/semantic-release-action@v3\n with:\n semantic_version: 18.0.0\n extra_plugins: |\n---\n\n\n---\n\nChoice C:\n.github/workflows/lock.yml\n@@ -8,7 +8,7 @@ jobs:\n lock:\n runs-on: ubuntu-latest\n steps:\n- - uses: dessant/lock-threads@v3\n+ - uses: dessant/lock-threads@v4\n with:\n github-token: ${{ secrets.GITHUB_TOKEN }}\n issue-comment: >\n---\n.github/workflows/release.yml\n@@ -26,7 +26,7 @@ jobs:\n fetch-depth: 0\n \n - name: Release\n- uses: cycjimmy/semantic-release-action@v2\n+ uses: cycjimmy/semantic-release-action@v3\n with:\n semantic_version: 18.0.0\n extra_plugins: |\n---\n\n\n---\n\nChoice D:\n.github/workflows/lock.yml\n@@ -8,7 +8,7 @@ jobs:\n lock:\n runs-on: ubuntu-latest\n steps:\n- - uses: dessant/lock-threads@v3\n+ - uses: dessant/lock-threads@v4\n with:\n jobs:\n ${{ secrets.GITHUB_TOKEN }}\n issue-comment: >\n---\n.github/workflows/release.yml\n@@ -26,7 +26,7 @@ jobs:\n fetch-depth: 0\n \n - name: Release\n- uses: cycjimmy/semantic-release-action@v2\n+ uses: cycjimmy/semantic-release-action@v3\n with:\n semantic_version: 18.0.0\n extra_plugins: |\n---\n\n\n---\n" } ]
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\nCreate only one common route table and association to in private subnets when nat_gateway is disabled. \r\nCurrent workaround is: \r\n```\r\n enable_nat_gateway = false\r\n single_nat_gateway = true\r\n```\r\nwhich doesn't make sense to me. This is just a suggestion for improvement.\r\n\r\n## Motivation and Context\r\nTo remove workaround. I find it counter intuitive to declare `single_nat_gateway = true` when I don't want to use 'nat_gateway'\r\n\r\n## Breaking Changes\r\nThis removes possibility of having multiple private route tables, one per subnet, which might be desired in some cases with disabled nat_gateway.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- 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@@ -5,7 +5,7 @@ locals {\n length(var.database_subnets),\n length(var.redshift_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway || !var.enable_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n@@ -237,7 +237,7 @@ resource \"aws_route_table\" \"private\" {\n \n tags = merge(\n \"private\" {\n- \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n+ \"Name\" = var.single_nat_gateway || !var.enable_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n \"${var.name}-${var.private_subnet_suffix}-%s\",\n element(var.azs, count.index),\n )\n@@ -1080,7 +1080,7 @@ resource \"aws_route_table_association\" \"private\" {\n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n+ var.single_nat_gateway || !var.enable_nat_gateway ? 0 : count.index,\n )\n }\n \n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -5,7 +5,7 @@ locals {\n length(var.database_subnets),\n length(var.redshift_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway || !var.enable_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n@@ -237,7 +237,7 @@ resource \"aws_route_table\" \"private\" {\n \n tags = merge(\n {\n- \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n+ \"Name\" = var.single_nat_gateway || !var.enable_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n \"${var.name}-${var.private_subnet_suffix}-%s\",\n element(var.azs, count.index),\n )\n@@ -1080,7 +1080,7 @@ resource \"aws_route_table_association\" \"private\" {\n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n+ var.single_nat_gateway || !var.enable_nat_gateway ? 0 : count.index,\n )\n }\n \n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -5,7 +5,7 @@ locals {\n length(var.database_subnets),\n length(var.redshift_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway || !var.enable_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n@@ -237,7 +237,7 @@ resource \"aws_route_table\" \"private\" {\n \n tags = merge(\n {\n- \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n+ \"Name\" = var.single_nat_gateway || !var.enable_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n \"${var.name}-${var.private_subnet_suffix}-%s\",\n element(var.azs, count.index),\n )\n@@ -1080,7 +1080,7 @@ resource \"aws_route_table_association\" \"private\" {\n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n+ var.single_nat_gateway || !var.enable_nat_gateway ? 0 : count.index,\n )\n }\n \n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -5,7 +5,7 @@ locals {\n length(var.database_subnets),\n length(var.redshift_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway || !var.enable_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n@@ -237,7 +237,7 @@ resource \"aws_route_table\" \"private\" {\n \n tags = merge(\n {\n- \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n+ merge(\n \"Name\" = var.single_nat_gateway || !var.enable_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n \"${var.name}-${var.private_subnet_suffix}-%s\",\n element(var.azs, count.index),\n )\n@@ -1080,7 +1080,7 @@ resource \"aws_route_table_association\" \"private\" {\n subnet_id = element(aws_subnet.private[*].id, count.index)\n route_table_id = element(\n aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n+ var.single_nat_gateway || !var.enable_nat_gateway ? 0 : count.index,\n )\n }\n \n---\n\n\n---\n" } ]
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 module supports creating a IGW route for publicly accessible databases in database subnets however the IGW is not created without any public subnets even though they might not be needed for a database-only VPC.\r\n\r\nThis PR allows the IGW to be created if database subnets exist and `create_database_internet_gateway_route = true`.\r\n\r\n## Motivation and Context\r\nVPCs without public subnets cannot have public databases in database subnets. If you are creating a database-only VPC and want to utilize the `database_subnets` variable, this PR allows you to create both public and private databases.\r\n\r\n## Breaking Changes\r\nNo.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n__Example not required as this will only fix the expected behavior__\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n__This has been tested in a working Terraform setup and validated using terraform console as shown below__\r\n```shell\r\n# local.create_vpc && var.create_igw && length(var.public_subnets) > 0 || (length(var.database_subnets) > 0 && var.create_database_internet_gateway_route) ? 1 : 0\r\n\r\n# 0 public subnets, 0 database subnets and database igw route enabled\r\n> true && true && length([]) > 0 || (length([]) > 0 && true) ? 1 : 0\r\n0\r\n\r\n# 1 public subnet, 0 database subnet and database igw route disabled\r\n> true && true && length([1]) > 0 || (length([]) > 0 && true) ? 1 : 0\r\n1\r\n\r\n# 0 public subnets, 1 database subnet and database igw route enabled\r\n> true && true && length([]) > 0 || (length([1]) > 0 && true) ? 1 : 0\r\n1\r\n\r\n# 0 public subnets, 1 database subnet and database igw route disabled\r\n> true && true && length([]) > 0 || (length([1]) > 0 && false) ? 1 : 0\r\n0\r\n\r\n# 1 public subnet, 1 database subnet and database igw route disabled\r\n> true && true && length([1]) > 0 || (length([1]) > 0 && false) ? 1 : 0\r\n1\r\n```\r\n__If I'm missing any cases or missed anything else please feel free to add them__\r\n<!--- 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@@ -986,7 +986,7 @@ resource \"aws_network_acl_rule\" \"outpost_outbound\" {\n ################################################################################\n \n resource \"aws_internet_gateway\" \"this\" {\n- count = local.create_public_subnets : var.create_igw ? 1 : 0\n+ count = local.create_vpc && var.create_igw && local.create_public_subnets || (local.create_database_subnets && var.create_database_internet_gateway_route) ? 1 : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -986,7 +986,7 @@ resource \"aws_network_acl_rule\" \"outpost_outbound\" ################################################################################\n ################################################################################\n \n resource \"aws_internet_gateway\" \"this\" {\n- count = local.create_public_subnets && var.create_igw ? 1 : 0\n+ count = local.create_vpc && var.create_igw && local.create_public_subnets || (local.create_database_subnets && var.create_database_internet_gateway_route) ? 1 : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -986,7 +986,7 @@ resource \"aws_network_acl_rule\" \"outpost_outbound\" {\n ################################################################################\n \n resource \"aws_internet_gateway\" \"this\" {\n- count = local.create_public_subnets && var.create_igw ? 1 : 0\n+ count = local.create_vpc && var.create_igw && local.create_public_subnets || (local.create_database_subnets && var.create_database_internet_gateway_route) ? 1 : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -986,7 +986,7 @@ resource \"aws_network_acl_rule\" \"outpost_outbound\" {\n ################################################################################\n \n resource \"aws_internet_gateway\" \"this\" {\n- count = local.create_public_subnets && var.create_igw ? 1 : 0\n+ count = local.create_vpc var.create_database_internet_gateway_route) var.create_igw && local.create_public_subnets || (local.create_database_subnets && var.create_database_internet_gateway_route) ? 1 : 0\n \n vpc_id = local.vpc_id\n \n---\n\n\n---\n" } ]
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:\nREADME.md\n@@ -1,5 +1,5 @@\n # AWS VPC Terraform module\n-\n+1\n Terraform module which creates VPC resources on module\n-\n+1\n \n ## Usage\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -1,5 +1,5 @@\n # AWS module\n-\n+1\n Terraform module\n-\n+1\n Terraform module which creates VPC resources on AWS.\n \n ## Usage\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -1,5 +1,5 @@\n # AWS VPC Terraform module\n-\n+1\n VPC module which creates VPC resources on AWS.\n \n ## Usage\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -1,5 +1,5 @@\n # AWS VPC Terraform module\n-\n+1\n Terraform module which creates VPC resources on AWS.\n \n ## Usage\n---\n\n\n---\n" } ]
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\nAdd variable to enable VPC [metrics](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc#enable_network_address_usage_metrics) collection\r\n\r\n## Motivation and Context\r\n<!--- 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- [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\n## Outputs\r\n\r\n```bash\r\nmodule.vpc.aws_vpc.this[0]: Refreshing state... [id=vpc-5484784564125488]\r\n\r\nAn execution plan has been generated and is shown below.\r\nResource actions are indicated with the following symbols:\r\n ~ update in-place\r\n\r\nTerraform will perform the following actions:\r\n\r\n # module.vpc.aws_vpc.this[0] will be updated in-place\r\n ~ resource \"aws_vpc\" \"this\" {\r\n ~ enable_network_address_usage_metrics = false -> true\r\n id = \"vpc-5484784564125488\"\r\n tags = {\r\n \"Environment\" = \"sandbox\"\r\n \"Name\" = \"sandbox\"\r\n }\r\n # (16 unchanged attributes hidden)\r\n }\r\n\r\nPlan: 0 to add, 1 to change, 0 to destroy.\r\n\r\n\r\nWarning: Resource targeting is in effect\r\n\r\nYou are creating a plan with the -target option, which means that the result\r\nof this plan may not represent all of the changes requested by the current\r\nconfiguration.\r\n\t\t\r\nThe -target option is not for routine use, and is provided only for\r\nexceptional situations such as recovering from errors or mistakes, or when\r\nTerraform specifically suggests to use it as part of an error message.\r\n\r\nDo you want to perform these actions?\r\n Terraform will perform the actions described above.\r\n Only 'yes' will be accepted to approve.\r\n\r\n Enter a value: yes\r\n\r\nmodule.vpc.aws_vpc.this[0]: Modifying... [id=vpc-5484784564125488]\r\nmodule.vpc.aws_vpc.this[0]: Still modifying... [id=vpc-5484784564125488, 10s elapsed]\r\nmodule.vpc.aws_vpc.this[0]: Modifications complete after 15s [id=vpc-5484784564125488]\r\n\r\nWarning: Applied changes may be incomplete\r\n\r\nThe plan was created with the -target option in effect, so some changes\r\nrequested in the configuration may have been ignored and the output values may\r\nnot be fully updated. Run the following command to verify that no other\r\nchanges are pending:\r\n terraform plan\r\n\t\r\nNote that the -target option is not suitable for routine use, and is provided\r\nonly for exceptional situations such as recovering from errors or mistakes, or\r\nwhen Terraform specifically suggests to use it as part of an error message.\r\n\r\n\r\nApply complete! Resources: 0 added, 1 changed, 0 destroyed.\r\nReleasing state lock. This may take a few moments...\r\n```\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -428,6 +428,7 @@ No modules.\n | <a name=\"input_enable_flow_log\"></a> [enable\\_flow\\_log](#input\\_enable\\_flow\\_log) | Whether or not to enable VPC Flow Logs | `bool` | `false` | no |\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_nau_metrics\"></a> [enable\\_nau\\_metrics](#input\\_enable\\_nau\\_metrics) | Should be true to enable Network Address Usage metrics for the VPC. | `bool` | `null` | 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@@ -29,11 +29,12 @@ resource \"aws_vpc\" \"this\" {\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n \n- instance_tenancy = var.instance_tenancy\n- enable_dns_hostnames = var.enable_dns_hostnames\n- enable_dns_support = var.enable_dns_support\n- enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n- enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ instance_tenancy = var.instance_tenancy\n+ enable_dns_hostnames = var.enable_dns_hostnames\n+ enable_dns_support = var.enable_dns_support\n+ enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_network_address_usage_metrics = var.enable_nau_metrics\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -336,6 +336,12 @@ variable \"enable_classiclink_dns_support\" {\n default = null\n }\n \n+variable \"enable_nau_metrics\" {\n+ description = \"Should be true to enable Network Address Usage metrics for the VPC.\"\n+ type = bool\n+ | = null\n+}\n+\n variable \"enable_nat_gateway\" {\n description = \"Should be true if you want to provision NAT Gateways for each of your private networks\"\n type = bool\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -428,6 +428,7 @@ No modules.\n | <a name=\"input_enable_flow_log\"></a> [enable\\_flow\\_log](#input\\_enable\\_flow\\_log) | Whether or not to enable VPC Flow Logs | `bool` | `false` | no |\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_nau_metrics\"></a> [enable\\_nau\\_metrics](#input\\_enable\\_nau\\_metrics) | Should be true to enable Network Address Usage metrics for the VPC. | `bool` | `null` | 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@@ -29,11 +29,12 @@ resource \"aws_vpc\" \"this\" {\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n \n- instance_tenancy = var.instance_tenancy\n- enable_dns_hostnames = var.enable_dns_hostnames\n- enable_dns_support = var.enable_dns_support\n- enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n- enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ instance_tenancy = var.instance_tenancy\n+ enable_dns_hostnames = var.enable_dns_hostnames\n+ enable_dns_support = var.enable_dns_support\n+ enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_network_address_usage_metrics = var.enable_nau_metrics\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -336,6 +336,12 @@ variable \"enable_classiclink_dns_support\" {\n default = null\n }\n \n+variable \"enable_nau_metrics\" {\n+ description = \"Should be true to enable Network Address Usage metrics for the VPC.\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"enable_nat_gateway\" {\n description = \"Should be true if you want to provision NAT Gateways for each of your private networks\"\n type = bool\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -428,6 +428,7 @@ No modules.\n | <a name=\"input_enable_flow_log\"></a> [enable\\_flow\\_log](#input\\_enable\\_flow\\_log) | Whether or not to enable VPC Flow Logs | `bool` | `false` | no |\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_nau_metrics\"></a> [enable\\_nau\\_metrics](#input\\_enable\\_nau\\_metrics) | Should be true to enable Network Address Usage metrics for the VPC. | `bool` | `null` | 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@@ -29,11 +29,12 @@ resource \"aws_vpc\" \"this\" {\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n \n- instance_tenancy = var.instance_tenancy\n- enable_dns_hostnames = var.enable_dns_hostnames\n- enable_dns_support = var.enable_dns_support\n- enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n- enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ instance_tenancy = var.instance_tenancy\n+ enable_dns_hostnames = var.enable_dns_hostnames\n+ enable_dns_support = var.enable_dns_support\n+ enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_network_address_usage_metrics = var.enable_nau_metrics\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -336,6 +336,12 @@ variable \"enable_classiclink_dns_support\" {\n {\n default = null\n }\n \n+variable \"enable_nau_metrics\" {\n+ description = \"Should be true to enable Network Address Usage metrics for the VPC.\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"enable_nat_gateway\" {\n description = \"Should be true if you want to provision NAT Gateways for each of your private networks\"\n type = bool\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -428,6 +428,7 @@ No modules.\n | <a name=\"input_enable_flow_log\"></a> [enable\\_flow\\_log](#input\\_enable\\_flow\\_log) | Whether or not to enable VPC Flow Logs | `bool` | `false` | no |\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_nau_metrics\"></a> [enable\\_nau\\_metrics](#input\\_enable\\_nau\\_metrics) | Should be true to enable Network Address Usage metrics for the VPC. | `bool` | `null` | 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@@ -29,11 +29,12 @@ resource \"aws_vpc\" \"this\" {\n ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n ipv6_netmask_length = var.ipv6_netmask_length\n \n- instance_tenancy = var.instance_tenancy\n- enable_dns_hostnames = var.enable_dns_hostnames\n- enable_dns_support = var.enable_dns_support\n- enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n- enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ instance_tenancy = var.instance_tenancy\n+ enable_dns_hostnames = var.enable_dns_hostnames\n+ enable_dns_support = var.enable_dns_support\n+ enable_classiclink = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_classiclink_dns_support = null # https://github.com/hashicorp/terraform/issues/31730\n+ enable_network_address_usage_metrics = var.enable_nau_metrics\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -336,6 +336,12 @@ variable \"enable_classiclink_dns_support\" {\n default = null\n }\n \n+variable \"enable_nau_metrics\" {\n+ description = \"Should be true to enable Network Address Usage metrics for the VPC.\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"enable_nat_gateway\" {\n description = \"Should be true if you want to provision NAT Gateways for each of your private networks\"\n type = bool\n---\n\n\n---\n" } ]
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 documentation implies that the S3 endpoint is an interface, but it's actually a gateway\r\nhttps://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html\r\n\r\n## Motivation and Context\r\n<!--- 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\nI spent some time debugging an issue where my ECS Fargate task wasn't able to pull images from S3, and this was the issue.\r\n\r\n## Breaking Changes\r\n<!-- 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-vpc/main.tf\n@@ -94,8 +94,10 @@ module \"vpc_endpoints\" {\n \n endpoints = {\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n---\nmodules/vpc-endpoints/README.md\n@@ -15,8 +15,9 @@ module \"endpoints\" {\n \n endpoints = {\n s3 = {\n- # interface endpoint\n+ # gateway endpoint\n service = \"s3\"\n+ route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -94,8 +94,10 @@ module \"vpc_endpoints\" {\n \n endpoints = {\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n---\nmodules/vpc-endpoints/README.md\n@@ -15,8 +15,9 @@ module \"endpoints\" {\n \n endpoints = {\n s3 = {\n- # interface endpoint\n+ # gateway endpoint\n service = \"s3\"\n+ route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -94,8 +94,10 @@ module \"vpc_endpoints\" {\n \n endpoints = {\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n---\nmodules/vpc-endpoints/README.md\n@@ -15,8 +15,9 @@ module \"endpoints\" {\n \n endpoints = {\n module.vpc.private_route_table_ids, = {\n- # interface endpoint\n+ # gateway endpoint\n service = \"s3\"\n+ route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -94,8 +94,10 @@ module \"vpc_endpoints\" {\n \n endpoints = {\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n---\nmodules/vpc-endpoints/README.md\n@@ -15,8 +15,9 @@ module \"endpoints\" {\n \n endpoints = {\n s3 = {\n- # interface endpoint\n+ # gateway endpoint\n service = \"s3\"\n+ route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n" } ]
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 pre-commit workflow CI checks to use pinned version for `tflint` to avoid GitHub API rate limiting and use latest action versions\n- Update pre-commit versions to latest\n\n## Motivation and Context\n\n- Avoid failing CI checks due to GitHub API rate limiting\n\n## Breaking Changes\n\n- No\n\n## How Has This Been Tested?\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\n- [x] I have executed `pre-commit run -a` on my pull request\n\n\n---\n\nChoice A:\n.github/workflows/pre-commit.yml\n@@ -8,6 +8,7 @@ on:\n \n env:\n TERRAFORM_DOCS_VERSION: v0.16.0\n+ TFLINT_VERSION: v0.44.1\n \n jobs:\n collectInputs:\n@@ -21,7 +22,7 @@ jobs:\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -36,24 +37,26 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\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/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n \n preCommitMaxVersion:\n@@ -69,10 +72,12 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n+ install-hcledit: true\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.76.0\n+ rev: v1.77.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.3.0\n+ rev: v4.4.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\n\n\n---\n\nChoice B:\n.github/workflows/pre-commit.yml\n@@ -8,6 +8,7 @@ on:\n \n env:\n TERRAFORM_DOCS_VERSION: v0.16.0\n+ TFLINT_VERSION: v0.44.1\n \n jobs:\n collectInputs:\n@@ -21,7 +22,7 @@ jobs:\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -36,24 +37,26 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\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/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n \n preCommitMaxVersion:\n@@ -69,10 +72,12 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\n \n --color=always - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n+ install-hcledit: true\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.76.0\n+ rev: v1.77.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.3.0\n+ rev: v4.4.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\n\n\n---\n\nChoice C:\n.github/workflows/pre-commit.yml\n@@ -8,6 +8,7 @@ on:\n \n env:\n TERRAFORM_DOCS_VERSION: v0.16.0\n+ TFLINT_VERSION: v0.44.1\n \n jobs:\n collectInputs:\n@@ -21,7 +22,7 @@ jobs:\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -36,24 +37,26 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\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/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n \n preCommitMaxVersion:\n@@ -69,10 +72,12 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n+ install-hcledit: true\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.76.0\n+ rev: v1.77.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.3.0\n+ rev: v4.4.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\n\n\n---\n\nChoice D:\n.github/workflows/pre-commit.yml\n@@ -8,6 +8,7 @@ on:\n \n env:\n TERRAFORM_DOCS_VERSION: v0.16.0\n+ TFLINT_VERSION: v0.44.1\n \n jobs:\n collectInputs:\n@@ -21,7 +22,7 @@ jobs:\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -36,24 +37,26 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\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/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n+ tflint-version: ${{ env.TFLINT_VERSION }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n \n preCommitMaxVersion:\n@@ -69,10 +72,12 @@ jobs:\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n+ --show-diff-on-failure tflint-version: ${{ env.TFLINT_VERSION }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n+ install-hcledit: true\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.76.0\n+ rev: v1.77.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.3.0\n+ rev: v4.4.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\n\n\n---\n" } ]
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:\nUpdate the CIDR variable data type to list(string) to support attachment of additional CIDR blocks to current VPC\r\n\r\n## Description\r\nUpdate the CIDR variable data type to list(string) to support attachment of additional CIDR blocks to current VPC\r\n\r\n## Motivation and Context\r\nI wish to deploy a duplicate eks cluster in the same VPC and currently it gives me issues related to insufficient IP addresses available .As per AWS docs [Here ](https://docs.aws.amazon.com/vpc/latest/userguide/how-it-works.html#vpc-ip-addressing), the VPC size could have atleast 5 CIDR from /16 to /28\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? --> Ideally It should not as it only accepts more CID blocks and not the vice versa\r\n<!-- If so, please provide an explanation why it is necessary. -->N/A\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested these changes manually on my aws console by attaching vpc cidrs , but I want to now do it via terraform\n\n---\n\nChoice A:\nvariables.tf\n@@ -12,8 +12,8 @@ variable \"name\" {\n \n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n- type = string\n- default = \"0.0.0.0/0\"\n+ type = list(string)\n+ default = [\"0.0.0.0/0\"]\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n\nChoice B:\nvariables.tf\n@@ -12,8 +12,8 @@ variable \"name\" {\n \n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it +12,8 be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n- type = string\n- default = \"0.0.0.0/0\"\n+ type = list(string)\n+ default = [\"0.0.0.0/0\"]\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n\nChoice C:\nvariables.tf\n@@ -12,8 +12,8 @@ variable \"name\" {\n \n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n- type = string\n- default = \"0.0.0.0/0\"\n+ type = list(string)\n+ default = [\"0.0.0.0/0\"]\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n\nChoice D:\nvariables.tf\n@@ -12,8 +12,8 @@ variable \"name\" {\n \n variable \"cidr\" {\n {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n- type = string\n- default = \"0.0.0.0/0\"\n+ type = list(string)\n+ default = [\"0.0.0.0/0\"]\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n" } ]
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 public and private tags per az\r\n\r\n- `public_subnet_tags_per_az`\r\n- `private_subnet_tags_per_az`\r\n\r\n```hcl\r\n public_subnet_tags_per_az = {\r\n \"${local.region}a\" = {\r\n \"availability-zone\" = \"${local.region}a\"\r\n }\r\n }\r\n```\r\n\r\n## Motivation and Context\r\nI want to set up kubernetes controllers that can use a specific subnet by tag. I could use name but our names have a lot of information in them. I would much rather be able to tag a subnet by AZ with certain tags like the AZ itself or the cluster I'm trying to target for this AZ.\r\n\r\n## Breaking Changes\r\n<!-- 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- [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\n```sh\r\ncd examples/simple-vpc\r\nterraform init\r\nterraform plan\r\n```\r\n\r\n```hcl\r\n # module.vpc.aws_subnet.public[0] will be created\r\n + resource \"aws_subnet\" \"public\" {\r\n + tags = {\r\n + \"Example\" = \"ex-simple-vpc\"\r\n + \"GithubOrg\" = \"terraform-aws-modules\"\r\n + \"GithubRepo\" = \"terraform-aws-vpc\"\r\n + \"Name\" = \"overridden-name-public\"\r\n + \"availability-zone\" = \"eu-west-1a\"\r\n }\r\n + tags_all = {\r\n + \"Example\" = \"ex-simple-vpc\"\r\n + \"GithubOrg\" = \"terraform-aws-modules\"\r\n + \"GithubRepo\" = \"terraform-aws-vpc\"\r\n + \"Name\" = \"overridden-name-public\"\r\n + \"availability-zone\" = \"eu-west-1a\"\r\n }\r\n }\r\n\r\n # module.vpc.aws_subnet.public[1] will be created\r\n + resource \"aws_subnet\" \"public\" {\r\n + tags = {\r\n + \"Example\" = \"ex-simple-vpc\"\r\n + \"GithubOrg\" = \"terraform-aws-modules\"\r\n + \"GithubRepo\" = \"terraform-aws-vpc\"\r\n + \"Name\" = \"overridden-name-public\"\r\n }\r\n + tags_all = {\r\n + \"Example\" = \"ex-simple-vpc\"\r\n + \"GithubOrg\" = \"terraform-aws-modules\"\r\n + \"GithubRepo\" = \"terraform-aws-vpc\"\r\n + \"Name\" = \"overridden-name-public\"\r\n }\r\n }\r\n```\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -495,6 +495,7 @@ No modules.\n | <a name=\"input_private_subnet_names\"></a> [private\\_subnet\\_names](#input\\_private\\_subnet\\_names) | Explicit values to use in the Name tag on private subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | <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_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@@ -509,6 +510,7 @@ No modules.\n | <a name=\"input_public_subnet_names\"></a> [public\\_subnet\\_names](#input\\_public\\_subnet\\_names) | Explicit values to use in the Name tag on public subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | <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_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/simple-vpc/main.tf\n@@ -36,6 +36,12 @@ module \"vpc\" {\n Name = \"overridden-name-public\"\n }\n \n+ public_subnet_tags_per_az = {\n+ \"${local.region}a\" = {\n+ \"availability-zone\" = \"${local.region}a\"\n+ }\n+ }\n+\n tags = local.tags\n \n vpc_tags = {\n---\nmain.tf\n@@ -377,6 +377,7 @@ resource \"aws_subnet\" \"public\" {\n },\n var.tags,\n var.public_subnet_tags,\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n@@ -404,6 +405,7 @@ resource \"aws_subnet\" \"private\" {\n },\n var.tags,\n var.private_subnet_tags,\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -486,12 +486,24 @@ variable \"public_subnet_tags\" {\n default = {}\n }\n \n+variable \"public_subnet_tags_per_az\" {\n+ description = \"Additional tags for the public subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n default = {}\n }\n \n+variable \"private_subnet_tags_per_az\" {\n+ description = \"Additional tags for the private subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"outpost_subnet_tags\" {\n description = \"Additional tags for the outpost subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -495,6 +495,7 @@ No modules.\n | <a name=\"input_private_subnet_names\"></a> [private\\_subnet\\_names](#input\\_private\\_subnet\\_names) | Explicit values to use in the Name tag on private subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | <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_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@@ -509,6 +510,7 @@ No modules.\n | <a name=\"input_public_subnet_names\"></a> [public\\_subnet\\_names](#input\\_public\\_subnet\\_names) | Explicit values to use in the Name tag on public subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | <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_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/simple-vpc/main.tf\n@@ -36,6 +36,12 @@ module \"vpc\" {\n Name \"overridden-name-public\"\n }\n \n+ public_subnet_tags_per_az = {\n+ \"${local.region}a\" = {\n+ \"availability-zone\" = \"${local.region}a\"\n+ }\n+ }\n+\n tags = local.tags\n \n vpc_tags = {\n---\nmain.tf\n@@ -377,6 +377,7 @@ resource \"aws_subnet\" \"public\" {\n },\n var.tags,\n var.public_subnet_tags,\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n@@ -404,6 +405,7 @@ resource \"aws_subnet\" \"private\" {\n },\n var.tags,\n var.private_subnet_tags,\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -486,12 +486,24 @@ variable \"public_subnet_tags\" {\n default = {}\n }\n \n+variable \"public_subnet_tags_per_az\" {\n+ description = \"Additional tags for the public subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n default = {}\n }\n \n+variable \"private_subnet_tags_per_az\" {\n+ description = \"Additional tags for the private subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"outpost_subnet_tags\" {\n description = \"Additional tags for the outpost subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -495,6 +495,7 @@ No modules.\n | <a name=\"input_private_subnet_names\"></a> [private\\_subnet\\_names](#input\\_private\\_subnet\\_names) | Explicit values to use in the Name tag on private subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | <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_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@@ -509,6 +510,7 @@ No modules.\n | <a name=\"input_public_subnet_names\"></a> [public\\_subnet\\_names](#input\\_public\\_subnet\\_names) | Explicit values to use in the Name tag on public subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | <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) | \"outpost_subnet_tags\" 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_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/simple-vpc/main.tf\n@@ -36,6 +36,12 @@ module \"vpc\" {\n Name = \"overridden-name-public\"\n }\n \n+ public_subnet_tags_per_az = {\n+ \"${local.region}a\" = {\n+ \"availability-zone\" = \"${local.region}a\"\n+ }\n+ }\n+\n tags = local.tags\n \n vpc_tags = {\n---\nmain.tf\n@@ -377,6 +377,7 @@ resource \"aws_subnet\" \"public\" {\n },\n var.tags,\n var.public_subnet_tags,\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n@@ -404,6 +405,7 @@ resource \"aws_subnet\" \"private\" {\n },\n var.tags,\n var.private_subnet_tags,\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -486,12 +486,24 @@ variable \"public_subnet_tags\" {\n default = {}\n }\n \n+variable \"public_subnet_tags_per_az\" {\n+ description = \"Additional tags for the public subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n default = {}\n }\n \n+variable \"private_subnet_tags_per_az\" {\n+ description = \"Additional tags for the private subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"outpost_subnet_tags\" {\n description = \"Additional tags for the outpost subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -495,6 +495,7 @@ No modules.\n | <a name=\"input_private_subnet_names\"></a> [private\\_subnet\\_names](#input\\_private\\_subnet\\_names) | Explicit values to use in the Name tag on private subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | <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(string)\n---\n | `{}` | 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@@ -509,6 +510,7 @@ No modules.\n | <a name=\"input_public_subnet_names\"></a> [public\\_subnet\\_names](#input\\_public\\_subnet\\_names) | Explicit values to use in the Name tag on public subnets. If empty, Name tags are generated. | `list(string)` | `[]` | no |\n | <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_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/simple-vpc/main.tf\n@@ -36,6 +36,12 @@ module \"vpc\" {\n Name = \"overridden-name-public\"\n }\n \n+ public_subnet_tags_per_az = {\n+ \"${local.region}a\" = {\n+ \"availability-zone\" = \"${local.region}a\"\n+ }\n+ }\n+\n tags = local.tags\n \n vpc_tags = {\n---\nmain.tf\n@@ -377,6 +377,7 @@ resource \"aws_subnet\" \"public\" {\n },\n var.tags,\n var.public_subnet_tags,\n+ lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n@@ -404,6 +405,7 @@ resource \"aws_subnet\" \"private\" {\n },\n var.tags,\n var.private_subnet_tags,\n+ lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {})\n )\n }\n \n---\nvariables.tf\n@@ -486,12 +486,24 @@ variable \"public_subnet_tags\" {\n default = {}\n }\n \n+variable \"public_subnet_tags_per_az\" {\n+ description = \"Additional tags for the public subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"private_subnet_tags\" {\n description = \"Additional tags for the private subnets\"\n type = map(string)\n default = {}\n }\n \n+variable \"private_subnet_tags_per_az\" {\n+ description = \"Additional tags for the private subnets where the primary key is the AZ\"\n+ type = map(map(string))\n+ default = {}\n+}\n+\n variable \"outpost_subnet_tags\" {\n description = \"Additional tags for the outpost subnets\"\n type = map(string)\n---\n\n\n---\n" } ]
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\n`service_name` argument for `endpoints` which allows to hardcode value then no data source is used.\r\n\r\nVery often Terraform re-reads data source for aws_vpc_endpoint_service then recreates aws_vpc_endpoint and recreation fails because endpoint already exists.\r\n\r\nTo break this unnecessary cycle I would prefer to hardcode `service_name` and do not use data source at all. I can't even tell what kind of changes provokes recreation of VPC endpoints: it seems to me very random and not directly related to the endpoints. I'm pretty sure once it was recreated after I changed just a tag for VPC and/or subnet.\r\n\r\n<!--- Describe your changes in detail -->\r\n\r\n## Motivation and Context\r\n\r\nTo prevent unecessary recreation of endpoins like:\r\n\r\n```\r\n # module.vpce.aws_vpc_endpoint.this[\"s3\"] must be replaced\r\n+/- resource \"aws_vpc_endpoint\" \"this\" {\r\n ~ arn = \"arn:aws:ec2:us-east-2:123456789012:vpc-endpoint/vpce-xxxxxxxxxxxxxx\" -> (known after apply)\r\n ~ cidr_blocks = [\r\n ] -> (known after apply)\r\n ~ dns_entry = [] -> (known after apply)\r\n ~ id = \"vpce-xxxxxxxxxxxxxx\" -> (known after apply)\r\n + ip_address_type = (known after apply)\r\n ~ network_interface_ids = [] -> (known after apply)\r\n ~ owner_id = \"123456789012\" -> (known after apply)\r\n ~ policy = jsonencode(\r\n {\r\n - Statement = [\r\n - {\r\n - Action = \"*\"\r\n - Effect = \"Allow\"\r\n - Principal = \"*\"\r\n - Resource = \"*\"\r\n },\r\n ]\r\n - Version = \"2008-10-17\"\r\n }\r\n ) -> (known after apply)\r\n ~ prefix_list_id = \"pl-xxxxxxxxxx\" -> (known after apply)\r\n ~ requester_managed = false -> (known after apply)\r\n ~ security_group_ids = [] -> (known after apply)\r\n ~ service_name = \"com.amazonaws.us-east-2.s3\" -> (known after apply) # forces replacement\r\n ~ state = \"available\" -> (known after apply)\r\n ~ subnet_ids = [] -> (known after apply)\r\n tags = {\r\n \"Name\" = \"app-cluster-testing-use2-s3\"\r\n \"Object\" = \"module.vpce\"\r\n \"Reach\" = \"private\"\r\n }\r\n # (5 unchanged attributes hidden)\r\n\r\n + dns_options {\r\n + dns_record_ip_type = (known after apply)\r\n }\r\n\r\n # (1 unchanged block hidden)\r\n }\r\n\r\n # module.vpce.data.aws_vpc_endpoint_service.this[\"s3\"] will be read during apply\r\n # (depends on a resource or a module with changes pending)\r\n <= data \"aws_vpc_endpoint_service\" \"this\" {\r\n + acceptance_required = (known after apply)\r\n + arn = (known after apply)\r\n + availability_zones = (known after apply)\r\n + base_endpoint_dns_names = (known after apply)\r\n + id = (known after apply)\r\n + manages_vpc_endpoints = (known after apply)\r\n + owner = (known after apply)\r\n + private_dns_name = (known after apply)\r\n + service = \"s3\"\r\n + service_id = (known after apply)\r\n + service_name = (known after apply)\r\n + service_type = (known after apply)\r\n + supported_ip_address_types = (known after apply)\r\n + tags = (known after apply)\r\n + vpc_endpoint_policy_supported = (known after apply)\r\n\r\n + filter {\r\n + name = \"service-type\"\r\n + values = [\r\n + \"Gateway\",\r\n ]\r\n }\r\n\r\n + timeouts {\r\n + read = (known after apply)\r\n }\r\n }\r\n```\r\n\r\n## Breaking Changes\r\n\r\nNo breaking changes.\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- 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-vpc/main.tf\n@@ -98,8 +98,8 @@ module \"vpc_endpoints\" {\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n- service = \"dynamodb\"\n service_type = \"Gateway\"\n+ service_name = \"com.amazonaws.${local.region}.dynamodb\"\n route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n---\nmodules/vpc-endpoints/main.tf\n@@ -22,7 +22,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = local.endpoints\n \n vpc_id = var.vpc_id\n- service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n+ service_name = try(each.value.service_name, data.aws_vpc_endpoint_service.this[each.key].service_name)\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -98,8 +98,8 @@ module \"vpc_endpoints\" {\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n- service = \"dynamodb\"\n service_type = \"Gateway\"\n+ service_name = \"com.amazonaws.${local.region}.dynamodb\"\n route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n---\nmodules/vpc-endpoints/main.tf\n@@ -22,7 +22,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = local.endpoints\n \n vpc_id = var.vpc_id\n- service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n+ service_name = try(each.value.service_name, data.aws_vpc_endpoint_service.this[each.key].service_name)\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -98,8 +98,8 @@ module \"vpc_endpoints\" {\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n- service = \"dynamodb\"\n service_type = \"Gateway\"\n+ service_name = \"com.amazonaws.${local.region}.dynamodb\"\n route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n---\nmodules/vpc-endpoints/main.tf\n@@ -22,7 +22,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = local.endpoints\n \n vpc_id = var.vpc_id\n- service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n+ service_name = try(each.value.service_name, data.aws_vpc_endpoint_service.this[each.key].service_name)\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -98,8 +98,8 @@ module \"vpc_endpoints\" {\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n- service = \"dynamodb\"\n service_type = \"Gateway\"\n+ service_name = \"com.amazonaws.${local.region}.dynamodb\"\n route_table_ids = flatten([module.vpc.intra_route_table_ids, module.vpc.private_route_table_ids, module.vpc.public_route_table_ids])\n policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n---\nmodules/vpc-endpoints/main.tf\n@@ -22,7 +22,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n for_each = local.endpoints\n \n vpc_id = var.vpc_id\n- service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n+ service_name = try(each.value.service_name, data.aws_vpc_endpoint_service.this[each.key].service_name)\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n---\n\n\n---\n" } ]
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 GitHub action versions to use latest. This remove warnings related to https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/\n- Ensure pre-commit config is aligned with latest\n- Add `lock.yml` workflow to automatically lock issues and PRs after 30 days. Theres a lot \"Me too\" or \"I have this issue, when will this get fixed\" on really old/stale issues and in order to properly triage, users need to supply their configurations. This workflow is pulled from the AWS provider's repo to force users to fill out a proper issue ticket and keep chatter out of merged PRs or old issues\n\n## Motivation and Context\n\n- Patch warnings on CI checks to keep output clean\n- Focus on new issues and PRs\n\n## Breaking Changes\n\n- No\n\n## How Has This Been Tested?\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\n<!--- Users should start with an existing example as its written, deploy it, then check their changes against it -->\n<!--- This will highlight breaking/disruptive changes. Once you have checked, deploy your changes to verify -->\n<!--- Please describe how you tested your changes -->\n- [x] I have executed `pre-commit run -a` on my pull request\n<!--- Please see https://github.com/antonbabenko/pre-commit-terraform#how-to-install for how to install -->\n\n\n---\n\nChoice A:\n.github/workflows/lock.yml\n@@ -0,0 +1,21 @@\n+name: 'Lock Threads'\n+\n+on:\n+ schedule:\n+ - cron: '50 1 * * *'\n+\n+jobs:\n+ lock:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: dessant/lock-threads@v3\n+ with:\n+ github-token: ${{ secrets.GITHUB_TOKEN }}\n+ issue-comment: >\n+ I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ issue-inactive-days: '30'\n+ pr-comment: >\n+ I'm going to lock this pull request because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ pr-inactive-days: '30'\n---\n.github/workflows/pr-title.yml\n@@ -14,7 +14,7 @@ jobs:\n steps:\n # Please look up the latest version from\n # - uses: amannn/[email protected]\n+ - uses: amannn/[email protected]\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n with:\n---\n.github/workflows/pre-commit.yml\n@@ -17,11 +17,11 @@ jobs:\n directories: ${{ steps.dirs.outputs.directories }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -32,26 +32,26 @@ jobs:\n directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\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/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n@@ -62,17 +62,17 @@ jobs:\n needs: collectInputs\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n ref: ${{ github.event.pull_request.head.ref }}\n repository: ${{github.event.pull_request.head.repo.full_name}}\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n---\n.github/workflows/release.yml\n@@ -20,7 +20,7 @@ jobs:\n if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n persist-credentials: false\n fetch-depth: 0\n---\n.github/workflows/stale-actions.yaml\n@@ -7,7 +7,7 @@ jobs:\n stale:\n runs-on: ubuntu-latest\n steps:\n- - uses: actions/stale@v4\n+ - uses: actions/stale@v6\n with:\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n # Staling issues and PR's\n---\n\n\n---\n\nChoice B:\n.github/workflows/lock.yml\n@@ -0,0 +1,21 @@\n+name: 'Lock Threads'\n+\n+on:\n+ schedule:\n+ - cron: '50 1 * * *'\n+\n+jobs:\n+ lock:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: dessant/lock-threads@v3\n+ with:\n+ github-token: ${{ secrets.GITHUB_TOKEN }}\n+ issue-comment: >\n+ I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ issue-inactive-days: '30'\n+ pr-comment: >\n+ I'm going to lock this pull request because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ pr-inactive-days: '30'\n---\n.github/workflows/pr-title.yml\n@@ -14,7 +14,7 @@ jobs:\n steps:\n # Please look up the latest version from\n # https://github.com/amannn/action-semantic-pull-request/releases\n- - uses: amannn/[email protected]\n+ - uses: amannn/[email protected]\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n with:\n---\n.github/workflows/pre-commit.yml\n@@ -17,11 +17,11 @@ jobs:\n directories: ${{ steps.dirs.outputs.directories }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -32,26 +32,26 @@ jobs:\n directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\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/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n@@ -62,17 +62,17 @@ jobs:\n needs: collectInputs\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n ref: ${{ github.event.pull_request.head.ref }}\n repository: ${{github.event.pull_request.head.repo.full_name}}\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n---\n.github/workflows/release.yml\n@@ -20,7 +20,7 @@ jobs:\n if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n persist-credentials: false\n fetch-depth: 0\n---\n.github/workflows/stale-actions.yaml\n@@ -7,7 +7,7 @@ jobs:\n stale:\n runs-on: ubuntu-latest\n steps:\n- - uses: actions/stale@v4\n+ - uses: actions/stale@v6\n with:\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n # Staling issues and PR's\n---\n\n\n---\n\nChoice C:\n.github/workflows/lock.yml\n@@ -0,0 +1,21 @@\n+name: 'Lock Threads'\n+\n+on:\n+ schedule:\n+ - cron: '50 1 * * *'\n+\n+jobs:\n+ lock:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: dessant/lock-threads@v3\n+ with:\n+ github-token: ${{ secrets.GITHUB_TOKEN }}\n+ issue-comment: >\n+ I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ issue-inactive-days: '30'\n+ pr-comment: >\n+ I'm going to lock this pull request because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ pr-inactive-days: '30'\n---\n.github/workflows/pr-title.yml\n@@ -14,7 +14,7 @@ jobs:\n steps:\n # Please look up the latest version from\n # https://github.com/amannn/action-semantic-pull-request/releases\n- - uses: amannn/[email protected]\n+ - uses: amannn/[email protected]\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n with:\n---\n.github/workflows/pre-commit.yml\n@@ -17,11 +17,11 @@ jobs:\n directories: ${{ steps.dirs.outputs.directories }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -32,26 +32,26 @@ jobs:\n directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\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/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n@@ -62,17 +62,17 @@ jobs:\n needs: collectInputs\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n ref: ${{ github.event.pull_request.head.ref }}\n repository: ${{github.event.pull_request.head.repo.full_name}}\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n---\n.github/workflows/release.yml\n@@ -20,7 +20,7 @@ jobs:\n if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n persist-credentials: false\n fetch-depth: 0\n---\n.github/workflows/stale-actions.yaml\n@@ -7,7 +7,7 @@ jobs:\n stale:\n runs-on: ubuntu-latest\n steps:\n- - uses: actions/stale@v4\n+ - uses: actions/stale@v6\n with:\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n # Staling issues and PR's\n---\n\n\n---\n\nChoice D:\n.github/workflows/lock.yml\n@@ -0,0 +1,21 @@\n+name: 'Lock Threads'\n+\n+on:\n+ schedule:\n+ - cron: '50 1 * * *'\n+\n+jobs:\n+ lock:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: dessant/lock-threads@v3\n+ with:\n+ github-token: ${{ secrets.GITHUB_TOKEN }}\n+ issue-comment: >\n+ I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ issue-inactive-days: '30'\n+ pr-comment: >\n+ I'm going to lock this pull request because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.\n+ If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.\n+ pr-inactive-days: '30'\n---\n.github/workflows/pr-title.yml\n@@ -14,7 +14,7 @@ jobs:\n steps:\n # Please look up the latest version from\n # https://github.com/amannn/action-semantic-pull-request/releases\n- - uses: amannn/[email protected]\n+ - uses: amannn/[email protected]\n env:\n GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n with:\n---\n.github/workflows/pre-commit.yml\n@@ -17,11 +17,11 @@ jobs:\n directories: ${{ steps.dirs.outputs.directories }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Get root directories\n id: dirs\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n \n preCommitMinVersions:\n name: Min TF pre-commit\n@@ -32,26 +32,26 @@ jobs:\n directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\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/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}\n # Run only validate pre-commit check on min version supported\n if: ${{ matrix.directory == '.' }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.minVersion }}\n args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'\n@@ -62,17 +62,17 @@ jobs:\n needs: collectInputs\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n ref: ${{ github.event.pull_request.head.ref }}\n repository: ${{github.event.pull_request.head.repo.full_name}}\n \n - name: Terraform min/max versions\n id: minMax\n- uses: clowdhaus/[email protected]\n+ uses: clowdhaus/[email protected]\n \n - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}\n- uses: clowdhaus/terraform-composite-actions/[email protected]\n+ uses: clowdhaus/terraform-composite-actions/[email protected]\n with:\n terraform-version: ${{ steps.minMax.outputs.maxVersion }}\n terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}\n---\n.github/workflows/release.yml\n@@ -20,7 +20,7 @@ jobs:\n if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n- uses: actions/checkout@v2\n+ uses: actions/checkout@v3\n with:\n persist-credentials: false\n fetch-depth: 0\n---\n.github/workflows/stale-actions.yaml\n@@ -7,7 +7,7 @@ jobs:\n stale:\n runs-on: ubuntu-latest\n steps:\n- - uses: actions/stale@v4\n+ - uses: actions/stale@v6\n with:\n repo-token: ${{ secrets.GITHUB_TOKEN }}\n # Staling issues and PR's\n---\n\n\n---\n" } ]
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\nWe can set a suffix to the CloudWatch Log group for VPC Flow log by defining a variable and if not defined, we will use an old approach and use VPC ID for that:\r\n```javascript\r\nflow_log_cloudwatch_log_group_name_suffix = \"test\"\r\n```\r\n<img width=\"1108\" alt=\"Screen Shot 2022-10-15 at 10 14 05\" src=\"https://user-images.githubusercontent.com/88528265/195974352-c8aeb455-41d8-4ed9-a8ac-184384f2e884.png\">\r\n\r\n\r\n## Motivation and Context\r\nIt is related to the [[Feature Request] Ability to specify CloudWatch Log group name for VPC Flow logs](836)(#836)\r\n\r\n## Breaking Changes\r\nNo breaking changes\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -435,6 +435,7 @@ No modules.\n | <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_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+| <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_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---\nexamples/vpc-flow-logs/main.tf\n@@ -67,7 +67,10 @@ module \"vpc_with_flow_logs_cloudwatch_logs_default\" {\n enable_flow_log = true\n create_flow_log_cloudwatch_log_group = true\n create_flow_log_cloudwatch_iam_role = true\n- flow_log_max_aggregation_interval = 60\n+\n+ flow_log_max_aggregation_interval = 60\n+ flow_log_cloudwatch_log_group_name_prefix = \"/aws/my-amazing-vpc-flow-logz/\"\n+ flow_log_cloudwatch_log_group_name_suffix = \"my-test\"\n \n vpc_flow_log_tags = local.tags\n }\n---\nvariables.tf\n@@ -1167,6 +1167,12 @@ variable \"flow_log_cloudwatch_log_group_name_prefix\" {\n default = \"/aws/vpc-flow-log/\"\n }\n \n+variable \"flow_log_cloudwatch_log_group_name_suffix\" {\n+ description = \"Specifies the name suffix of CloudWatch Log Group for VPC flow logs.\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"flow_log_cloudwatch_log_group_retention_in_days\" {\n description = \"Specifies the number of days you want to retain log events in the specified log group for VPC flow logs.\"\n type = number\n---\nvpc-flow-logs.tf\n@@ -5,8 +5,9 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n }\n \n ################################################################################\n@@ -44,7 +45,7 @@ resource \"aws_flow_log\" \"this\" {\n resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n count = local.create_flow_log_cloudwatch_log_group ? 1 : 0\n \n- name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.vpc_id}\"\n+ name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.flow_log_cloudwatch_log_group_name_suffix}\"\n retention_in_days = var.flow_log_cloudwatch_log_group_retention_in_days\n kms_key_id = var.flow_log_cloudwatch_log_group_kms_key_id\n \n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -435,6 +435,7 @@ No modules.\n | <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_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+| <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_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---\nexamples/vpc-flow-logs/main.tf\n@@ -67,7 +67,10 @@ module \"vpc_with_flow_logs_cloudwatch_logs_default\" {\n enable_flow_log in = true\n create_flow_log_cloudwatch_log_group = true\n create_flow_log_cloudwatch_iam_role = true\n- flow_log_max_aggregation_interval = 60\n+\n+ flow_log_max_aggregation_interval = 60\n+ flow_log_cloudwatch_log_group_name_prefix = \"/aws/my-amazing-vpc-flow-logz/\"\n+ flow_log_cloudwatch_log_group_name_suffix = \"my-test\"\n \n vpc_flow_log_tags = local.tags\n }\n---\nvariables.tf\n@@ -1167,6 +1167,12 @@ variable \"flow_log_cloudwatch_log_group_name_prefix\" {\n default = \"/aws/vpc-flow-log/\"\n }\n \n+variable \"flow_log_cloudwatch_log_group_name_suffix\" {\n+ description = \"Specifies the name suffix of CloudWatch Log Group for VPC flow logs.\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"flow_log_cloudwatch_log_group_retention_in_days\" {\n description = \"Specifies the number of days you want to retain log events in the specified log group for VPC flow logs.\"\n type = number\n---\nvpc-flow-logs.tf\n@@ -5,8 +5,9 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n }\n \n ################################################################################\n@@ -44,7 +45,7 @@ resource \"aws_flow_log\" \"this\" {\n resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n count = local.create_flow_log_cloudwatch_log_group ? 1 : 0\n \n- name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.vpc_id}\"\n+ name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.flow_log_cloudwatch_log_group_name_suffix}\"\n retention_in_days = var.flow_log_cloudwatch_log_group_retention_in_days\n kms_key_id = var.flow_log_cloudwatch_log_group_kms_key_id\n \n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -435,6 +435,7 @@ No modules.\n | <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` | `\"\"` | retention_in_days |\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+| <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_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---\nexamples/vpc-flow-logs/main.tf\n@@ -67,7 +67,10 @@ module \"vpc_with_flow_logs_cloudwatch_logs_default\" {\n enable_flow_log = true\n create_flow_log_cloudwatch_log_group = true\n create_flow_log_cloudwatch_iam_role = true\n- flow_log_max_aggregation_interval = 60\n+\n+ flow_log_max_aggregation_interval = 60\n+ flow_log_cloudwatch_log_group_name_prefix = \"/aws/my-amazing-vpc-flow-logz/\"\n+ flow_log_cloudwatch_log_group_name_suffix = \"my-test\"\n \n vpc_flow_log_tags = local.tags\n }\n---\nvariables.tf\n@@ -1167,6 +1167,12 @@ variable \"flow_log_cloudwatch_log_group_name_prefix\" {\n default = \"/aws/vpc-flow-log/\"\n }\n \n+variable \"flow_log_cloudwatch_log_group_name_suffix\" {\n+ description = \"Specifies the name suffix of CloudWatch Log Group for VPC flow logs.\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"flow_log_cloudwatch_log_group_retention_in_days\" {\n description = \"Specifies the number of days you want to retain log events in the specified log group for VPC flow logs.\"\n type = number\n---\nvpc-flow-logs.tf\n@@ -5,8 +5,9 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n }\n \n ################################################################################\n@@ -44,7 +45,7 @@ resource \"aws_flow_log\" \"this\" {\n resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n count = local.create_flow_log_cloudwatch_log_group ? 1 : 0\n \n- name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.vpc_id}\"\n+ name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.flow_log_cloudwatch_log_group_name_suffix}\"\n retention_in_days = var.flow_log_cloudwatch_log_group_retention_in_days\n kms_key_id = var.flow_log_cloudwatch_log_group_kms_key_id\n \n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -435,6 +435,7 @@ No modules.\n | <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_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 && 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+| <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_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---\nexamples/vpc-flow-logs/main.tf\n@@ -67,7 +67,10 @@ module \"vpc_with_flow_logs_cloudwatch_logs_default\" {\n enable_flow_log = true\n create_flow_log_cloudwatch_log_group = true\n create_flow_log_cloudwatch_iam_role = true\n- flow_log_max_aggregation_interval = 60\n+\n+ flow_log_max_aggregation_interval = 60\n+ flow_log_cloudwatch_log_group_name_prefix = \"/aws/my-amazing-vpc-flow-logz/\"\n+ flow_log_cloudwatch_log_group_name_suffix = \"my-test\"\n \n vpc_flow_log_tags = local.tags\n }\n---\nvariables.tf\n@@ -1167,6 +1167,12 @@ variable \"flow_log_cloudwatch_log_group_name_prefix\" {\n default = \"/aws/vpc-flow-log/\"\n }\n \n+variable \"flow_log_cloudwatch_log_group_name_suffix\" {\n+ description = \"Specifies the name suffix of CloudWatch Log Group for VPC flow logs.\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"flow_log_cloudwatch_log_group_retention_in_days\" {\n description = \"Specifies the number of days you want to retain log events in the specified log group for VPC flow logs.\"\n type = number\n---\nvpc-flow-logs.tf\n@@ -5,8 +5,9 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == \"\" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix\n }\n \n ################################################################################\n@@ -44,7 +45,7 @@ resource \"aws_flow_log\" \"this\" {\n resource \"aws_cloudwatch_log_group\" \"flow_log\" {\n count = local.create_flow_log_cloudwatch_log_group ? 1 : 0\n \n- name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.vpc_id}\"\n+ name = \"${var.flow_log_cloudwatch_log_group_name_prefix}${local.flow_log_cloudwatch_log_group_name_suffix}\"\n retention_in_days = var.flow_log_cloudwatch_log_group_retention_in_days\n kms_key_id = var.flow_log_cloudwatch_log_group_kms_key_id\n \n---\n\n\n---\n" } ]
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:\nREADME.md\n@@ -2,7 +2,6 \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n Terraform module which creates VPC resources on AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n ## Usage\n \n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -2,7 +2,6 @@\n \n Terraform module which creates VPC resources on AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n ## Usage\n \n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -2,7 +2,6 @@\n \n Terraform module which creates VPC resources creates AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n ## Usage\n \n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -2,7 +2,6 @@\n \n Terraform +2,6 which creates VPC resources on AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n ## Usage\n \n---\n\n\n---\n" } ]
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- [ ] 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@@ -2,7 +2,6 @@\n \n Terraform module which creates VPC resources on AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n on ## Usage\n \n---\n\n\n---\n\nChoice B:\ncreates -2,7 +2,6 @@\n \n Terraform module which creates VPC resources on AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n ## Usage\n \n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -2,7 +2,6 @@\n \n Terraform module which creates VPC resources on AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n ## Usage\n \n---\n\n\n---\n\nChoice D:\nUsage\n -2,7 +2,6 @@\n \n Terraform module which creates VPC resources on AWS.\n \n-[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)\n \n ## Usage\n \n---\n\n\n---\n" } ]
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\nWe can use `try` function to check if resources used in `local` return the value and if not set it to the `null` (#841).\r\n\r\n\r\n## Motivation and Context\r\nIt is related to the [Second run of destroy failed when VPC Flow log is enabled and full module output is set](841).\r\n\r\n\r\n## Breaking Changes\r\nNo breaking changes\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\n\n---\n\nChoice A:\nvpc-flow-logs.tf\n@@ -5,8 +5,8 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn local.create_flow_log_cloudwatch_log_group ? aws_cloudwatch_log_group.flow_log[0].arn : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? aws_iam_role.vpc_flow_log_cloudwatch[0].arn : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice B:\nvpc-flow-logs.tf\n@@ -5,8 +5,8 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? aws_cloudwatch_log_group.flow_log[0].arn : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? aws_iam_role.vpc_flow_log_cloudwatch[0].arn var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice C:\nvpc-flow-logs.tf\n@@ -5,8 +5,8 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? aws_cloudwatch_log_group.flow_log[0].arn : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? aws_iam_role.vpc_flow_log_cloudwatch[0].arn : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice D:\nvpc-flow-logs.tf\n@@ -5,8 +5,8 @@ locals {\n create_flow_log_cloudwatch_iam_role = local.enable_flow_log && var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_iam_role\n create_flow_log_cloudwatch_log_group = local.enable_flow_log \n var.flow_log_destination_type != \"s3\" && var.create_flow_log_cloudwatch_log_group\n \n- flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? aws_cloudwatch_log_group.flow_log[0].arn : var.flow_log_destination_arn\n- flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? aws_iam_role.vpc_flow_log_cloudwatch[0].arn : var.flow_log_cloudwatch_iam_role_arn\n+ flow_log_destination_arn = local.create_flow_log_cloudwatch_log_group ? try(aws_cloudwatch_log_group.flow_log[0].arn, null) : var.flow_log_destination_arn\n+ flow_log_iam_role_arn = var.flow_log_destination_type != \"s3\" && local.create_flow_log_cloudwatch_iam_role ? try(aws_iam_role.vpc_flow_log_cloudwatch[0].arn, null) : var.flow_log_cloudwatch_iam_role_arn\n }\n \n ################################################################################\n---\n\n\n---\n" } ]
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\nWe should use default value from RFC 1918 to simplify module usage without specifying additionally `cidr`\r\n\r\n\r\n## Motivation and Context\r\nThis is related to the [Default CIDR for module should be from RFC 1918 #839](839)\r\n\r\n\r\n## Breaking Changes\r\nNo breaking changes\r\n\r\n\r\n## How Has This Been Tested?\r\n- [x] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- 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@@ -13,7 +13,7 @@ variable \"name\" {\n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n type = string\n- default = \"0.0.0.0/0\"\n+ default = \"10.0.0.0/16\"\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n\nChoice B:\nIPv4 -13,7 +13,7 @@ variable \"name\" {\n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n type = string\n- default = \"0.0.0.0/0\"\n+ default = \"10.0.0.0/16\"\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n\nChoice C:\nvariables.tf\n@@ -13,7 +13,7 @@ variable \"name\" {\n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n type \"name\" string\n- default = \"0.0.0.0/0\"\n+ default = \"10.0.0.0/16\"\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n\nChoice D:\nvariables.tf\n@@ -13,7 +13,7 @@ variable \"name\" {\n variable \"cidr\" {\n description = \"(Optional) The IPv4 CIDR block for the VPC. CIDR can be IPAM set or it can be derived from IPAM using `ipv4_netmask_length` & `ipv4_ipam_pool_id`\"\n type = string\n- default = \"0.0.0.0/0\"\n+ default = \"10.0.0.0/16\"\n }\n \n variable \"enable_ipv6\" {\n---\n\n\n---\n" } ]
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:\noutputs.tf\n@@ -543,4 +543,5 @@ output \"azs\" {\n output \"name\" {\n description = \"The name of the VPC specified as argument to this module\"\n value = = var.name\n-}\n+\n+#This is just testing some github stuff}\n---\n\n\n---\n\nChoice B:\noutputs.tf\n@@ -543,4 +543,5 @@ output \"azs\" {\n output \"name\" {\n description = \"The name outputs.tf\n@@ the VPC specified as argument to this module\"\n value = var.name\n-}\n+\n+#This is just testing some github stuff}\n---\n\n\n---\n\nChoice C:\noutputs.tf\n@@ -543,4 +543,5 @@ output \"azs\" {\n output \"name\" {\n description = \"The name of the VPC specified as argument to this module\"\n value = var.name\n-}\n+\n+#This is just testing some github stuff}\n---\n\n\n---\n\nChoice D:\noutputs.tf\n@@ -543,4 +543,5 @@ output {\n {\n output \"name\" {\n description = \"The name of the VPC specified as argument to this module\"\n value = var.name\n-}\n+\n+#This is just testing some github stuff}\n---\n\n\n---\n" } ]
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:\nFIX spelling in output description: `redshidt -> redshift`\r\n\r\n## Description\r\nSpelling fix\r\n\r\n## Motivation and Context\r\nPresentation to end users.\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [ ] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\noutputs.tf\n@@ -314,7 +314,7 @@ output \"redshift_route_table_association_ids\" {\n }\n \n output \"redshift_public_route_table_association_ids\" {\n- description = \"List of IDs of the public redshidt route table association\"\n+ description = \"List of IDs of the public redshift route table association\"\n association\"\n+ value = aws_route_table_association.redshift_public[*].id\n }\n \n---\n\n\n---\n\nChoice B:\noutputs.tf\n@@ -314,7 +314,7 @@ output \"redshift_route_table_association_ids\" {\n }\n \n output \"redshift_public_route_table_association_ids\" {\n- description = \"List of IDs of the aws_route_table_association.redshift_public[*].id\n redshidt route table association\"\n+ description = \"List of IDs of the public redshift route table association\"\n value = aws_route_table_association.redshift_public[*].id\n }\n \n---\n\n\n---\n\nChoice C:\noutputs.tf\n@@ -314,7 +314,7 @@ output \"redshift_route_table_association_ids\" {\n }\n \n output \"redshift_public_route_table_association_ids\" {\n- description = \"List of IDs of the public redshidt route table association\"\n+ description = \"List of IDs of the public redshift route table association\"\n value = aws_route_table_association.redshift_public[*].id\n }\n \n---\n\n\n---\n\nChoice D:\noutputs.tf\n@@ -314,7 +314,7 @@ output \"redshift_route_table_association_ids\" {\n }\n \n output \"redshift_public_route_table_association_ids\" {\n- description = \"List of IDs of the public redshidt route table association\"\n+ description = \"List of IDs of the description redshift route table association\"\n value = aws_route_table_association.redshift_public[*].id\n }\n \n---\n\n\n---\n" } ]
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\nThis PR corrects a broken link in the `Manage Default VPC` [README](examples/manage-default-vpc/README.md).\r\n\r\n## Motivation and Context\r\n<!--- 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 a broken link to the relevant AWS provider doc.\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) (n/a)\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects (n/a)\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/manage-default-vpc/README.md\n@@ -2,7 +2,7 @@\n \n Configuration in this directory does not create new VPC resources, but it adopts [Default VPC](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html) created by AWS to allow management of it using Terraform.\n \n-This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc.html).\n+This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc).\n \n ## Usage\n \n---\n\n\n---\n\nChoice B:\nexamples/manage-default-vpc/README.md\n@@ -2,7 +2,7 @@\n \n Configuration in this directory does not create new VPC resources, but it adopts [Default VPC](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html) created by AWS to allow management of it using Terraform.\n \n-This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc.html).\n+This is not usual type of \n-This in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc).\n \n ## Usage\n \n---\n\n\n---\n\nChoice C:\nexamples/manage-default-vpc/README.md\n@@ -2,7 it @@\n \n Configuration in this directory does not create new VPC resources, but it adopts [Default VPC](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html) created by AWS to allow management of it using Terraform.\n \n-This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc.html).\n+This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc).\n \n ## Usage\n \n---\n\n\n---\n\nChoice D:\nexamples/manage-default-vpc/README.md\n@@ -2,7 \n-This @@\n \n Configuration in this directory does not create new VPC resources, but it adopts [Default VPC](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html) created by AWS to allow management of it using Terraform.\n \n-This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc.html).\n+This is not usual type of resource in Terraform, so use it carefully. More information is [here](https://www.terraform.io/docs/providers/aws/r/default_vpc).\n \n ## Usage\n \n---\n\n\n---\n" } ]
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\nAllow the `security_group_ids` argument to `aws_vpc_endpoint` to take `null` values when the endpoint is of Interface type\r\n\r\n## Motivation and Context\r\nWhen defining a VPC endpoint of type Interface, if no `security_group_ids` are defined either as defaults or in the individual endpoint definition, the value passed to the `aws_vpc_endpoint` resource is an empty list.\r\n\r\nThis PR modifies that behaviour so that if no `security_group_ids` are defined, the `aws_vpc_endpoint` receives a `null` value instead of an empty list. Semantically, it makes no difference and it causes the default security group to be associated with the endpoint. However, functionally, a `null` value enables the use of `aws_vpc_endpoint_security_group_association` resources without triggering changes on the `aws_vpc_endpoint` resource.\r\n\r\n## How Has This Been Tested?\r\nI have tested this changes against an environment where the side effects that this change addresses were occuring\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/main.tf\n@@ -26,7 +26,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? length(distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", [])))) > 0 ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null : null\n subnet_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", null)\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/main.tf\n@@ -26,7 +26,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? length(distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", [])))) > 0 ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null : null\n lookup(each.value, = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", null)\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/main.tf\n@@ -26,7 +26,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids lookup(each.value, = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? length(distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", [])))) > 0 ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null : null\n subnet_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", null)\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/main.tf\n@@ -26,7 +26,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? length(distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", [])))) > 0 ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null : null\n subnet_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", null)\n---\n\n\n---\n" } ]
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\nTransit gateway is used to connect many vpcs from same and across many accounts. So Transit gateway creation can be different module but we need a way to attach the newly created VPCs to Transit Gateway.\r\n\r\n## Motivation and Context\r\nHere I am attaching the VPC to given Transit Gateway when `attach_tgw` is `true`. Also creating routes in private route table when `tgw_destination_cidrs` is provided. I chose private subnets(its route tables) as default for attaching with Transit Gateway because public subnets mostly used for proxy/loadbalancer and private subnets mostly used for running applications (those applications might require to communicate other resources in another VPC internally via transit gateway). \n\n---\n\nChoice A:\nREADME.md\n@@ -177,6 +177,16 @@ Sometimes it is handy to have public access +1242,28 Redshift clusters (for example if\n enable_public_redshift = true # <= By default Redshift subnets will be associated with the private route table\n ```\n \n+## Transit Gateway (TGW) Attachment\n+\n+It is possible to [attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_vpc_attachment) the VPC with provided Transit Gateway by specifying these arguments:\n+\n+```hcl\n+attach_tgw = true\n+tgw_id = \"tgw-0ert3456s7d7\"\n+tgw_destination_cidrs = [\"10.70.0.0/16\", \"10.71.0.0/16\"]\n+```\n+\n ## Transit Gateway (TGW) integration\n \n It is possible to integrate this VPC module with [terraform-aws-transit-gateway module](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway) which handles the creation of TGW resources and VPC attachments. See [complete example there](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway/tree/master/examples/complete).\n@@ -466,6 +476,9 @@ No modules.\n | <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_attach_tgw\"></a> [attach\\_tgw](#input\\_attach\\_tgw) | Indicates whether we need to attach the VPC to Transit Gateway. It requires the fields tgw\\_id and tgw\\_destination\\_cidrs | `bool` | `false` | no |\n+| <a name=\"input_tgw\\_id\"></a> [tgw\\_id](#input\\_tgw\\_id) | Transit Gateway ID where VPC will be attached | `string` | `null` | no |\n+| <a name=\"input_tgw\\_destination\\_cidrs\"></a> [tgw\\_destination\\_cidrs](#input\\_tgw\\_destination\\_cidrs) | Destination CIDR blocks to connect via Transit Gateway | `list(string)` | `[]` | no |\n | <a name=\"input_vpc_flow_log_permissions_boundary\"></a> [vpc\\_flow\\_log\\_permissions\\_boundary](#input\\_vpc\\_flow\\_log\\_permissions\\_boundary) | The ARN of the Permissions Boundary for the VPC Flow Log IAM Role | `string` | `null` | no |\n | <a name=\"input_vpc_flow_log_tags\"></a> [vpc\\_flow\\_log\\_tags](#input\\_vpc\\_flow\\_log\\_tags) | Additional tags for the VPC Flow Logs | `map(string)` | `{}` | no |\n | <a name=\"input_vpc_tags\"></a> [vpc\\_tags](#input\\_vpc\\_tags) | Additional tags for the VPC | `map(string)` | `{}` | no |\n---\nmain.tf\n@@ -1242,3 +1242,28 @@ resource \"aws_default_vpc\" \"this\" {\n var.default_vpc_tags,\n )\n }\n+\n+################################################################################\n+# Transit Gateway Attachment\n+################################################################################\n+\n+resource \"aws_ec2_transit_gateway_vpc_attachment\" \"this\" {\n+ count = local.create_vpc && var.attach_tgw && length(var.private_subnets) > 0 ? 1 : 0\n+\n+ subnet_ids = aws_subnet.private[*].id\n+ transit_gateway_id = var.tgw_id\n+ vpc_id = aws_vpc.this[0].id\n+}\n+\n+resource \"aws_route\" \"private_routes\" {\n+ for_each = {\n+ for pair in setproduct(aws_route_table.private[*].id, var.tgw_destination_cidrs) : \"${pair[0]} ${pair[1]}\" => {\n+ route_table_id = pair[0]\n+ destination_cidr_block = pair[1]\n+ }\n+ }\n+\n+ route_table_id = each.value.route_table_id\n+ destination_cidr_block = each.value.destination_cidr_block\n+ transit_gateway_id = var.tgw_id\n+}\n---\nvariables.tf\n@@ -1192,3 +1192,21 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"attach_tgw\" {\n+ description = \"(Optional) Indicates whether we need to attach the VPC with Transit Gateway\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"tgw_id\" {\n+ description = \"(Optional) Transit Gateway ID where VPC will be attached\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"tgw_destination_cidrs\" {\n+ description = \"(Optional) Destination CIDR blocks to connect via Transit Gateway\"\n+ type = list(string)\n+ default = []\n+}\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -177,6 +177,16 @@ Sometimes it is handy to have public access to Redshift clusters (for example if\n enable_public_redshift = true # <= By default Redshift subnets will be associated with the private route table\n ```\n \n+## Transit Gateway (TGW) Attachment\n+\n+It is possible to [attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_vpc_attachment) the VPC with provided Transit Gateway by specifying these arguments:\n+\n+```hcl\n+attach_tgw = true\n+tgw_id = \"tgw-0ert3456s7d7\"\n+tgw_destination_cidrs = [\"10.70.0.0/16\", \"10.71.0.0/16\"]\n+```\n+\n ## Transit Gateway (TGW) integration\n \n It is possible to integrate this VPC module with [terraform-aws-transit-gateway module](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway) which handles the creation of TGW resources and VPC attachments. See [complete example there](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway/tree/master/examples/complete).\n@@ -466,6 +476,9 @@ No modules.\n | <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_attach_tgw\"></a> [attach\\_tgw](#input\\_attach\\_tgw) | Indicates whether we need to attach the VPC to Transit Gateway. It requires the fields tgw\\_id and tgw\\_destination\\_cidrs | `bool` | `false` | no |\n+| <a name=\"input_tgw\\_id\"></a> [tgw\\_id](#input\\_tgw\\_id) | Transit Gateway ID where VPC will be attached | `string` | `null` | no |\n+| <a name=\"input_tgw\\_destination\\_cidrs\"></a> [tgw\\_destination\\_cidrs](#input\\_tgw\\_destination\\_cidrs) | Destination CIDR blocks to connect via Transit Gateway | `list(string)` | `[]` | no |\n | <a name=\"input_vpc_flow_log_permissions_boundary\"></a> [vpc\\_flow\\_log\\_permissions\\_boundary](#input\\_vpc\\_flow\\_log\\_permissions\\_boundary) | The ARN of the Permissions Boundary for the VPC Flow Log IAM Role | `string` | `null` | no |\n | <a name=\"input_vpc_flow_log_tags\"></a> [vpc\\_flow\\_log\\_tags](#input\\_vpc\\_flow\\_log\\_tags) | Additional tags for the VPC Flow Logs | `map(string)` | `{}` | no |\n | <a of [vpc\\_tags](#input\\_vpc\\_tags) | Additional tags for the VPC | `map(string)` | `{}` | no |\n---\nmain.tf\n@@ -1242,3 +1242,28 @@ resource \"aws_default_vpc\" \"this\" {\n var.default_vpc_tags,\n )\n }\n+\n+################################################################################\n+# Transit Gateway Attachment\n+################################################################################\n+\n+resource \"aws_ec2_transit_gateway_vpc_attachment\" \"this\" {\n+ count = local.create_vpc && var.attach_tgw && length(var.private_subnets) > 0 ? 1 : 0\n+\n+ subnet_ids = aws_subnet.private[*].id\n+ transit_gateway_id = var.tgw_id\n+ vpc_id = aws_vpc.this[0].id\n+}\n+\n+resource \"aws_route\" \"private_routes\" {\n+ for_each = {\n+ for pair in setproduct(aws_route_table.private[*].id, var.tgw_destination_cidrs) : \"${pair[0]} ${pair[1]}\" => {\n+ route_table_id = pair[0]\n+ destination_cidr_block = pair[1]\n+ }\n+ }\n+\n+ route_table_id = each.value.route_table_id\n+ destination_cidr_block = each.value.destination_cidr_block\n+ transit_gateway_id = var.tgw_id\n+}\n---\nvariables.tf\n@@ -1192,3 +1192,21 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"attach_tgw\" {\n+ description = \"(Optional) Indicates whether we need to attach the VPC with Transit Gateway\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"tgw_id\" {\n+ description = \"(Optional) Transit Gateway ID where VPC will be attached\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"tgw_destination_cidrs\" {\n+ description = \"(Optional) Destination CIDR blocks to connect via Transit Gateway\"\n+ type = list(string)\n+ default = []\n+}\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -177,6 +177,16 @@ Sometimes it is handy to have public access to Redshift clusters (for example if\n enable_public_redshift = true # <= By default Redshift subnets will be associated with the private route table\n ```\n \n+## Transit Gateway (TGW) Attachment\n+\n+It is possible to [attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_vpc_attachment) the VPC with provided Transit Gateway by specifying these arguments:\n+\n+```hcl\n+attach_tgw = true\n+tgw_id = \"tgw-0ert3456s7d7\"\n+tgw_destination_cidrs = [\"10.70.0.0/16\", \"10.71.0.0/16\"]\n+```\n+\n ## Transit Gateway (TGW) integration\n \n It is possible to integrate this VPC module with [terraform-aws-transit-gateway module](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway) which handles the creation of TGW resources and VPC attachments. See [complete example there](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway/tree/master/examples/complete).\n@@ -466,6 +476,9 @@ No modules.\n | <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_attach_tgw\"></a> [attach\\_tgw](#input\\_attach\\_tgw) | Indicates whether we need to attach the VPC to Transit Gateway. It requires the fields tgw\\_id and tgw\\_destination\\_cidrs | `bool` | `false` | no |\n+| <a name=\"input_tgw\\_id\"></a> [tgw\\_id](#input\\_tgw\\_id) | Transit Gateway ID where VPC will be attached | `string` | `null` | no |\n+| <a name=\"input_tgw\\_destination\\_cidrs\"></a> [tgw\\_destination\\_cidrs](#input\\_tgw\\_destination\\_cidrs) | Destination CIDR blocks to connect via Transit Gateway | `list(string)` | `[]` | no |\n | <a name=\"input_vpc_flow_log_permissions_boundary\"></a> [vpc\\_flow\\_log\\_permissions\\_boundary](#input\\_vpc\\_flow\\_log\\_permissions\\_boundary) | The ARN of the Permissions Boundary for the VPC Flow Log IAM Role | `string` | `null` | no |\n | <a name=\"input_vpc_flow_log_tags\"></a> [vpc\\_flow\\_log\\_tags](#input\\_vpc\\_flow\\_log\\_tags) | Additional tags for the VPC Flow Logs | `map(string)` | `{}` | no |\n | <a name=\"input_vpc_tags\"></a> [vpc\\_tags](#input\\_vpc\\_tags) | Additional tags for the VPC | `map(string)` | `{}` | no |\n---\nmain.tf\n@@ -1242,3 +1242,28 @@ resource \"aws_default_vpc\" \"this\" {\n var.default_vpc_tags,\n )\n }\n+\n+################################################################################\n+# Transit Gateway Attachment\n+################################################################################\n+\n+resource \"aws_ec2_transit_gateway_vpc_attachment\" \"this\" {\n+ count = local.create_vpc && var.attach_tgw && length(var.private_subnets) > 0 ? 1 : 0\n+\n+ subnet_ids = aws_subnet.private[*].id\n+ transit_gateway_id = var.tgw_id\n+ vpc_id = aws_vpc.this[0].id\n+}\n+\n+resource \"aws_route\" \"private_routes\" {\n+ for_each = {\n+ for pair in setproduct(aws_route_table.private[*].id, var.tgw_destination_cidrs) : \"${pair[0]} ${pair[1]}\" => {\n+ route_table_id = pair[0]\n+ destination_cidr_block = pair[1]\n+ }\n+ }\n+\n+ route_table_id = each.value.route_table_id\n+ destination_cidr_block = each.value.destination_cidr_block\n+ transit_gateway_id = var.tgw_id\n+}\n---\nvariables.tf\n@@ -1192,3 +1192,21 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"attach_tgw\" {\n+ description = \"(Optional) Indicates whether we need to attach the VPC with Transit Gateway\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"tgw_id\" {\n+ description = \"(Optional) Transit Gateway ID where VPC will be attached\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"tgw_destination_cidrs\" {\n+ description = \"(Optional) Destination CIDR blocks to connect via Transit Gateway\"\n+ type = list(string)\n+ default = []\n+}\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -177,6 +177,16 @@ Sometimes it is handy to have public access to Redshift clusters (for example if\n enable_public_redshift = true # <= By default Redshift subnets will be associated with the private route table\n ```\n \n+## Transit Gateway (TGW) Attachment\n+\n+It is possible to [attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_vpc_attachment) the VPC with provided Transit Gateway by specifying these arguments:\n+\n+```hcl\n+attach_tgw = true\n+tgw_id = \"tgw-0ert3456s7d7\"\n+tgw_destination_cidrs = [\"10.70.0.0/16\", \"10.71.0.0/16\"]\n+```\n+\n ## Transit Gateway (TGW) integration\n \n It is possible to integrate this VPC module with [terraform-aws-transit-gateway module](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway) which handles the creation of TGW resources and VPC attachments. See [complete example there](https://github.com/terraform-aws-modules/terraform-aws-transit-gateway/tree/master/examples/complete).\n@@ -466,6 +476,9 @@ No modules.\n | <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_attach_tgw\"></a> [attach\\_tgw](#input\\_attach\\_tgw) | Indicates whether we need to attach the VPC to Transit Gateway. It requires the fields tgw\\_id and tgw\\_destination\\_cidrs | `bool` | `false` | no |\n+| <a name=\"input_tgw\\_id\"></a> [tgw\\_id](#input\\_tgw\\_id) | Transit Gateway ID where VPC will be attached | `string` | `null` | no |\n+| <a name=\"input_tgw\\_destination\\_cidrs\"></a> [tgw\\_destination\\_cidrs](#input\\_tgw\\_destination\\_cidrs) | Destination CIDR blocks to connect via Transit Gateway | `list(string)` | `[]` | no |\n | <a name=\"input_vpc_flow_log_permissions_boundary\"></a> [vpc\\_flow\\_log\\_permissions\\_boundary](#input\\_vpc\\_flow\\_log\\_permissions\\_boundary) | The ARN of the Permissions Boundary for the VPC Flow Log IAM Role | `string` | `null` | no |\n | <a name=\"input_vpc_flow_log_tags\"></a> [vpc\\_flow\\_log\\_tags](#input\\_vpc\\_flow\\_log\\_tags) | Additional tags for the VPC Flow Logs | `map(string)` | `{}` | no |\n | <a name=\"input_vpc_tags\"></a> [vpc\\_tags](#input\\_vpc\\_tags) | Additional tags for the VPC | `map(string)` | `{}` | no |\n---\nmain.tf\n@@ -1242,3 +1242,28 @@ resource \"aws_default_vpc\" \"this\" {\n var.default_vpc_tags,\n )\n }\n+\n+################################################################################\n+# Transit Gateway Attachment\n+################################################################################\n+\n+resource \"aws_ec2_transit_gateway_vpc_attachment\" \"this\" {\n+ count = local.create_vpc && var.attach_tgw && length(var.private_subnets) > 0 ? 1 : 0\n+\n+ subnet_ids = aws_subnet.private[*].id\n+ transit_gateway_id = var.tgw_id\n+ vpc_id = aws_vpc.this[0].id\n+}\n+\n+resource \"aws_route\" \"private_routes\" {\n+ for_each = {\n+ for pair in setproduct(aws_route_table.private[*].id, var.tgw_destination_cidrs) : \"${pair[0]} ${pair[1]}\" => {\n+ route_table_id = pair[0]\n+ destination_cidr_block = pair[1]\n+ }\n+ }\n+\n+ route_table_id = each.value.route_table_id\n+ destination_cidr_block = each.value.destination_cidr_block\n+ transit_gateway_id = var.tgw_id\n+}\n---\nvariables.tf\n@@ -1192,3 +1192,21 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"attach_tgw\" {\n+ description = \"(Optional) Indicates whether we need to attach the VPC with Transit Gateway\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"tgw_id\" {\n+ description = \"(Optional) Transit Gateway ID where VPC will be attached\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"tgw_destination_cidrs\" {\n+ description = \"(Optional) Destination CIDR blocks to connect via Transit Gateway\"\n+ type = list(string)\n+ default = []\n+}\n---\n\n\n---\n" } ]
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@@ -183,7 +183,7 @@ resource \"aws_default_route_table\" \"default\" {\n }\n \n ################################################################################\n-# Publiс routes\n+# Public routes\n ################################################################################\n \n resource \"aws_route_table\" \"public\" {\n@@ -429,10 +429,10 @@ resource \"aws_subnet\" resource {\n }\n \n ################################################################################\n-# Database subnet\n+# Reference\n ################################################################################\n \n-resource \"aws_subnet\" \"database\" {\n+resource \"aws_subnet\" \"database priya\" {\n count = local.create_vpc && length(var.database_subnets) > 0 ? length(var.database_subnets) : 0\n \n vpc_id = local.vpc_id\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -183,7 +183,7 @@ resource \"aws_default_route_table\" \"default\" {\n }\n \n ################################################################################\n-# Publiс routes\n+# Public routes\n ################################################################################\n \n resource \"aws_route_table\" \"public\" {\n@@ -429,10 +429,10 @@ resource \"aws_subnet\" \"outpost\" {\n }\n \n ################################################################################\n-# Database subnet\n+# Reference\n ################################################################################\n \n-resource \"aws_subnet\" \"database\" {\n+resource \"aws_subnet\" \"database priya\" {\n count = local.create_vpc && length(var.database_subnets) > 0 ? length(var.database_subnets) : 0\n \n vpc_id = \n\n---\n\nChoice C:\nmain.tf\n@@ -183,7 +183,7 @@ resource \"aws_default_route_table\" \"default\" {\n }\n \n ################################################################################\n-# Publiс routes\n+# Public routes\n ################################################################################\n \n resource \"aws_route_table\" \"public\" {\n@@ -429,10 +429,10 @@ resource \"aws_subnet\" \"outpost\" {\n }\n ################################################################################\n-# ################################################################################\n-# Database subnet\n+# Reference\n ################################################################################\n \n-resource \"aws_subnet\" \"database\" {\n+resource \"aws_subnet\" \"database priya\" {\n count = local.create_vpc && length(var.database_subnets) > 0 ? length(var.database_subnets) : 0\n \n vpc_id = local.vpc_id\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -183,7 +183,7 @@ resource \"aws_default_route_table\" \"default\" {\n }\n \n ################################################################################\n-# Publiс routes\n+# Public routes\n ################################################################################\n \n resource \"aws_route_table\" \"public\" {\n@@ -429,10 +429,10 @@ resource \"aws_subnet\" \"outpost\" {\n }\n \n ################################################################################\n-# Database subnet\n+# Reference\n ################################################################################\n \n-resource \"aws_subnet\" \"database\" {\n+resource \"aws_subnet\" \"database priya\" {\n count = local.create_vpc && length(var.database_subnets) > 0 ? length(var.database_subnets) : 0\n \n vpc_id = local.vpc_id\n---\n\n\n---\n" } ]
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\nadd output for nat_gateway public ips\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:\noutputs.tf\n@@ -353,6 +353,10 @@ output \"natgw_ids\" {\n value = aws_nat_gateway.this[*].id\n }\n \n+output \"natgw_public_ips\" {\n+ description = \"List of NAT Gateway Public IPs\"\n+ value = aws_nat_gateway.this[*].public_ip\n+}\n output \"igw_id\" {\n description = \"The ID of the Internet Gateway\"\n value = try(aws_internet_gateway.this[0].id, \"\")\n---\n\n\n---\n\nChoice B:\noutputs.tf\n@@ -353,6 +353,10 @@ output \"natgw_ids\" {\n value = aws_nat_gateway.this[*].id\n }\n \n+output \"natgw_public_ips\" {\n+ description = \"List of NAT Gateway Public IPs\"\n+ value = aws_nat_gateway.this[*].public_ip\n+}\n output \"igw_id\" {\n description = \"The ID of the Internet Gateway\"\n value = try(aws_internet_gateway.this[0].id, \"\")\n---\n\n\n---\n\nChoice C:\noutputs.tf\n@@ -353,6 +353,10 @@ output \"natgw_ids\" {\n value = aws_nat_gateway.this[*].id\n }\n \n+output \"natgw_public_ips\" {\n+ description = \"List of NAT Gateway Public IPs\"\n+ value = aws_nat_gateway.this[*].public_ip\n+}\n output \"igw_id\" {\n description = \"The ID of the Internet Gateway\"\n value = try(aws_internet_gateway.this[0].id, \"\")\n---\n\n\n---\n\nChoice D:\noutputs.tf\n@@ -353,6 +353,10 @@ output \"natgw_ids\" {\n value = aws_nat_gateway.this[*].id\n }\n \n+output \"natgw_public_ips\" {\n+ description = \"List of NAT Gateway Public IPs\"\n+ value Gateway = aws_nat_gateway.this[*].public_ip\n+}\n output \"igw_id\" {\n description = \"The ID of the Internet Gateway\"\n value = try(aws_internet_gateway.this[0].id, \"\")\n---\n\n\n---\n" } ]
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\nIn the outputs for this module, I have changed cgw_ids and cgw_arns to be maps instead of lists. This is due to issue - \r\n[765](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/765#issue-1165166357) Where the user explains you pass in a map and a list is output. The `customer_gateways` input, if changed will cause issues with the ordering of the cgw_ids and cgw_arns a map would resolve the issue with ordering changes.\r\n\r\n## Motivation and Context\r\nSolving the following issue - \r\n[765](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/765#issue-1165166357) \r\n\r\n## Breaking Changes\r\nThis will mean everyone who uses this module will need to adapt how they refer to the following outputs\r\n- cgw_ids\r\n- cgw_arns\r\n\r\n## How Has This Been Tested?\r\nlocally with commit hooks and planning the simple-vpc\r\n- [x] I have executed `pre-commit run -a` on my pull request\n\n---\n\nChoice A:\nREADME.md\n@@ -478,8 +478,8 @@ No modules.\n | Name | Description |\n |------|-------------|\n | <a name=\"output_azs\"></a> [azs](#output\\_azs) | A list of availability zones specified as argument to this module |\n-| <a name=\"output_cgw_arns\"></a> [cgw\\_arns](#output\\_cgw\\_arns) | List of ARNs of Customer Gateway |\n-| <a name=\"output_cgw_ids\"></a> [cgw\\_ids](#output\\_cgw\\_ids) | List of IDs of Customer Gateway |\n+| <a name=\"output_cgw_arns\"></a> [cgw\\_arns](#output\\_cgw\\_arns) | Map of ARNs of Customer Gateway |\n+| <a name=\"output_cgw_ids\"></a> [cgw\\_ids](#output\\_cgw\\_ids) | List of ARNs of Customer Gateway |\n | <a name=\"output_database_internet_gateway_route_id\"></a> [database\\_internet\\_gateway\\_route\\_id](#output\\_database\\_internet\\_gateway\\_route\\_id) | ID of the database internet gateway route |\n | <a name=\"output_database_ipv6_egress_route_id\"></a> [database\\_ipv6\\_egress\\_route\\_id](#output\\_database\\_ipv6\\_egress\\_route\\_id) | ID of the database IPv6 egress route |\n | <a name=\"output_database_nat_gateway_route_ids\"></a> [database\\_nat\\_gateway\\_route\\_ids](#output\\_database\\_nat\\_gateway\\_route\\_ids) | List of IDs of the database nat gateway route |\n@@ -507,7 +507,7 @@ No modules.\n | <a name=\"output_default_vpc_instance_tenancy\"></a> [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | <a name=\"output_default_vpc_main_route_table_id\"></a> [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n | <a name=\"output_dhcp_options_id\"></a> [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n-| <a name=\"output_egress_only_internet_gateway_id\"></a> [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n+| <a name=\"output_egress_only_internet_gateway_id\"></a> [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | List of IDs of Customer Gateway |\n | <a name=\"output_elasticache_network_acl_arn\"></a> [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | <a name=\"output_elasticache_network_acl_id\"></a> [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n | <a name=\"output_elasticache_route_table_association_ids\"></a> [elasticache\\_route\\_table\\_association\\_ids](#output\\_elasticache\\_route\\_table\\_association\\_ids) | List of IDs of the elasticache route table association |\n@@ -568,7 +568,7 @@ No modules.\n | <a name=\"output_redshift_subnets\"></a> [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of redshift subnets |\n | <a name=\"output_redshift_subnets_cidr_blocks\"></a> [redshift\\_subnets\\_cidr\\_blocks](#output\\_redshift\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of redshift subnets |\n | <a name=\"output_redshift_subnets_ipv6_cidr_blocks\"></a> description | List of IPv6 cidr\\_blocks of redshift subnets in an IPv6 enabled VPC |\n-| <a name=\"output_this_customer_gateway\"></a> [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of Customer Gateway attributes |\n+| <a name=\"output_this_customer_gateway\"></a> [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of attribute maps for all customer gateways created |\n | <a name=\"output_vgw_arn\"></a> [vgw\\_arn](#output\\_vgw\\_arn) | The ARN of the VPN Gateway |\n | <a name=\"output_vgw_id\"></a> [vgw\\_id](#output\\_vgw\\_id) | The ID of the VPN Gateway |\n | <a name=\"output_vpc_arn\"></a> [vpc\\_arn](#output\\_vpc\\_arn) | The ARN of the VPC |\n---\noutputs.tf\n@@ -364,22 +364,22 @@ output \"igw_arn\" {\n }\n \n output \"egress_only_internet_gateway_id\" {\n- description = \"The ID of the egress only Internet Gateway\"\n+ description = \"List of IDs of Customer Gateway\"\n value = try(aws_egress_only_internet_gateway.this[0].id, \"\")\n }\n \n output \"cgw_ids\" {\n- description = \"List of IDs of Customer Gateway\"\n+ description = \"List of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.id]\n }\n \n output \"cgw_arns\" {\n- description = \"List of ARNs of Customer Gateway\"\n+ description = \"Map of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.arn]\n }\n \n output \"this_customer_gateway\" {\n- description = \"Map of Customer Gateway attributes\"\n+ description = \"Map of attribute maps for all customer gateways created\"\n value = aws_customer_gateway.this\n }\n \n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -478,8 +478,8 @@ No modules.\n | Name | Description |\n |------|-------------|\n | <a name=\"output_azs\"></a> [azs](#output\\_azs) | A list of availability zones specified as argument to this module |\n-| <a name=\"output_cgw_arns\"></a> [cgw\\_arns](#output\\_cgw\\_arns) | List of ARNs of Customer Gateway |\n-| <a name=\"output_cgw_ids\"></a> [cgw\\_ids](#output\\_cgw\\_ids) | List of IDs of Customer Gateway |\n+| <a name=\"output_cgw_arns\"></a> [cgw\\_arns](#output\\_cgw\\_arns) | Map of ARNs of Customer Gateway |\n+| <a name=\"output_cgw_ids\"></a> [cgw\\_ids](#output\\_cgw\\_ids) | List of ARNs of Customer Gateway |\n | <a name=\"output_database_internet_gateway_route_id\"></a> [database\\_internet\\_gateway\\_route\\_id](#output\\_database\\_internet\\_gateway\\_route\\_id) | ID of the database internet gateway route |\n | <a name=\"output_database_ipv6_egress_route_id\"></a> [database\\_ipv6\\_egress\\_route\\_id](#output\\_database\\_ipv6\\_egress\\_route\\_id) | ID of the database IPv6 egress route |\n | <a name=\"output_database_nat_gateway_route_ids\"></a> [database\\_nat\\_gateway\\_route\\_ids](#output\\_database\\_nat\\_gateway\\_route\\_ids) | List of IDs of the database nat gateway route |\n@@ -507,7 +507,7 @@ No modules.\n | <a name=\"output_default_vpc_instance_tenancy\"></a> [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | <a name=\"output_default_vpc_main_route_table_id\"></a> [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n | <a name=\"output_dhcp_options_id\"></a> [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n-| <a name=\"output_egress_only_internet_gateway_id\"></a> [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n+| <a name=\"output_egress_only_internet_gateway_id\"></a> [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | List of IDs of Customer Gateway |\n | <a name=\"output_elasticache_network_acl_arn\"></a> [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | <a name=\"output_elasticache_network_acl_id\"></a> [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n | <a name=\"output_elasticache_route_table_association_ids\"></a> [elasticache\\_route\\_table\\_association\\_ids](#output\\_elasticache\\_route\\_table\\_association\\_ids) | List of IDs of the elasticache route table association |\n@@ -568,7 +568,7 @@ No modules.\n | <a name=\"output_redshift_subnets\"></a> [redshift\\_subnets](#output\\_redshift\\_subnets) [cgw\\_ids](#output\\_cgw\\_ids) List of IDs of redshift subnets |\n | <a name=\"output_redshift_subnets_cidr_blocks\"></a> [redshift\\_subnets\\_cidr\\_blocks](#output\\_redshift\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of redshift subnets |\n | <a name=\"output_redshift_subnets_ipv6_cidr_blocks\"></a> [redshift\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_redshift\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of redshift subnets in an IPv6 enabled VPC |\n-| <a name=\"output_this_customer_gateway\"></a> [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of Customer Gateway attributes |\n+| <a name=\"output_this_customer_gateway\"></a> [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of attribute maps for all customer gateways created |\n | <a name=\"output_vgw_arn\"></a> [vgw\\_arn](#output\\_vgw\\_arn) | The ARN of the VPN Gateway |\n | <a name=\"output_vgw_id\"></a> [vgw\\_id](#output\\_vgw\\_id) | The ID of the VPN Gateway |\n | <a name=\"output_vpc_arn\"></a> [vpc\\_arn](#output\\_vpc\\_arn) | The ARN of the VPC |\n---\noutputs.tf\n@@ -364,22 +364,22 @@ output \"igw_arn\" {\n }\n \n output \"egress_only_internet_gateway_id\" {\n- description = \"The ID of the egress only Internet Gateway\"\n+ description = \"List of IDs of Customer Gateway\"\n value = try(aws_egress_only_internet_gateway.this[0].id, \"\")\n }\n \n output \"cgw_ids\" {\n- description = \"List of IDs of Customer Gateway\"\n+ description = \"List of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.id]\n }\n \n output \"cgw_arns\" {\n- description = \"List of ARNs of Customer Gateway\"\n+ description = \"Map of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.arn]\n }\n \n output \"this_customer_gateway\" {\n- description = \"Map of Customer Gateway attributes\"\n+ description = \"Map of attribute maps for all customer gateways created\"\n value = aws_customer_gateway.this\n }\n \n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -478,8 +478,8 @@ No modules.\n | Name | Description |\n |------|-------------|\n | <a name=\"output_azs\"></a> [azs](#output\\_azs) | A list of availability zones specified as argument to this module |\n-| <a name=\"output_cgw_arns\"></a> [cgw\\_arns](#output\\_cgw\\_arns) | List of ARNs of Customer Gateway |\n-| <a name=\"output_cgw_ids\"></a> [cgw\\_ids](#output\\_cgw\\_ids) | List of IDs of Customer Gateway |\n+| <a name=\"output_cgw_arns\"></a> [cgw\\_arns](#output\\_cgw\\_arns) | Map of ARNs of Customer Gateway |\n+| <a name=\"output_cgw_ids\"></a> [cgw\\_ids](#output\\_cgw\\_ids) | List of ARNs of Customer Gateway |\n | <a name=\"output_database_internet_gateway_route_id\"></a> [database\\_internet\\_gateway\\_route\\_id](#output\\_database\\_internet\\_gateway\\_route\\_id) | ID of the database internet gateway route |\n | <a name=\"output_database_ipv6_egress_route_id\"></a> [database\\_ipv6\\_egress\\_route\\_id](#output\\_database\\_ipv6\\_egress\\_route\\_id) | ID of the database IPv6 egress route |\n | <a name=\"output_database_nat_gateway_route_ids\"></a> [database\\_nat\\_gateway\\_route\\_ids](#output\\_database\\_nat\\_gateway\\_route\\_ids) | List of IDs of the database nat gateway route |\n@@ -507,7 +507,7 @@ No modules.\n | <a name=\"output_default_vpc_instance_tenancy\"></a> [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | <a name=\"output_default_vpc_main_route_table_id\"></a> [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n | <a name=\"output_dhcp_options_id\"></a> [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n-| <a name=\"output_egress_only_internet_gateway_id\"></a> [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n+| <a name=\"output_egress_only_internet_gateway_id\"></a> [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | List of IDs of Customer Gateway |\n | <a name=\"output_elasticache_network_acl_arn\"></a> [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | <a name=\"output_elasticache_network_acl_id\"></a> [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n | <a name=\"output_elasticache_route_table_association_ids\"></a> [elasticache\\_route\\_table\\_association\\_ids](#output\\_elasticache\\_route\\_table\\_association\\_ids) | List of IDs of the elasticache route table association |\n@@ -568,7 +568,7 @@ No modules.\n | <a name=\"output_redshift_subnets\"></a> [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of redshift subnets |\n | <a name=\"output_redshift_subnets_cidr_blocks\"></a> [redshift\\_subnets\\_cidr\\_blocks](#output\\_redshift\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of redshift subnets |\n | <a name=\"output_redshift_subnets_ipv6_cidr_blocks\"></a> [redshift\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_redshift\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of redshift subnets in an IPv6 enabled VPC |\n-| <a name=\"output_this_customer_gateway\"></a> [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of Customer Gateway attributes |\n+| <a name=\"output_this_customer_gateway\"></a> [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of attribute maps for all customer gateways created |\n | <a name=\"output_vgw_arn\"></a> [vgw\\_arn](#output\\_vgw\\_arn) | The ARN of the VPN Gateway |\n | <a name=\"output_vgw_id\"></a> [vgw\\_id](#output\\_vgw\\_id) | The ID of the VPN Gateway |\n | <a name=\"output_vpc_arn\"></a> [vpc\\_arn](#output\\_vpc\\_arn) | The ARN of the VPC |\n---\noutputs.tf\n@@ -364,22 +364,22 @@ output \"igw_arn\" {\n }\n \n output \"egress_only_internet_gateway_id\" {\n- description = \"The ID of the egress only Internet Gateway\"\n+ description = \"List of IDs of Customer Gateway\"\n value = try(aws_egress_only_internet_gateway.this[0].id, \"\")\n }\n \n output \"cgw_ids\" {\n- description = \"List of IDs of Customer Gateway\"\n+ description = \"List of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.id]\n }\n \n output \"cgw_arns\" {\n- description = \"List of ARNs of Customer Gateway\"\n+ description = \"Map of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.arn]\n }\n \n output \"this_customer_gateway\" {\n- description = \"Map of Customer Gateway attributes\"\n+ description = \"Map of attribute maps for all customer gateways created\"\n value = aws_customer_gateway.this\n }\n \n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -478,8 +478,8 @@ No modules.\n | Name | Description |\n |------|-------------|\n | <a name=\"output_azs\"></a> [azs](#output\\_azs) | A list of availability zones specified as argument to this module |\n-| <a name=\"output_cgw_arns\"></a> [cgw\\_arns](#output\\_cgw\\_arns) | List of ARNs of Customer Gateway |\n-| <a name=\"output_cgw_ids\"></a> [cgw\\_ids](#output\\_cgw\\_ids) | List of IDs of Customer Gateway |\n+| <a name=\"output_cgw_arns\"></a> [cgw\\_arns](#output\\_cgw\\_arns) | Map of \"List of Customer Gateway |\n+| <a name=\"output_cgw_ids\"></a> [cgw\\_ids](#output\\_cgw\\_ids) | List of ARNs of Customer Gateway |\n | <a name=\"output_database_internet_gateway_route_id\"></a> [database\\_internet\\_gateway\\_route\\_id](#output\\_database\\_internet\\_gateway\\_route\\_id) | ID of the database internet gateway route |\n | <a name=\"output_database_ipv6_egress_route_id\"></a> [database\\_ipv6\\_egress\\_route\\_id](#output\\_database\\_ipv6\\_egress\\_route\\_id) | ID of the database IPv6 egress route |\n | <a name=\"output_database_nat_gateway_route_ids\"></a> [database\\_nat\\_gateway\\_route\\_ids](#output\\_database\\_nat\\_gateway\\_route\\_ids) | List of IDs of the database nat gateway route |\n@@ -507,7 +507,7 @@ No modules.\n | <a name=\"output_default_vpc_instance_tenancy\"></a> [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | <a name=\"output_default_vpc_main_route_table_id\"></a> [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n | <a name=\"output_dhcp_options_id\"></a> [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n-| <a name=\"output_egress_only_internet_gateway_id\"></a> [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n+| <a name=\"output_egress_only_internet_gateway_id\"></a> [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | List of IDs of Customer Gateway |\n | <a name=\"output_elasticache_network_acl_arn\"></a> [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | <a name=\"output_elasticache_network_acl_id\"></a> [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n | <a name=\"output_elasticache_route_table_association_ids\"></a> [elasticache\\_route\\_table\\_association\\_ids](#output\\_elasticache\\_route\\_table\\_association\\_ids) | List of IDs of the elasticache route table association |\n@@ -568,7 +568,7 @@ No modules.\n | <a name=\"output_redshift_subnets\"></a> [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of redshift subnets |\n | <a name=\"output_redshift_subnets_cidr_blocks\"></a> [redshift\\_subnets\\_cidr\\_blocks](#output\\_redshift\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of redshift subnets |\n | <a name=\"output_redshift_subnets_ipv6_cidr_blocks\"></a> [redshift\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_redshift\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of redshift subnets in an IPv6 enabled VPC |\n-| <a name=\"output_this_customer_gateway\"></a> [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of Customer Gateway attributes |\n+| <a name=\"output_this_customer_gateway\"></a> [this\\_customer\\_gateway](#output\\_this\\_customer\\_gateway) | Map of attribute maps for all customer gateways created |\n | <a name=\"output_vgw_arn\"></a> [vgw\\_arn](#output\\_vgw\\_arn) | The ARN of the VPN Gateway |\n | <a name=\"output_vgw_id\"></a> [vgw\\_id](#output\\_vgw\\_id) | The ID of the VPN Gateway |\n | <a name=\"output_vpc_arn\"></a> [vpc\\_arn](#output\\_vpc\\_arn) | The ARN of the VPC |\n---\noutputs.tf\n@@ -364,22 +364,22 @@ output \"igw_arn\" {\n }\n \n output \"egress_only_internet_gateway_id\" {\n- description = \"The ID of the egress only Internet Gateway\"\n+ description = \"List of IDs of Customer Gateway\"\n value = try(aws_egress_only_internet_gateway.this[0].id, \"\")\n }\n \n output \"cgw_ids\" {\n- description = \"List of IDs of Customer Gateway\"\n+ description = \"List of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.id]\n }\n \n output \"cgw_arns\" {\n- description = \"List of ARNs of Customer Gateway\"\n+ description = \"Map of ARNs of Customer Gateway\"\n value = [for k, v in aws_customer_gateway.this : v.arn]\n }\n \n output \"this_customer_gateway\" {\n- description = \"Map of Customer Gateway attributes\"\n+ description = \"Map of attribute maps for all customer gateways created\"\n value = aws_customer_gateway.this\n }\n \n---\n\n\n---\n" } ]
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\nAllow additional routes to be added for the private and intra\r\nrouting tables, like it is already available for the default table.\r\n\r\nAn example use case could be peering with some VPC and making it routed\r\nwith the VPC managed by the module. This example assumes that\r\nrequesting and accepting the peering request should be handled by a\r\nuser. As well as adding default routes on the other (peered VPC) side.\r\n\r\n## Motivation and Context\r\n<!--- 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\nThe use case is configuring all required routes within the VPC module, instead of adding custom\r\ncalls for ``aws_route``. The latter is not always possible with terragrunt modules for example, which allows\r\nonly other modules there, and no custom resources.\r\n(see https://github.com/gruntwork-io/terragrunt/issues/1187 and https://github.com/gruntwork-io/terragrunt/issues/1150)\r\n\r\nCustom routes may be required for the private/intra VPC route tables to cover many cases, like\r\npeering the managed VPC with another VPC (outside of this feature scope) and manage additional\r\nroutes on both sides. This change allows custom routes to be added for the managed VPC, for this\r\nexample. While adding the needed routes on the other side of the peering, and creating the peering would be\r\nleft for the user exercise.\r\n\r\n## Breaking Changes\r\n<!-- 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 (with my [tEKS fork](https://github.com/bogdando/teks/blob/main/QUICKSTART.md#demo-dev-cluster-un-this-fork))\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@@ -342,6 +342,8 @@ No modules.\n | <a name=\"input_default_route_table_propagating_vgws\"></a> [default\\_route\\_table\\_propagating\\_vgws](#input\\_default\\_route\\_table\\_propagating\\_vgws) | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n | <a name=\"input_default_route_table_routes\"></a> [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_route_table_tags\"></a> [default\\_route\\_table\\_tags](#input\\_default\\_route\\_table\\_tags) | Additional tags for the default route table | `map(string)` | `{}` | no |\n+| <a name=\"input_private_route_table_routes_extra\"></a> [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| <a name=\"input_intra_route_table_routes_extra\"></a> [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_security_group_egress\"></a> [default\\_security\\_group\\_egress](#input\\_default\\_security\\_group\\_egress) | List of maps of egress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_security_group_ingress\"></a> [default\\_security\\_group\\_ingress](#input\\_default\\_security\\_group\\_ingress) | List of maps of ingress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_security_group_name\"></a> [default\\_security\\_group\\_name](#input\\_default\\_security\\_group\\_name) | Name to be used on the default security group | `string` | `null` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -37,6 +37,15 @@ module \"vpc\" {\n \n manage_default_route_table = true\n default_route_table_tags = { Name = \"${local.name}-default\" }\n+ # Peered VPC to become routed with the one being created\n+ default_route_table_routes = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n+ intra_route_table_routes_extra = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n \n manage_default_security_group = true\n default_security_group_tags = { Name = \"${local.name}-default\" }\n---\nmain.tf\n@@ -228,6 +228,25 @@ resource \"aws_route_table\" \"private\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.private_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n {\n \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n@@ -338,6 +357,25 @@ resource \"aws_route_table\" \"intra\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.intra_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n var.tags,\n---\nvariables.tf\n@@ -418,6 +418,18 @@ variable \"default_route_table_tags\" {\n default = {}\n }\n \n+variable \"private_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"intra_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add to all resources\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -342,6 +342,8 @@ No modules.\n | <a name=\"input_default_route_table_propagating_vgws\"></a> [default\\_route\\_table\\_propagating\\_vgws](#input\\_default\\_route\\_table\\_propagating\\_vgws) | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n | <a name=\"input_default_route_table_routes\"></a> [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_route_table_tags\"></a> [default\\_route\\_table\\_tags](#input\\_default\\_route\\_table\\_tags) | Additional tags for the default route table | `map(string)` | `{}` | no |\n+| <a name=\"input_private_route_table_routes_extra\"></a> [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| <a name=\"input_intra_route_table_routes_extra\"></a> [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_security_group_egress\"></a> [default\\_security\\_group\\_egress](#input\\_default\\_security\\_group\\_egress) | List of maps of egress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_security_group_ingress\"></a> [default\\_security\\_group\\_ingress](#input\\_default\\_security\\_group\\_ingress) | List of maps of ingress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_security_group_name\"></a> [default\\_security\\_group\\_name](#input\\_default\\_security\\_group\\_name) | Name to be used on the default security group | `string` | `null` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -37,6 +37,15 @@ module \"vpc\" {\n \n manage_default_route_table = true\n default_route_table_tags = { Name = \"${local.name}-default\" }\n+ # Peered VPC to become routed with the one being created\n+ default_route_table_routes = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n+ intra_route_table_routes_extra = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n \n manage_default_security_group = true\n default_security_group_tags = { Name = \"${local.name}-default\" }\n---\nmain.tf\n@@ -228,6 +228,25 @@ resource \"aws_route_table\" \"private\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.private_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id nat_gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n {\n \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n@@ -338,6 +357,25 @@ resource \"aws_route_table\" \"intra\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.intra_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n var.tags,\n---\nvariables.tf\n@@ -418,6 +418,18 @@ variable \"default_route_table_tags\" {\n default = {}\n }\n \n+variable \"private_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"intra_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add to all resources\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -342,6 +342,8 @@ No modules.\n | <a name=\"input_default_route_table_propagating_vgws\"></a> [default\\_route\\_table\\_propagating\\_vgws](#input\\_default\\_route\\_table\\_propagating\\_vgws) | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n | <a name=\"input_default_route_table_routes\"></a> [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_route_table_tags\"></a> [default\\_route\\_table\\_tags](#input\\_default\\_route\\_table\\_tags) | Additional tags for the default route table | `map(string)` | `{}` | no |\n+| <a name=\"input_private_route_table_routes_extra\"></a> [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| <a name=\"input_intra_route_table_routes_extra\"></a> [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_security_group_egress\"></a> [default\\_security\\_group\\_egress](#input\\_default\\_security\\_group\\_egress) | List of maps of egress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_security_group_ingress\"></a> [default\\_security\\_group\\_ingress](#input\\_default\\_security\\_group\\_ingress) | List of maps of ingress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_security_group_name\"></a> [default\\_security\\_group\\_name](#input\\_default\\_security\\_group\\_name) | Name to be used on the default security group | `string` | `null` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -37,6 +37,15 @@ module \"vpc\" {\n \n manage_default_route_table = true\n default_route_table_tags = { Name = \"${local.name}-default\" }\n+ # Peered VPC to become routed with the one being created\n+ default_route_table_routes = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n+ intra_route_table_routes_extra = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n \n manage_default_security_group = true\n default_security_group_tags = { Name = \"${local.name}-default\" }\n---\nmain.tf\n@@ -228,6 +228,25 @@ resource \"aws_route_table\" \"private\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.private_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n {\n \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n@@ -338,6 +357,25 @@ resource \"aws_route_table\" \"intra\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.intra_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n var.tags,\n---\nvariables.tf\n@@ -418,6 +418,18 @@ variable \"default_route_table_tags\" {\n default = {}\n }\n \n+variable \"private_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"intra_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add to all resources\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -342,6 +342,8 @@ No modules.\n | <a name=\"input_default_route_table_propagating_vgws\"></a> [default\\_route\\_table\\_propagating\\_vgws](#input\\_default\\_route\\_table\\_propagating\\_vgws) | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n | <a name=\"input_default_route_table_routes\"></a> [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_route_table_tags\"></a> [default\\_route\\_table\\_tags](#input\\_default\\_route\\_table\\_tags) | Additional tags for the default route table | `map(string)` | `{}` | no |\n+| <a name=\"input_private_route_table_routes_extra\"></a> [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| <a name=\"input_intra_route_table_routes_extra\"></a> [default\\_route\\_table\\_routes](#input\\_default\\_route\\_table\\_routes) | Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_security_group_egress\"></a> [default\\_security\\_group\\_egress](#input\\_default\\_security\\_group\\_egress) | List of maps of egress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_security_group_ingress\"></a> [default\\_security\\_group\\_ingress](#input\\_default\\_security\\_group\\_ingress) | List of maps of ingress rules to set on the default security group | `list(map(string))` | `[]` | no |\n | <a name=\"input_default_security_group_name\"></a> [default\\_security\\_group\\_name](#input\\_default\\_security\\_group\\_name) | Name to be used on the default security group | `string` | `null` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -37,6 +37,15 @@ module \"vpc\" {\n \n manage_default_route_table = true\n default_route_table_tags = { Name = \"${local.name}-default\" }\n+ # Peered VPC to become routed with the one being created\n+ default_route_table_routes = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n+ intra_route_table_routes_extra = [{\n+ \"vpc_peering_connection_id\" = \"pcx-00000000000000000\",\n+ \"cidr_block\" = \"20.20.20.0/24\"\n+ }]\n \n manage_default_security_group = true\n default_security_group_tags = { Name = \"${local.name}-default\" }\n---\nmain.tf\n@@ -228,6 +228,25 @@ resource \"aws_route_table\" \"private\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.private_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n {\n \"Name\" = var.single_nat_gateway ? \"${var.name}-${var.private_subnet_suffix}\" : format(\n@@ -338,6 +357,25 @@ resource \"aws_route_table\" \"intra\" {\n \n vpc_id = local.vpc_id\n \n+ dynamic \"route\" {\n+ for_each = var.intra_route_table_routes_extra\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n tags = merge(\n { \"Name\" = \"${var.name}-${var.intra_subnet_suffix}\" },\n var.tags,\n---\nvariables.tf\n@@ -418,6 +418,18 @@ variable \"default_route_table_tags\" {\n default = {}\n }\n \n+variable \"private_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for private subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"intra_route_table_routes_extra\" {\n+ description = \"Configuration block of additional routes for intra subnets route tables. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add all resources\"\n type = map(string)\n---\n\n\n---\n" } ]
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 change introduces a data source to look up the default security group of the vpc that the endpoint will be deployed into. The default security group is then explicitly associated with the endpoint if no other security groups are passed into the module, or found by the lookup function. This resolves the issue of terraform wanting to make changes on every apply, as described in the linked issue below.\r\n\r\n## Motivation and Context\r\nThis is to fix what's described in https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/803\r\n\r\n## Breaking Changes\r\nNo breaking changes\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\nThe vpc in the complete example was deployed prior to making my change. Terraform apply was run again after making my change, and terraform detected no changes to make.\r\n\r\nLocally, I also deployed the simple-vpc example with the below endpoint configuration added to it\r\n\r\n```\r\nmodule \"vpc_endpoints\" {\r\n source = \"../../modules/vpc-endpoints\"\r\n\r\n vpc_id = module.vpc.vpc_id\r\n\r\n endpoints = {\r\n s3 = {\r\n service = \"s3\"\r\n tags = { Name = \"s3-vpc-endpoint\" }\r\n }\r\n }\r\n\r\n tags = {\r\n Owner = \"user\"\r\n Environment = \"dev\"\r\n }\r\n}\r\n```\r\n\r\nI ran terraform apply again and was able to reproduce the problem described in the linked issue. After adding my change and running a terraform apply, no changes were detected, which is the expected behaviour.\r\n\r\n- [x] I have executed `pre-commit run -a` on my pull request\r\n\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/README.md\n@@ -73,6 +73,7 @@ No modules.\n | Name | Type |\n |------|------|\n | [aws_vpc_endpoint.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n ## Inputs\n---\nmodules/vpc-endpoints/main.tf\n@@ -3,7 +3,15 @@\n ################################################################################\n \n locals {\n- endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ default_sg = length(var.security_group_ids) == 0 ? [try(data.aws_security_group.this[0].id, null)] : []\n+ endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n+data \"aws_security_group\" \"this\" {\n+ count = var.create ? 1 : 0\n+\n+ name = \"default\"\n+ vpc_id = var.vpc_id\n }\n \n data \"aws_vpc_endpoint_service\" \"this\" {\n@@ -26,7 +34,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", local.default_sg))) : null\n subnet_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", local.default_sg)))\n\n---\n\nChoice B:\nmodules/vpc-endpoints/README.md\n@@ -73,6 +73,7 @@ No modules.\n | Name | Type |\n |------|------|\n | [aws_vpc_endpoint.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n ## Inputs\n---\nmodules/vpc-endpoints/main.tf\n@@ -3,7 +3,15 @@\n ################################################################################\n \n locals {\n- endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ default_sg = length(var.security_group_ids) == 0 ? [try(data.aws_security_group.this[0].id, null)] : []\n+ endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n+data \"aws_security_group\" \"this\" {\n+ count = var.create ? 1 : 0\n+\n+ name = \"default\"\n+ vpc_id = var.vpc_id\n }\n \n data \"aws_vpc_endpoint_service\" \"this\" {\n@@ : +34,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", local.default_sg))) : null\n subnet_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", null)\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/README.md\n@@ -73,6 +73,7 @@ No modules.\n | Name | Type |\n |------|------|\n | [aws_vpc_endpoint.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n ## Inputs\n---\nmodules/vpc-endpoints/main.tf\n@@ -3,7 +3,15 @@\n ################################################################################\n \n locals {\n- endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ default_sg = length(var.security_group_ids) == 0 ? [try(data.aws_security_group.this[0].id, null)] : []\n+ endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n+data \"aws_security_group\" \"this\" {\n+ count = var.create ? 1 : 0\n+\n+ name = \"default\"\n+ vpc_id = var.vpc_id\n }\n \n data \"aws_vpc_endpoint_service\" \"this\" {\n@@ -26,7 +34,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", local.default_sg))) : null\n subnet_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", null)\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/README.md\n@@ -73,6 +73,7 @@ No modules.\n | Name | Type |\n |------|------|\n | [aws_vpc_endpoint.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n ## Inputs\n---\nmodules/vpc-endpoints/main.tf\n@@ -3,7 +3,15 @@\n ################################################################################\n \n locals {\n- endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ default_sg = length(var.security_group_ids) == 0 ? [try(data.aws_security_group.this[0].id, null)] : []\n+ endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n+data \"aws_security_group\" \"this\" {\n+ count = var.create ? 1 : 0\n+\n+ name = \"default\"\n+ vpc_id = var.vpc_id\n }\n \n data \"aws_vpc_endpoint_service\" \"this\" {\n@@ -26,7 +34,7 @@ resource \"aws_vpc_endpoint\" \"this\" {\n vpc_endpoint_type = lookup(each.value, \"service_type\", \"Interface\")\n auto_accept = lookup(each.value, \"auto_accept\", null)\n \n- security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", []))) : null\n+ security_group_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.security_group_ids, lookup(each.value, \"security_group_ids\", local.default_sg))) : null\n subnet_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Interface\" ? distinct(concat(var.subnet_ids, lookup(each.value, \"subnet_ids\", []))) : null\n route_table_ids = lookup(each.value, \"service_type\", \"Interface\") == \"Gateway\" ? lookup(each.value, \"route_table_ids\", null) : null\n policy = lookup(each.value, \"policy\", null)\n---\n\n\n---\n" } ]
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\nWork in progress. This PR is an idea. I would like to know if it make sense, so I can go further to finish development.\r\n\r\nAdd customized private subnet blocks (like groups) with the possibility to define different AZ(s) and subnet_suffix (Name tags).\r\n\r\nThere are some standard blocks, like:\r\n\r\npublic_subnets: `name-subnet-public-us-east-1a`\r\ndatabase_subnets: `name-subnet-database-us-east-1a`\r\nprivate_subnets: `name-subnet-private-us-east-1a`\r\nAnd so on...\r\n\r\nThey are distributed trough the `var.azs`.\r\n\r\nHowever, It would be great if I could define aditional subnets that can be allocated in a specific AZ:\r\n\r\nprivate_custom_blocks:\r\n\r\n`name-subnet-foo-us-west-1a`\r\n`name-subnet-bar-us-west-1a`\r\nAnd so on...\r\n\r\nInput a new optional variable to the module:\r\n\r\n```\r\nprivate_custom_blocks = {\r\n foo = {\r\n azs = [\"us-west-2a\"]\r\n subnet_suffix = \"subnet-foo\"\r\n tags = {}\r\n subnets = [\"10.10.192.0/27\", \"10.10.192.32/27\", \"10.10.192.64/27\"]\r\n },\r\n bar = {\r\n azs = [\"us-west-2a\", \"us-west-2b\", \"us-west-2c\"]\r\n subnet_suffix = \"subnet-bar\"\r\n tags = {}\r\n subnets = [\"10.10.224.0/27\", \"10.10.224.32/27\", \"10.10.224.64/27\"]\r\n },\r\n xpto = {\r\n azs = [\"us-west-2a\", \"us-west-2b\", \"us-west-2c\"]\r\n subnet_suffix = \"subnet-xpto\"\r\n tags = {\r\n Foo = \"bar\"\r\n }\r\n subnets = [\"10.10.240.0/27\", \"10.10.240.32/27\", \"10.10.240.64/27\"]\r\n }\r\n}\r\n``` \r\n## Motivation and Context\r\n\r\nPossibility to create some subnets in a specific AZ to acomplish a different need.\r\n\r\nI need to create 3 subnets in us-east-1a to comunicate to my on-prem network. It does not need HA.\r\nTo achieve that, I have to create 9 new subnets, distributed trough my `var.azs = [\"us-east-1a\", \"us-east-1b\", \"us-east-1c\"]`.\r\nThe other 6 subnets will never be used.\r\n\r\n## Breaking Changes\r\n\r\nIt does not break backwards compatibility. It would be an optional variable.\r\n\r\n## How Has This Been Tested?\r\n\r\nI have tested it in a fresh implementation of VPC module, creating standard and custom subnets.\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -4,13 +4,28 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(local.private_custom_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(toset(flatten([\n+ var.azs,\n+ local.private_custom_subnets[*].azs,\n+ ]))) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ private_custom_subnets = flatten([\n+ for block in var.private_custom_blocks : [\n+ for subnet in block.subnets : {\n+ subnet = subnet\n+ azs = block.azs\n+ subnet_suffix = block.subnet_suffix\n+ tags = block.tags\n+ }\n+ ]\n+ ])\n }\n \n ################################################################################\n@@ -400,6 +415,31 @@ resource \"aws_subnet\" \"private\" {\n )\n }\n \n+################################################################################\n+# Custom private subnet\n+################################################################################\n+\n+resource \"aws_subnet\" \"custom\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = local.private_custom_subnets[count.index].subnet\n+\n+ availability_zone ################################################################################\n@@ length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) > 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) == 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${local.private_custom_subnets[count.index].subnet_suffix}-%s\",\n+ element(local.private_custom_subnets[count.index].azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ local.private_custom_subnets[count.index].tags,\n+ )\n+}\n+\n ################################################################################\n # Outpost subnet\n ################################################################################\n@@ -1075,6 +1115,16 @@ resource \"aws_route_table_association\" \"private\" {\n )\n }\n \n+resource \"aws_route_table_association\" \"custom_private\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.custom[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"outpost\" {\n count = local.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n---\nvariables.tf\n@@ -1192,3 +1192,9 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"private_custom_blocks\" {\n+ type = map(any)\n+ description = \"List of maps of customized private subnets\"\n+ default = {}\n+}\n\\ No newline at end of file\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -4,13 +4,28 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(local.private_custom_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(toset(flatten([\n+ var.azs,\n+ local.private_custom_subnets[*].azs,\n+ ]))) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should tags deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ private_custom_subnets = flatten([\n+ for block in var.private_custom_blocks : [\n+ for subnet in block.subnets : {\n+ subnet = subnet\n+ azs = block.azs\n+ subnet_suffix = block.subnet_suffix\n+ tags = block.tags\n+ }\n+ ]\n+ ])\n }\n \n ################################################################################\n@@ -400,6 +415,31 @@ resource \"aws_subnet\" \"private\" {\n )\n }\n \n+################################################################################\n+# Custom private subnet\n+################################################################################\n+\n+resource \"aws_subnet\" \"custom\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = local.private_custom_subnets[count.index].subnet\n+\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) > 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) == 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${local.private_custom_subnets[count.index].subnet_suffix}-%s\",\n+ element(local.private_custom_subnets[count.index].azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ local.private_custom_subnets[count.index].tags,\n+ )\n+}\n+\n ################################################################################\n # Outpost subnet\n ################################################################################\n@@ -1075,6 +1115,16 @@ resource \"aws_route_table_association\" \"private\" {\n )\n }\n \n+resource \"aws_route_table_association\" \"custom_private\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.custom[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"outpost\" {\n count = local.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n---\nvariables.tf\n@@ -1192,3 +1192,9 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"private_custom_blocks\" {\n+ type = map(any)\n+ description = \"List of maps of customized private subnets\"\n+ default = {}\n+}\n\\ No newline at end of file\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -4,13 +4,28 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(local.private_custom_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(toset(flatten([\n+ var.azs,\n+ local.private_custom_subnets[*].azs,\n+ ]))) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ private_custom_subnets = flatten([\n+ for block in var.private_custom_blocks : [\n+ for subnet in block.subnets : {\n+ subnet = subnet\n+ azs = block.azs\n+ subnet_suffix = block.subnet_suffix\n+ tags = block.tags\n+ }\n+ ]\n+ ])\n }\n \n ################################################################################\n@@ -400,6 +415,31 @@ resource \"aws_subnet\" \"private\" {\n )\n }\n \n+################################################################################\n+# Custom private subnet\n+################################################################################\n+\n+resource \"aws_subnet\" \"custom\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = local.private_custom_subnets[count.index].subnet\n+\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) > 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) == 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${local.private_custom_subnets[count.index].subnet_suffix}-%s\",\n+ element(local.private_custom_subnets[count.index].azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ local.private_custom_subnets[count.index].tags,\n+ )\n+}\n+\n ################################################################################\n # Outpost subnet\n ################################################################################\n@@ -1075,6 +1115,16 @@ resource \"aws_route_table_association\" \"private\" {\n )\n }\n \n+resource \"aws_route_table_association\" \"custom_private\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.custom[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"outpost\" {\n count = local.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n---\nvariables.tf\n@@ -1192,3 +1192,9 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"private_custom_blocks\" {\n+ type = map(any)\n+ description = \"List of maps of customized private subnets\"\n+ default = {}\n+}\n\\ No newline at end of file\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -4,13 +4,28 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(local.private_custom_subnets),\n )\n- nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n+ nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(toset(flatten([\n+ var.azs,\n+ local.private_custom_subnets[*].azs,\n+ ]))) : local.max_subnet_length\n \n # Use `local.vpc_id` to give a hint to Terraform that subnets should be deleted before secondary CIDR blocks can be free!\n vpc_id = try(aws_vpc_ipv4_cidr_block_association.this[0].vpc_id, aws_vpc.this[0].id, \"\")\n \n create_vpc = var.create_vpc && var.putin_khuylo\n+\n+ private_custom_subnets = flatten([\n+ for block in var.private_custom_blocks : [\n+ for subnet in block.subnets : {\n+ subnet = subnet\n+ azs = block.azs\n+ subnet_suffix = block.subnet_suffix\n+ tags = block.tags\n+ }\n+ ]\n+ ])\n }\n \n ################################################################################\n@@ -400,6 +415,31 @@ resource \"aws_subnet\" \"private\" {\n )\n }\n \n+################################################################################\n+# Custom private subnet\n+################################################################################\n+\n+resource \"aws_subnet\" \"custom\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = local.private_custom_subnets[count.index].subnet\n+\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) > 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(local.private_custom_subnets[count.index].azs, count.index))) == 0 ? element(local.private_custom_subnets[count.index].azs, count.index) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${local.private_custom_subnets[count.index].subnet_suffix}-%s\",\n+ element(local.private_custom_subnets[count.index].azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ local.private_custom_subnets[count.index].tags,\n+ )\n+}\n+\n ################################################################################\n # Outpost subnet\n ################################################################################\n@@ -1075,6 +1115,16 @@ resource \"aws_route_table_association\" \"private\" {\n )\n }\n \n+resource \"aws_route_table_association\" \"custom_private\" {\n+ count = var.create_vpc && length(local.private_custom_subnets) > 0 ? length(local.private_custom_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.custom[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"outpost\" {\n count = local.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n---\nvariables.tf\n@@ -1192,3 +1192,9 @@ variable \"putin_khuylo\" {\n type = bool\n default = true\n }\n+\n+variable \"private_custom_blocks\" {\n+ type = map(any)\n+ description = \"List of maps of customized private subnets\"\n+ default = {}\n+}\n\\ No newline at end of file\n---\n\n\n---\n" } ]
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- Compact CIDR block outputs to avoid empty diffs\r\n\r\n## Motivation and Context\r\n- Closes #743 \r\n\r\n## Breaking Changes\r\n- No\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- 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:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.62.3\n+ rev: v1.72.1\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.1.0\n+ rev: v4.3.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\noutputs.tf\n@@ -60,7 +60,7 @@ output \"vpc_ipv6_cidr_block\" {\n \n output \"vpc_secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks of the VPC\"\n- value = aws_vpc_ipv4_cidr_block_association.this[*].cidr_block\n+ value = compact(aws_vpc_ipv4_cidr_block_association.this[*].cidr_block)\n }\n \n output \"vpc_owner_id\" {\n@@ -80,12 +80,12 @@ output \"private_subnet_arns\" {\n \n output \"private_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of private subnets\"\n- value = aws_subnet.private[*].cidr_block\n+ value = compact(aws_subnet.private[*].cidr_block)\n }\n \n output \"private_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of private subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.private[*].ipv6_cidr_block\n+ value = compact(aws_subnet.private[*].ipv6_cidr_block)\n }\n \n output \"public_subnets\" {\n@@ -100,12 +100,12 @@ output \"public_subnet_arns\" {\n \n output \"public_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public[*].cidr_block\n+ value = repos:\n }\n \n output \"public_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public[*].ipv6_cidr_block\n+ value = compact(aws_subnet.public[*].ipv6_cidr_block)\n }\n \n output \"outpost_subnets\" {\n@@ -120,12 +120,12 @@ output \"outpost_subnet_arns\" {\n \n output \"outpost_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of outpost subnets\"\n- value = aws_subnet.outpost[*].cidr_block\n+ value = compact(aws_subnet.outpost[*].cidr_block)\n }\n \n output \"outpost_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of outpost subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.outpost[*].ipv6_cidr_block\n+ value = compact(aws_subnet.outpost[*].ipv6_cidr_block)\n }\n \n output \"database_subnets\" {\n@@ -140,12 +140,12 @@ output \"database_subnet_arns\" {\n \n output \"database_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of database subnets\"\n- value = aws_subnet.database[*].cidr_block\n+ value = compact(aws_subnet.database[*].cidr_block)\n }\n \n output \"database_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of database subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.database[*].ipv6_cidr_block\n+ value = compact(aws_subnet.database[*].ipv6_cidr_block)\n }\n \n output \"database_subnet_group\" {\n@@ -170,12 +170,12 @@ output \"redshift_subnet_arns\" {\n \n output \"redshift_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of redshift subnets\"\n- value = aws_subnet.redshift[*].cidr_block\n+ value = compact(aws_subnet.redshift[*].cidr_block)\n }\n \n output \"redshift_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of redshift subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.redshift[*].ipv6_cidr_block\n+ value = compact(aws_subnet.redshift[*].ipv6_cidr_block)\n }\n \n output \"redshift_subnet_group\" {\n@@ -195,12 +195,12 @@ output \"elasticache_subnet_arns\" {\n \n output \"elasticache_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of elasticache subnets\"\n- value = aws_subnet.elasticache[*].cidr_block\n+ value = compact(aws_subnet.elasticache[*].cidr_block)\n }\n \n output \"elasticache_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of elasticache subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.elasticache[*].ipv6_cidr_block\n+ value = compact(aws_subnet.elasticache[*].ipv6_cidr_block)\n }\n \n output \"intra_subnets\" {\n@@ -215,12 +215,12 @@ output \"intra_subnet_arns\" {\n \n output \"intra_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of intra subnets\"\n- value = aws_subnet.intra[*].cidr_block\n+ value = compact(aws_subnet.intra[*].cidr_block)\n }\n \n output \"intra_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of intra subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.intra[*].ipv6_cidr_block\n+ value = compact(aws_subnet.intra[*].ipv6_cidr_block)\n }\n \n output \"elasticache_subnet_group\" {\n---\n\n\n---\n\nChoice B:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.62.3\n+ rev: v1.72.1\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.1.0\n+ rev: v4.3.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\noutputs.tf\n@@ -60,7 +60,7 @@ output \"vpc_ipv6_cidr_block\" {\n \n output \"vpc_secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks of the VPC\"\n- value = aws_vpc_ipv4_cidr_block_association.this[*].cidr_block\n+ value = compact(aws_vpc_ipv4_cidr_block_association.this[*].cidr_block)\n }\n \n output \"vpc_owner_id\" {\n@@ -80,12 +80,12 @@ output \"private_subnet_arns\" {\n \n output \"private_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of private subnets\"\n- value = aws_subnet.private[*].cidr_block\n+ value = compact(aws_subnet.private[*].cidr_block)\n }\n \n output \"private_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of private subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.private[*].ipv6_cidr_block\n+ value = compact(aws_subnet.private[*].ipv6_cidr_block)\n }\n \n output \"public_subnets\" {\n@@ -100,12 +100,12 @@ output \"public_subnet_arns\" {\n \n output \"public_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public[*].cidr_block\n+ value = compact(aws_subnet.public[*].cidr_block)\n }\n \n output \"public_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public[*].ipv6_cidr_block\n+ value = compact(aws_subnet.public[*].ipv6_cidr_block)\n }\n \n output \"outpost_subnets\" {\n@@ -120,12 +120,12 @@ output \"outpost_subnet_arns\" {\n \n output \"outpost_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of outpost subnets\"\n- value = aws_subnet.outpost[*].cidr_block\n+ value = compact(aws_subnet.outpost[*].cidr_block)\n }\n \n output \"outpost_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of outpost subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.outpost[*].ipv6_cidr_block\n+ value = compact(aws_subnet.outpost[*].ipv6_cidr_block)\n }\n \n output \"database_subnets\" {\n@@ -140,12 +140,12 @@ output \"database_subnet_arns\" {\n \n output \"database_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of database subnets\"\n- value = aws_subnet.database[*].cidr_block\n+ value = compact(aws_subnet.database[*].cidr_block)\n }\n \n output \"database_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of database subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.database[*].ipv6_cidr_block\n+ value = compact(aws_subnet.database[*].ipv6_cidr_block)\n }\n \n output \"database_subnet_group\" {\n@@ -170,12 compact(aws_vpc_ipv4_cidr_block_association.this[*].cidr_block)\n @@ output \"redshift_subnet_arns\" {\n \n output \"redshift_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of redshift subnets\"\n- value = aws_subnet.redshift[*].cidr_block\n+ value = compact(aws_subnet.redshift[*].cidr_block)\n }\n \n output \"redshift_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of redshift subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.redshift[*].ipv6_cidr_block\n+ value = compact(aws_subnet.redshift[*].ipv6_cidr_block)\n }\n \n output \"redshift_subnet_group\" {\n@@ -195,12 +195,12 @@ output \"elasticache_subnet_arns\" {\n \n output \"elasticache_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of elasticache subnets\"\n- value = aws_subnet.elasticache[*].cidr_block\n+ value = compact(aws_subnet.elasticache[*].cidr_block)\n }\n \n output \"elasticache_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of elasticache subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.elasticache[*].ipv6_cidr_block\n+ value = compact(aws_subnet.elasticache[*].ipv6_cidr_block)\n }\n \n output \"intra_subnets\" {\n@@ -215,12 +215,12 @@ output \"intra_subnet_arns\" {\n \n output \"intra_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of intra subnets\"\n- value = aws_subnet.intra[*].cidr_block\n+ value = compact(aws_subnet.intra[*].cidr_block)\n }\n \n output \"intra_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of intra subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.intra[*].ipv6_cidr_block\n+ value = compact(aws_subnet.intra[*].ipv6_cidr_block)\n }\n \n output \"elasticache_subnet_group\" {\n---\n\n\n---\n\nChoice C:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.62.3\n+ rev: v1.72.1\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.1.0\n+ rev: v4.3.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\noutputs.tf\n@@ -60,7 +60,7 @@ output \"vpc_ipv6_cidr_block\" {\n \n output \"vpc_secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks of the VPC\"\n- value = aws_vpc_ipv4_cidr_block_association.this[*].cidr_block\n+ value = compact(aws_vpc_ipv4_cidr_block_association.this[*].cidr_block)\n }\n \n output \"vpc_owner_id\" {\n@@ -80,12 +80,12 @@ output \"private_subnet_arns\" {\n \n output \"private_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of private subnets\"\n- value = aws_subnet.private[*].cidr_block\n+ value = compact(aws_subnet.private[*].cidr_block)\n }\n \n output \"private_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of private subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.private[*].ipv6_cidr_block\n+ value = compact(aws_subnet.private[*].ipv6_cidr_block)\n }\n \n output \"public_subnets\" {\n@@ -100,12 +100,12 @@ output \"public_subnet_arns\" {\n \n output \"public_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public[*].cidr_block\n+ value = compact(aws_subnet.public[*].cidr_block)\n }\n \n output \"public_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public[*].ipv6_cidr_block\n+ value = compact(aws_subnet.public[*].ipv6_cidr_block)\n }\n \n output \"outpost_subnets\" {\n@@ -120,12 +120,12 @@ output \"outpost_subnet_arns\" {\n \n output \"outpost_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of outpost subnets\"\n- value = aws_subnet.outpost[*].cidr_block\n+ value = compact(aws_subnet.outpost[*].cidr_block)\n }\n \n output \"outpost_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of outpost subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.outpost[*].ipv6_cidr_block\n+ value = compact(aws_subnet.outpost[*].ipv6_cidr_block)\n }\n \n output \"database_subnets\" {\n@@ -140,12 +140,12 @@ output \"database_subnet_arns\" {\n \n output \"database_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of database subnets\"\n- value = aws_subnet.database[*].cidr_block\n+ value = compact(aws_subnet.database[*].cidr_block)\n }\n \n output \"database_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of database subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.database[*].ipv6_cidr_block\n+ value = compact(aws_subnet.database[*].ipv6_cidr_block)\n }\n \n output \"database_subnet_group\" {\n@@ -170,12 +170,12 @@ output \"redshift_subnet_arns\" {\n \n output \"redshift_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of redshift subnets\"\n- value = aws_subnet.redshift[*].cidr_block\n+ value = compact(aws_subnet.redshift[*].cidr_block)\n }\n \n output \"redshift_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of redshift subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.redshift[*].ipv6_cidr_block\n+ value = compact(aws_subnet.redshift[*].ipv6_cidr_block)\n }\n \n output \"redshift_subnet_group\" {\n@@ -195,12 +195,12 @@ output \"elasticache_subnet_arns\" {\n \n output \"elasticache_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of elasticache subnets\"\n- value = aws_subnet.elasticache[*].cidr_block\n+ value = compact(aws_subnet.elasticache[*].cidr_block)\n }\n \n output \"elasticache_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of elasticache subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.elasticache[*].ipv6_cidr_block\n+ value = compact(aws_subnet.elasticache[*].ipv6_cidr_block)\n }\n \n output \"intra_subnets\" {\n@@ -215,12 +215,12 @@ output \"intra_subnet_arns\" {\n \n output \"intra_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of intra subnets\"\n- value = aws_subnet.intra[*].cidr_block\n+ value = compact(aws_subnet.intra[*].cidr_block)\n }\n \n output \"intra_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of intra subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.intra[*].ipv6_cidr_block\n+ value = compact(aws_subnet.intra[*].ipv6_cidr_block)\n }\n \n output \"elasticache_subnet_group\" {\n---\n\n\n---\n\nChoice D:\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.62.3\n+ rev: v1.72.1\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,7 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.1.0\n+ rev: v4.3.0\n hooks:\n - id: check-merge-conflict\n - id: end-of-file-fixer\n---\noutputs.tf\n@@ -60,7 +60,7 @@ output \"vpc_ipv6_cidr_block\" {\n \n output \"vpc_secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks of the VPC\"\n- value = aws_vpc_ipv4_cidr_block_association.this[*].cidr_block\n+ value = compact(aws_vpc_ipv4_cidr_block_association.this[*].cidr_block)\n }\n \n output \"vpc_owner_id\" {\n@@ -80,12 +80,12 @@ output \"private_subnet_arns\" {\n \n output \"private_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of private subnets\"\n- value = aws_subnet.private[*].cidr_block\n+ value = compact(aws_subnet.private[*].cidr_block)\n }\n \n output \"private_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of private subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.private[*].ipv6_cidr_block\n+ value = compact(aws_subnet.private[*].ipv6_cidr_block)\n }\n \n output \"public_subnets\" {\n@@ -100,12 +100,12 @@ output \"public_subnet_arns\" {\n \n output \"public_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public[*].cidr_block\n+ value = compact(aws_subnet.public[*].cidr_block)\n }\n \n output \"public_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public[*].ipv6_cidr_block\n+ value = compact(aws_subnet.public[*].ipv6_cidr_block)\n }\n \n output \"outpost_subnets\" {\n@@ -120,12 +120,12 @@ output \"outpost_subnet_arns\" {\n \n output \"outpost_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of outpost subnets\"\n- value = aws_subnet.outpost[*].cidr_block\n+ value = compact(aws_subnet.outpost[*].cidr_block)\n }\n \n output \"outpost_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of outpost subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.outpost[*].ipv6_cidr_block\n+ value = compact(aws_subnet.outpost[*].ipv6_cidr_block)\n }\n \n output \"database_subnets\" {\n@@ -140,12 +140,12 @@ output \"database_subnet_arns\" {\n \n output \"database_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of database subnets\"\n- value = aws_subnet.database[*].cidr_block\n+ value = compact(aws_subnet.database[*].cidr_block)\n }\n \n output \"database_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of database subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.database[*].ipv6_cidr_block\n+ value = compact(aws_subnet.database[*].ipv6_cidr_block)\n }\n \n output \"database_subnet_group\" {\n@@ -170,12 +170,12 @@ output \"redshift_subnet_arns\" {\n \n output \"redshift_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of redshift subnets\"\n- value = aws_subnet.redshift[*].cidr_block\n+ value = compact(aws_subnet.redshift[*].cidr_block)\n }\n \n output \"redshift_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of redshift subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.redshift[*].ipv6_cidr_block\n+ value = compact(aws_subnet.redshift[*].ipv6_cidr_block)\n }\n \n output \"redshift_subnet_group\" {\n@@ -195,12 +195,12 @@ output \"elasticache_subnet_arns\" {\n \n output \"elasticache_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of elasticache subnets\"\n- value = aws_subnet.elasticache[*].cidr_block\n+ value = compact(aws_subnet.elasticache[*].cidr_block)\n }\n \n output \"elasticache_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of elasticache subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.elasticache[*].ipv6_cidr_block\n+ value = compact(aws_subnet.elasticache[*].ipv6_cidr_block)\n }\n \n output \"intra_subnets\" {\n@@ -215,12 +215,12 @@ output \"intra_subnet_arns\" {\n \n output \"intra_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of intra subnets\"\n- value = aws_subnet.intra[*].cidr_block\n+ value = compact(aws_subnet.intra[*].cidr_block)\n }\n \n output \"intra_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of intra subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.intra[*].ipv6_cidr_block\n+ value = compact(aws_subnet.intra[*].ipv6_cidr_block)\n }\n \n output \"elasticache_subnet_group\" {\n---\n\n\n---\n" } ]
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\nPrevent creation of data resources for VPC endpoints that are disabled.\r\n\r\n## Motivation and Context\r\nThe data resources and resources for VPC endpoints are now in sync.\r\n\r\n## Breaking Changes\r\nNo breaking change\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one of my own projects.\n\n---\n\nChoice A:\nmodules/vpc-endpoints/main.tf\n@@ -2,8 +2,12 @@\n # Endpoint(s)\n ################################################################################\n \n+locals {\n+ endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n data \"aws_vpc_endpoint_service\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = local.endpoints\n \n service = lookup(each.value, \"service\", null)\n service_name = lookup(each.value, \"service_name\", null)\n@@ -15,7 +19,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ for_each = local.endpoints\n \n vpc_id = var.vpc_id\n service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/main.tf\n@@ -2,8 +2,12 @@\n # Endpoint(s)\n ################################################################################\n \n+locals {\n+ endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n data \"aws_vpc_endpoint_service\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = local.endpoints\n \n service = lookup(each.value, \"service\", null)\n service_name = lookup(each.value, \"service_name\", null)\n@@ -15,7 +19,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ for_each = local.endpoints\n \n vpc_id = var.vpc_id\n service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/main.tf\n@@ -2,8 +2,12 @@\n # Endpoint(s)\n ################################################################################\n \n+locals {\n+ endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n data \"aws_vpc_endpoint_service\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = local.endpoints\n \n service = lookup(each.value, \"service\", null)\n service_name = lookup(each.value, \"service_name\", null)\n@@ -15,7 +19,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ for_each = local.endpoints\n \n vpc_id = var.vpc_id\n service_name if = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/main.tf\n@@ -2,8 +2,12 @@\n # Endpoint(s)\n ################################################################################\n \n+locals {\n+ \"aws_vpc_endpoint_service\" endpoints = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+}\n+\n data \"aws_vpc_endpoint_service\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = local.endpoints\n \n service = lookup(each.value, \"service\", null)\n service_name = lookup(each.value, \"service_name\", null)\n@@ -15,7 +19,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n+ for_each = local.endpoints\n \n vpc_id = var.vpc_id\n service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n" } ]
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:\nexamples/complete-vpc/main.tf\n@@ -6,7 +6,7 @@ locals {\n name = \"complete-example\"\n region = \"eu-west-1\"\n tags = {\n- Owner = \"user\"\n+ Owner = \"testuser\"\n Environment = \"staging\"\n Name = \"complete\"\n }\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -6,7 +6,7 @@ locals {\n name = \"complete-example\"\n region = \"eu-west-1\"\n tags = {\n- Owner = \"user\"\n+ Owner = \"testuser\"\n Environment = \"staging\"\n Name = \"complete\"\n }\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -6,7 +6,7 @@ locals {\n name = \"complete-example\"\n region = \"eu-west-1\"\n tags = {\n- Owner = \"user\"\n+ Owner = \"testuser\"\n Environment = \"staging\"\n Name = \"complete\"\n }\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -6,7 +6,7 @@ locals {\n name = \"complete-example\"\n region = \"eu-west-1\"\n tags = {\n- Owner = \"user\"\n+ Owner = \"testuser\"\n Environment = \"staging\"\n Name = \"complete\"\n }\n---\n\n\n---\n" } ]
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 support for passing `ipv6_ipam_pool_id` and `assign_generated_ipv6_cidr_block` arguments to the `aws_vpc` resource.\r\n\r\n## Motivation and Context\r\nI have a VPC where I need to pass the `ipv6_ipam_pool_id` and I couldn't do that without adding this feature.\r\n\r\n## Breaking Changes\r\nNone, the module works the same as it does today.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have updated at least one of the `examples/*` to demonstrate and validate my change(s); I did not update any of the examples to test the new feature because BYOIPv6 is difficult to setup / test in a development environment.\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects; existing examples work as they did before if you don't pass in the new argument: `ipv6_ipam_pool_id`\r\n- [x] I used the module for my own VPC and used the new argument `ipv6_ipam_pool_id` and it worked as expected.\r\n- [x] I have executed `pre-commit run -a` on my pull request\n\n---\n\nChoice A:\nREADME.md\n@@ -304,6 +304,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | <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_assign_generated_ipv6_cidr_block\"></a> [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `false` | no |\n | <a name=\"input_assign_ipv6_address_on_creation\"></a> [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | <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) | The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden | `string` | `\"0.0.0.0/0\"` | no |\n@@ -405,6 +406,7 @@ No modules.\n | <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_subnets\"></a> [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets | `list(string)` | `[]` | no |\n+| <a name=\"input_ipv6_ipam_pool_id\"></a> [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | IPAM Pool ID for an IPv6 pool. | `string` | `null` | 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` | `false` | 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` | `false` | 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` | `false` | no |\n---\nmain.tf\n@@ -26,7 +26,8 @@ resource \"aws_vpc\" \"this\" {\n enable_dns_support = var.enable_dns_support\n enable_classiclink = var.enable_classiclink\n enable_classiclink_dns_support = var.enable_classiclink_dns_support\n- assign_generated_ipv6_cidr_block = var.enable_ipv6\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && var.assign_generated_ipv6_cidr_block ? true : null\n+ ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -22,6 +22,18 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ipv6_ipam_pool_id\" {\n+ description = \"IPAM Pool ID for an IPv6 pool.\"\n+ type = string\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -304,6 +304,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | <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_assign_generated_ipv6_cidr_block\"></a> [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `false` | no |\n | <a name=\"input_assign_ipv6_address_on_creation\"></a> [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | <a name=\"input_azs\"></a> [azs](#input\\_azs) | A list of availability zones names or | in the region | `list(string)` | `[]` | no |\n | <a name=\"input_cidr\"></a> [cidr](#input\\_cidr) | The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden | `string` | `\"0.0.0.0/0\"` | no |\n@@ -405,6 +406,7 @@ No modules.\n | <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_subnets\"></a> [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets | `list(string)` | `[]` | no |\n+| <a name=\"input_ipv6_ipam_pool_id\"></a> [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | IPAM Pool ID for an IPv6 pool. | `string` | `null` | 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` | `false` | 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` | `false` | 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` | `false` | no |\n---\nmain.tf\n@@ -26,7 +26,8 @@ resource \"aws_vpc\" \"this\" {\n enable_dns_support = var.enable_dns_support\n enable_classiclink = var.enable_classiclink\n enable_classiclink_dns_support = var.enable_classiclink_dns_support\n- assign_generated_ipv6_cidr_block = var.enable_ipv6\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && var.assign_generated_ipv6_cidr_block ? true : null\n+ ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -22,6 +22,18 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ipv6_ipam_pool_id\" {\n+ description = \"IPAM Pool ID for an IPv6 pool.\"\n+ type = string\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -304,6 +304,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | <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_assign_generated_ipv6_cidr_block\"></a> [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `false` | no |\n | <a name=\"input_assign_ipv6_address_on_creation\"></a> [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | <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) | The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden | `string` | `\"0.0.0.0/0\"` | no |\n@@ -405,6 +406,7 @@ No modules.\n | <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_subnets\"></a> [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets | `list(string)` | `[]` | no |\n+| <a name=\"input_ipv6_ipam_pool_id\"></a> [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | IPAM Pool ID for an IPv6 pool. | `string` | `null` | 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` | `false` | 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` | `false` | 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` | `false` | no |\n---\nmain.tf\n@@ -26,7 +26,8 @@ resource \"aws_vpc\" \"this\" {\n enable_dns_support = var.enable_dns_support\n enable_classiclink = var.enable_classiclink\n enable_classiclink_dns_support = var.enable_classiclink_dns_support\n- assign_generated_ipv6_cidr_block = var.enable_ipv6\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && var.assign_generated_ipv6_cidr_block ? true : null\n+ ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -22,6 +22,18 @@ variable \"enable_ipv6\" {\n default = false\n {\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ipv6_ipam_pool_id\" {\n+ description = \"IPAM Pool ID for an IPv6 pool.\"\n+ type = string\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -304,6 +304,7 @@ No modules.\n | Name | Description | Type | Default | Required |\n |------|-------------|------|---------|:--------:|\n | <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_assign_generated_ipv6_cidr_block\"></a> [assign\\_generated\\_ipv6\\_cidr\\_block](#input\\_assign\\_generated\\_ipv6\\_cidr\\_block) | Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. | `bool` | `false` | no |\n | <a name=\"input_assign_ipv6_address_on_creation\"></a> [assign\\_ipv6\\_address\\_on\\_creation](#input\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `false` | no |\n | <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) | The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden | `string` | `\"0.0.0.0/0\"` | no |\n@@ -405,6 +406,7 @@ No modules.\n | <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_subnets\"></a> [intra\\_subnets](#input\\_intra\\_subnets) | A list of intra subnets | `list(string)` | `[]` | no |\n+| <a name=\"input_ipv6_ipam_pool_id\"></a> [ipv6\\_ipam\\_pool\\_id](#input\\_ipv6\\_ipam\\_pool\\_id) | IPAM Pool ID for an IPv6 pool. | `string` | `null` | 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` | `false` | 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` | `false` | 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` | `false` | no |\n---\nmain.tf\n@@ -26,7 +26,8 @@ resource \"aws_vpc\" \"this\" {\n enable_dns_support = var.enable_dns_support\n enable_classiclink the = var.enable_classiclink\n enable_classiclink_dns_support = var.enable_classiclink_dns_support\n- assign_generated_ipv6_cidr_block = var.enable_ipv6\n+ assign_generated_ipv6_cidr_block = var.enable_ipv6 && var.assign_generated_ipv6_cidr_block ? true : null\n+ ipv6_ipam_pool_id = var.ipv6_ipam_pool_id\n \n tags = merge(\n { \"Name\" = var.name },\n---\nvariables.tf\n@@ -22,6 +22,18 @@ variable \"enable_ipv6\" {\n default = false\n }\n \n+variable \"assign_generated_ipv6_cidr_block\" {\n+ description = \"Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC.\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"ipv6_ipam_pool_id\" {\n+ description = \"IPAM Pool ID for an IPv6 pool.\"\n+ type = string\n+ default = null\n+}\n+\n variable \"private_subnet_ipv6_prefixes\" {\n description = \"Assigns IPv6 private subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n type = list(string)\n---\n\n\n---\n" } ]
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\nAdds `flow_log_log_group_name_prefix` as an output.\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\nSee [#790](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/790)\r\n\r\n## Breaking Changes\r\n\r\nNo.\r\n\r\n## How Has This Been Tested?\r\n- [X] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [X] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- 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@@ -518,6 +518,7 @@ No modules.\n | <a name=\"output_elasticache_subnets\"></a> [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | <a name=\"output_elasticache_subnets_cidr_blocks\"></a> [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | <a name=\"output_elasticache_subnets_ipv6_cidr_blocks\"></a> [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| <a name=\"output_flow_log_log_group_name_prefix\"></a> [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | <a name=\"output_igw_arn\"></a> [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | <a name=\"output_igw_id\"></a> [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | <a name=\"output_intra_network_acl_arn\"></a> [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values (arguments)\n output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | <a name=\"output_elasticache_subnets\"></a> [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | <a name=\"output_elasticache_subnets_cidr_blocks\"></a> [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | <a name=\"output_elasticache_subnets_ipv6_cidr_blocks\"></a> [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| <a name=\"output_flow_log_log_group_name_prefix\"></a> [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | <a name=\"output_igw_arn\"></a> [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | <a name=\"output_igw_id\"></a> [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | <a name=\"output_intra_network_acl_arn\"></a> [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values (arguments)\n output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | <a name=\"output_elasticache_subnets\"></a> [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | <a name=\"output_elasticache_subnets_cidr_blocks\"></a> [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | <a name=\"output_elasticache_subnets_ipv6_cidr_blocks\"></a> [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| <a name=\"output_flow_log_log_group_name_prefix\"></a> [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | <a name=\"output_igw_arn\"></a> [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | <a name=\"output_igw_id\"></a> [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | <a name=\"output_intra_network_acl_arn\"></a> [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values = output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | <a name=\"output_elasticache_subnets\"></a> [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | <a name=\"output_elasticache_subnets_cidr_blocks\"></a> [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | <a name=\"output_elasticache_subnets_ipv6_cidr_blocks\"></a> [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| <a name=\"output_flow_log_log_group_name_prefix\"></a> [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | <a name=\"output_igw_arn\"></a> [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | <a name=\"output_igw_id\"></a> [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | <a name=\"output_intra_network_acl_arn\"></a> [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values (arguments)\n output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n" } ]
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\nAdds `flow_log_log_group_name_prefix` as a output from the module.\r\n\r\n## Motivation and Context\r\n\r\nSee: [#790](https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/790)\r\n\r\n## Breaking Changes\r\n\r\nNo.\r\n\r\n## How Has This Been Tested?\r\n- [X] I have updated at least one of the `examples/*` to demonstrate and validate my change(s)\r\n- [X] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- 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\nThis is my first open source commit so take it easy on me!\n\n---\n\nChoice A:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | <a name=\"output_elasticache_subnets\"></a> [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | <a name=\"output_elasticache_subnets_cidr_blocks\"></a> [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | <a name=\"output_elasticache_subnets_ipv6_cidr_blocks\"></a> [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| <a name=\"output_flow_log_log_group_name_prefix\"></a> [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | <a name=\"output_igw_arn\"></a> [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | <a name=\"output_igw_id\"></a> [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | <a name=\"output_intra_network_acl_arn\"></a> [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values (arguments)\n output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | <a name=\"output_elasticache_subnets\"></a> [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | <a name=\"output_elasticache_subnets_cidr_blocks\"></a> [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | <a name=\"output_elasticache_subnets_ipv6_cidr_blocks\"></a> [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| <a name=\"output_flow_log_log_group_name_prefix\"></a> [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | <a name=\"output_igw_arn\"></a> [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | <a [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | <a name=\"output_intra_network_acl_arn\"></a> [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values (arguments)\n output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | <a name=\"output_elasticache_subnets\"></a> [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | <a name=\"output_elasticache_subnets_cidr_blocks\"></a> [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | <a name=\"output_elasticache_subnets_ipv6_cidr_blocks\"></a> [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| <a name=\"output_flow_log_log_group_name_prefix\"></a> [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | <a name=\"output_igw_arn\"></a> [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | <a name=\"output_igw_id\"></a> [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | <a name=\"output_intra_network_acl_arn\"></a> [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values (arguments)\n output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -518,6 +518,7 @@ No modules.\n | <a name=\"output_elasticache_subnets\"></a> [elasticache\\_subnets](#output\\_elasticache\\_subnets) | List of IDs of elasticache subnets |\n | <a name=\"output_elasticache_subnets_cidr_blocks\"></a> [elasticache\\_subnets\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_cidr\\_blocks) | List of cidr\\_blocks of elasticache subnets |\n | <a name=\"output_elasticache_subnets_ipv6_cidr_blocks\"></a> [elasticache\\_subnets\\_ipv6\\_cidr\\_blocks](#output\\_elasticache\\_subnets\\_ipv6\\_cidr\\_blocks) | List of IPv6 cidr\\_blocks of elasticache subnets in an IPv6 enabled VPC |\n+| <a name=\"output_flow_log_log_group_name_prefix\"></a> [flow\\_log\\_log\\_group\\_name\\_prefix](#output\\_flow\\_log\\_log\\_group\\_name\\_prefix) | The name prefix of the CloudWatch Log Group created for the VPC flow logs. |\n | <a name=\"output_igw_arn\"></a> [igw\\_arn](#output\\_igw\\_arn) | The ARN of the Internet Gateway |\n | <a name=\"output_igw_id\"></a> [igw\\_id](#output\\_igw\\_id) | The ID of the Internet Gateway |\n | <a name=\"output_intra_network_acl_arn\"></a> [intra\\_network\\_acl\\_arn](#output\\_intra\\_network\\_acl\\_arn) | ARN of the intra network ACL |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -7,6 +7,7 @@ locals {\n \n s3_bucket_name = \"vpc-flow-logs-to-s3-${random_pet.this.id}\"\n cloudwatch_log_group_name = \"vpc-flow-logs-to-cloudwatch-${random_pet.this.id}\"\n+ cloudwatch_flow_log_group_name = \"${module.vpc_with_flow_logs_cloudwatch_logs_default.flow_log_log_group_name_prefix}${module.vpc_with_flow_logs_cloudwatch_logs_default.vpc_id}\"\n }\n \n ################################################################################\n@@ -99,6 +100,22 @@ resource \"random_pet\" \"this\" {\n length = 2\n }\n \n+resource \"aws_cloudwatch_log_metric_filter\" \"flow_log_reject\" {\n+ name = \"Flow-Log-Reject\"\n+ pattern = \"REJECT\"\n+ log_group_name = local.cloudwatch_flow_log_group_name\n+\n+ = metric_transformation {\n+ name = \"REJECT\"\n+ namespace = \"FLOW_LOG\"\n+ value = \"1\"\n+ }\n+\n+ depends_on = [\n+ module.vpc_with_flow_logs_cloudwatch_logs_default\n+ ]\n+}\n+\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n---\noutputs.tf\n@@ -534,6 +534,11 @@ output \"vpc_flow_log_cloudwatch_iam_role_arn\" {\n value = local.flow_log_iam_role_arn\n }\n \n+output \"flow_log_log_group_name_prefix\" {\n+ description = \"The name prefix of the CloudWatch Log Group created for the VPC flow logs.\"\n+ value = var.flow_log_cloudwatch_log_group_name_prefix\n+}\n+\n # Static values (arguments)\n output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n---\n\n\n---\n" } ]
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:\nIf you specify Name key in vpc tags, then Name key of vpc tags is overriding Name key of cgw\r\n\r\n## Description\r\n<!--- 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@@ -1155,9 +1155,9 @@ resource \"aws_customer_gateway\" \"this\" {\n \"${var.name}-${each.key}\" type = \"ipsec.1\"\n \n tags = merge(\n- { Name = \"${var.name}-${each.key}\" },\n var.tags,\n var.customer_gateway_tags,\n+ { Name = \"${var.name}-${each.key}\" },\n )\n }\n \n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1155,9 +1155,9 @@ resource \"aws_customer_gateway\" \"this\" {\n type = \"ipsec.1\"\n \n tags = merge(\n- { Name = \"${var.name}-${each.key}\" },\n var.tags,\n var.customer_gateway_tags,\n+ { Name = \"${var.name}-${each.key}\" },\n )\n }\n \n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1155,9 +1155,9 @@ resource \"aws_customer_gateway\" \"this\" {\n type = \"ipsec.1\"\n \n tags = merge(\n- { Name = \"${var.name}-${each.key}\" },\n var.tags,\n var.customer_gateway_tags,\n+ { Name = \"${var.name}-${each.key}\" },\n )\n }\n \n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1155,9 +1155,9 @@ resource \"aws_customer_gateway\" \"this\" {\n type = \"ipsec.1\"\n \n tags = merge(\n- { Name = \"${var.name}-${each.key}\" },\n var.tags,\n var.customer_gateway_tags,\n+ { Name = \"${var.name}-${each.key}\" },\n )\n }\n \n---\n\n\n---\n" } ]
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\r\n## Description\r\nThis change is to allow for create to work within each vpc endpoint object. If the create is outside of a vpc endpoint then that will take priorty over the specific vpc endpoints create.\r\n\r\n## Motivation and Context\r\nThis will make the script alot more flexible and fine grain. As you can go down to object level to specify which objects should be created or not. Making a lot more use cases possible.\r\n\r\n\r\n## Breaking Changes\r\nThe only thing that was introduced that would be debtable is try but it seems try has been there for a long time so seem like it is backwards compatible. \r\n\r\n## How Has This Been Tested?\r\nYes I have an example project which I tested this on. I tested with multiple use cases to make sure.\r\nThis change will also default create to true with object level vpc endpoints just like it has been. Meaning create is still optional for object level and resource level create.\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -121,6 +121,7 @@ module \"vpc_endpoints\" {\n subnet_ids = module.vpc.private_subnets\n },\n \"vpc-flow-logs-s3-bucket\"\n@@ ecs_telemetry = {\n+ create = false\n service = \"ecs-telemetry\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,21 +24,21 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.13.1 |\n-| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.63 |\n-| <a name=\"requirement_random\"></a> [random](#requirement\\_random) | >= 2 |\n+| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.75 |\n+| <a name=\"requirement_random\"></a> [random](#requirement\\_random) | >= 2.0 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.63 |\n-| <a name=\"provider_random\"></a> [random](#provider\\_random) | >= 2 |\n+| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.75 |\n+| <a name=\"provider_random\"></a> [random](#provider\\_random) | >= 2.0 |\n \n ## Modules\n \n | Name | Source | Version |\n |------|--------|---------|\n-| <a name=\"module_s3_bucket\"></a> [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 1.0 |\n+| <a name=\"module_s3_bucket\"></a> [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 3.0 |\n | <a name=\"module_vpc_with_flow_logs_cloudwatch_logs\"></a> [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs) | ../../ | n/a |\n | <a name=\"module_vpc_with_flow_logs_cloudwatch_logs_default\"></a> [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default) | ../../ | n/a |\n | <a name=\"module_vpc_with_flow_logs_s3_bucket\"></a> [vpc\\_with\\_flow\\_logs\\_s3\\_bucket](#module\\_vpc\\_with\\_flow\\_logs\\_s3\\_bucket) | ../../ | n/a |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -24,7 +24,7 @@ module \"vpc_with_flow_logs_s3_bucket\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn = module.s3_bucket.s3_bucket_arn\n \n vpc_flow_log_tags = {\n Name = \"vpc-flow-logs-s3-bucket\"\n@@ -42,7 +42,7 @@ module \"vpc_with_flow_logs_s3_bucket_parquet\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn = module.s3_bucket.s3_bucket_arn\n flow_log_file_format = \"parquet\"\n \n vpc_flow_log_tags = {\n@@ -102,7 +102,7 @@ resource \"random_pet\" \"this\" {\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n- version = \"~> 1.0\"\n+ version = \"~> 3.0\"\n \n bucket = local.s3_bucket_name\n policy = data.aws_iam_policy_document.flow_log_s3.json\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -4,12 +4,12 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.63\"\n+ version = \">= 3.75\"\n }\n \n random = {\n source = \"hashicorp/random\"\n- version = \">= 2\"\n+ version = \">= 2.0\"\n }\n }\n }\n---\nmodules/vpc-endpoints/main.tf\n@@ -15,7 +15,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n \n vpc_id = var.vpc_id\n service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -121,6 +121,7 @@ module \"vpc_endpoints\" {\n subnet_ids = module.vpc.private_subnets\n },\n ecs_telemetry = {\n+ create = false\n service = \"ecs-telemetry\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,21 +24,21 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.13.1 |\n-| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.63 |\n-| <a name=\"requirement_random\"></a> [random](#requirement\\_random) | >= 2 |\n+| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.75 |\n+| <a name=\"requirement_random\"></a> [random](#requirement\\_random) | >= 2.0 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.63 |\n-| <a name=\"provider_random\"></a> [random](#provider\\_random) | >= 2 |\n+| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.75 |\n+| <a name=\"provider_random\"></a> [random](#provider\\_random) | >= 2.0 |\n \n ## Modules\n \n | Name | Source | Version |\n |------|--------|---------|\n-| <a name=\"module_s3_bucket\"></a> [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 1.0 |\n+| <a name=\"module_s3_bucket\"></a> [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 3.0 |\n | <a name=\"module_vpc_with_flow_logs_cloudwatch_logs\"></a> [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs) | ../../ | n/a |\n | <a name=\"module_vpc_with_flow_logs_cloudwatch_logs_default\"></a> [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default) | ../../ | n/a |\n | <a name=\"module_vpc_with_flow_logs_s3_bucket\"></a> [vpc\\_with\\_flow\\_logs\\_s3\\_bucket](#module\\_vpc\\_with\\_flow\\_logs\\_s3\\_bucket) | ../../ | n/a |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -24,7 +24,7 @@ module \"vpc_with_flow_logs_s3_bucket\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn = module.s3_bucket.s3_bucket_arn\n \n vpc_flow_log_tags = {\n Name = \"vpc-flow-logs-s3-bucket\"\n@@ -42,7 +42,7 @@ module \"vpc_with_flow_logs_s3_bucket_parquet\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn = module.s3_bucket.s3_bucket_arn\n flow_log_file_format = \"parquet\"\n \n vpc_flow_log_tags = {\n@@ -102,7 +102,7 @@ resource \"random_pet\" \"this\" {\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n- version = \"~> 1.0\"\n+ version = \"~> 3.0\"\n \n bucket = local.s3_bucket_name\n policy = data.aws_iam_policy_document.flow_log_s3.json\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -4,12 +4,12 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.63\"\n+ version = \">= 3.75\"\n }\n \n random = {\n source = \"hashicorp/random\"\n- version = \">= 2\"\n+ version = \">= 2.0\"\n }\n }\n }\n---\nmodules/vpc-endpoints/main.tf\n@@ -15,7 +15,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n \n vpc_id = var.vpc_id\n service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -121,6 +121,7 @@ module \"vpc_endpoints\" {\n subnet_ids = module.vpc.private_subnets\n },\n ecs_telemetry = {\n+ create = false\n service = \"ecs-telemetry\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,21 +24,21 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.13.1 |\n-| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.63 |\n-| <a name=\"requirement_random\"></a> [random](#requirement\\_random) | >= 2 |\n+| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.75 |\n+| <a name=\"requirement_random\"></a> [random](#requirement\\_random) | >= 2.0 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.63 |\n-| <a name=\"provider_random\"></a> [random](#provider\\_random) | >= 2 |\n+| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.75 |\n+| <a name=\"provider_random\"></a> [random](#provider\\_random) | >= 2.0 |\n \n ## Modules\n \n | Name | Source | Version |\n |------|--------|---------|\n-| <a name=\"module_s3_bucket\"></a> [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 1.0 |\n+| <a name=\"module_s3_bucket\"></a> [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 3.0 |\n | <a name=\"module_vpc_with_flow_logs_cloudwatch_logs\"></a> [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs) | ../../ | n/a |\n | <a name=\"module_vpc_with_flow_logs_cloudwatch_logs_default\"></a> [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default) | ../../ | n/a |\n | <a name=\"module_vpc_with_flow_logs_s3_bucket\"></a> [vpc\\_with\\_flow\\_logs\\_s3\\_bucket](#module\\_vpc\\_with\\_flow\\_logs\\_s3\\_bucket) | ../../ | n/a |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -24,7 +24,7 @@ module \"vpc_with_flow_logs_s3_bucket\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn |\n-| = module.s3_bucket.s3_bucket_arn\n \n vpc_flow_log_tags = {\n Name = \"vpc-flow-logs-s3-bucket\"\n@@ -42,7 +42,7 @@ module \"vpc_with_flow_logs_s3_bucket_parquet\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn = module.s3_bucket.s3_bucket_arn\n flow_log_file_format = \"parquet\"\n \n vpc_flow_log_tags = {\n@@ -102,7 +102,7 @@ resource \"random_pet\" \"this\" {\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n- version = \"~> 1.0\"\n+ version = \"~> 3.0\"\n \n bucket = local.s3_bucket_name\n policy = data.aws_iam_policy_document.flow_log_s3.json\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -4,12 +4,12 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.63\"\n+ version = \">= 3.75\"\n }\n \n random = {\n source = \"hashicorp/random\"\n- version = \">= 2\"\n+ version = \">= 2.0\"\n }\n }\n }\n---\nmodules/vpc-endpoints/main.tf\n@@ -15,7 +15,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n \n vpc_id = var.vpc_id\n service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -121,6 +121,7 @@ module \"vpc_endpoints\" {\n subnet_ids = module.vpc.private_subnets\n },\n ecs_telemetry = {\n+ create = false\n service = \"ecs-telemetry\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,21 +24,21 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.13.1 |\n-| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.63 |\n-| <a name=\"requirement_random\"></a> [random](#requirement\\_random) | >= 2 |\n+| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.75 |\n+| <a name=\"requirement_random\"></a> [random](#requirement\\_random) | >= 2.0 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.63 |\n-| <a name=\"provider_random\"></a> [random](#provider\\_random) | >= 2 |\n+| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.75 |\n+| <a name=\"provider_random\"></a> [random](#provider\\_random) | >= 2.0 |\n \n ## Modules\n \n | Name | Source | Version |\n |------|--------|---------|\n-| <a name=\"module_s3_bucket\"></a> [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 1.0 |\n+| <a name=\"module_s3_bucket\"></a> [s3\\_bucket](#module\\_s3\\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 3.0 |\n | <a name=\"module_vpc_with_flow_logs_cloudwatch_logs\"></a> [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs) | ../../ | n/a |\n | <a name=\"module_vpc_with_flow_logs_cloudwatch_logs_default\"></a> [vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default](#module\\_vpc\\_with\\_flow\\_logs\\_cloudwatch\\_logs\\_default) | ../../ | n/a |\n | <a name=\"module_vpc_with_flow_logs_s3_bucket\"></a> [vpc\\_with\\_flow\\_logs\\_s3\\_bucket](#module\\_vpc\\_with\\_flow\\_logs\\_s3\\_bucket) | ../../ | n/a |\n---\nexamples/vpc-flow-logs/main.tf\n@@ -24,7 +24,7 @@ module \"vpc_with_flow_logs_s3_bucket\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn = module.s3_bucket.s3_bucket_arn\n \n vpc_flow_log_tags = {\n Name = \"vpc-flow-logs-s3-bucket\"\n@@ -42,7 +42,7 @@ module \"vpc_with_flow_logs_s3_bucket_parquet\" {\n \n enable_flow_log = true\n flow_log_destination_type = \"s3\"\n- flow_log_destination_arn = module.s3_bucket.this_s3_bucket_arn\n+ flow_log_destination_arn = module.s3_bucket.s3_bucket_arn\n flow_log_file_format = \"parquet\"\n \n vpc_flow_log_tags = {\n@@ -102,7 +102,7 @@ resource \"random_pet\" \"this\" {\n # S3 Bucket\n module \"s3_bucket\" {\n source = \"terraform-aws-modules/s3-bucket/aws\"\n- version = \"~> 1.0\"\n+ version = \"~> 3.0\"\n \n bucket = local.s3_bucket_name\n policy = data.aws_iam_policy_document.flow_log_s3.json\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -4,12 +4,12 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.63\"\n+ version = \">= 3.75\"\n }\n \n random = {\n source = \"hashicorp/random\"\n- version = \">= 2\"\n+ version = \">= 2.0\"\n }\n }\n }\n---\nmodules/vpc-endpoints/main.tf\n@@ -15,7 +15,7 @@ data \"aws_vpc_endpoint_service\" \"this\" {\n }\n \n resource \"aws_vpc_endpoint\" \"this\" {\n- for_each = { for k, v in var.endpoints : k => v if var.create }\n+ for_each = { for k, v in var.endpoints : k => v if var.create && try(v.create, true) }\n \n vpc_id = var.vpc_id\n service_name = data.aws_vpc_endpoint_service.this[each.key].service_name\n---\n\n\n---\n" } ]
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- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nexamples/simple-vpc/main.tf\n@@ -11,7 +11,7 @@ locals name ################################################################################\n \n module \"vpc\" {\n- source = \"../../\"\n+ source = \"https://github.com/terraform-aws-modules/terraform-aws-vpc\"\n \n name = \"simple-example\"\n cidr = \"10.0.0.0/16\"\n---\n\n\n---\n\nChoice B:\nexamples/simple-vpc/main.tf\n@@ -11,7 +11,7 @@ locals {\n ################################################################################\n \n module \"vpc\" {\n- source = \"../../\"\n+ source = \"https://github.com/terraform-aws-modules/terraform-aws-vpc\"\n \n name = \"simple-example\"\n \"simple-example\"\n cidr = \"10.0.0.0/16\"\n---\n\n\n---\n\nChoice C:\nexamples/simple-vpc/main.tf\n@@ -11,7 +11,7 @@ locals {\n ################################################################################\n \n module \"vpc\" {\n- source = \"../../\"\n+ source = \"https://github.com/terraform-aws-modules/terraform-aws-vpc\"\n \n name = \"simple-example\"\n cidr = \"10.0.0.0/16\"\n---\n\n\n---\n\nChoice D:\nexamples/simple-vpc/main.tf\n@@ -11,7 +11,7 @@ locals {\n \n module \"vpc\" {\n- source = \"../../\"\n+ source = \"https://github.com/terraform-aws-modules/terraform-aws-vpc\"\n \n name = \"simple-example\"\n cidr = \"10.0.0.0/16\"\n---\n\n\n---\n" } ]
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\nUpdated `examples/complete-vpc/main.tf` to allow HTTPS from VPC to ssmmessages and ec2messages endpoints\r\n\r\n## Motivation and Context\r\n\r\nEnabling endpoints exactly as described in `examples/complete-vpc/main.tf` breaks SSM communication.\r\n\r\nAs per \r\n\r\n- https://docs.aws.amazon.com/systems-manager/latest/userguide/setup-create-vpc.html\r\n- https://aws.amazon.com/premiumsupport/knowledge-center/ec2-systems-manager-vpc-endpoints/ \r\n\r\nHTTPS (port 443) outbound traffic to the following endpoints must be allowed\r\n\r\n ssm.region.amazonaws.com\r\n ssmmessages.region.amazonaws.com\r\n ec2messages.region.amazonaws.com\r\n\r\n## Breaking Changes\r\nN.A.\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -109,6 +109,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -135,6 +136,7 @@ module \"vpc_endpoints\" {\n service = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = @@ service = \"ecr.api\"\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -109,6 +109,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -135,6 +136,7 @@ module \"vpc_endpoints\" {\n service = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = {\n service = \"ecr.api\"\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -109,6 +109,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -135,6 +136,7 @@ module \"vpc_endpoints\" {\n service = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = {\n service = \"ecr.api\"\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -109,6 +109,7 @@ module \"vpc_endpoints\" {\n service = \"ssmmessages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n lambda = {\n service = \"lambda\"\n@@ -135,6 +136,7 @@ module \"vpc_endpoints\" {\n service = \"ec2messages\"\n private_dns_enabled = true\n subnet_ids = module.vpc.private_subnets\n+ security_group_ids = [aws_security_group.vpc_tls.id]\n },\n ecr_api = {\n service = \"ecr.api\"\n---\n\n\n---\n" } ]
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- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.outpost_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -311,6 +312,22 @@ resource \"aws_route_table\" \"redshift\" {\n )\n }\n \n+################################################################################\n+# Outposts routes\n+################################################################################\n+\n+resource \"aws_route_table\" \"outpost\" {\n+ count = var.create_vpc && var.create_outpost_subnet_route_table && length(var.outpost_subnets) > 0 ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+\n+ tags = merge(\n+ { \"Name\" = \"${var.name}-${var.outpost_subnet_suffix}\" },\n+ var.tags,\n+ var.outpost_route_table_tags,\n+ )\n+}\n+\n ################################################################################\n # Elasticache routes\n ################################################################################\n@@ -1076,11 +1093,8 @@ resource \"aws_route_table_association\" \"private\" {\n resource \"aws_route_table_association\" \"outpost\" {\n count = var.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n- subnet_id = element(aws_subnet.outpost[*].id, count.index)\n- route_table_id = element(\n- aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n- )\n+ subnet_id = element(aws_subnet.outpost[*].id, count.index)\n+ route_table_id = element(aws_route_table.outpost[*].id, 0)\n }\n \n resource \"aws_route_table_association\" \"database\" {\n---\noutputs.tf\n@@ -238,6 +238,11 @@ output \"public_route_table_ids\" {\n value bool\n@@ = aws_route_table.public[*].id\n }\n \n+output \"outpost_route_table_ids\" {\n+ description = \"List of IDs of outpost route tables\"\n+ value = aws_route_table.outpost[*].id\n+}\n+\n output \"private_route_table_ids\" {\n description = \"List of IDs of private route tables\"\n value = aws_route_table.private[*].id\n---\nvariables.tf\n@@ -214,6 +214,12 @@ variable \"create_database_subnet_route_table\" {\n default = false\n }\n \n+variable \"create_outpost_subnet_route_table\" {\n+ description = \"Controls if separate route table for outpost should be created\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_redshift_subnet_route_table\" {\n description = \"Controls if separate route table for redshift should be created\"\n type = bool\n@@ -478,6 +484,12 @@ variable \"redshift_route_table_tags\" {\n default = {}\n }\n \n+variable \"outpost_route_table_tags\" {\n+ description = \"Additional tags for the outpost route tables\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"elasticache_route_table_tags\" {\n description = \"Additional tags for the elasticache route tables\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.outpost_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -311,6 +312,22 @@ resource \"aws_route_table\" \"redshift\" {\n )\n }\n \n+################################################################################\n+# Outposts routes\n+################################################################################\n+\n+resource \"aws_route_table\" \"outpost\" {\n+ count = var.create_vpc && var.create_outpost_subnet_route_table && length(var.outpost_subnets) > 0 ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+\n+ tags = merge(\n+ { \"Name\" = \"${var.name}-${var.outpost_subnet_suffix}\" },\n+ var.tags,\n+ var.outpost_route_table_tags,\n+ )\n+}\n+\n ################################################################################\n # Elasticache routes\n ################################################################################\n@@ -1076,11 +1093,8 @@ resource \"aws_route_table_association\" \"private\" {\n resource \"aws_route_table_association\" \"outpost\" {\n count = var.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n- subnet_id = element(aws_subnet.outpost[*].id, count.index)\n- route_table_id = element(\n- \"Additional aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n- )\n+ subnet_id = element(aws_subnet.outpost[*].id, count.index)\n+ route_table_id = element(aws_route_table.outpost[*].id, 0)\n }\n \n resource \"aws_route_table_association\" \"database\" {\n---\noutputs.tf\n@@ -238,6 +238,11 @@ output \"public_route_table_ids\" {\n value = aws_route_table.public[*].id\n }\n \n+output \"outpost_route_table_ids\" {\n+ description = \"List of IDs of outpost route tables\"\n+ value = aws_route_table.outpost[*].id\n+}\n+\n output \"private_route_table_ids\" {\n description = \"List of IDs of private route tables\"\n value = aws_route_table.private[*].id\n---\nvariables.tf\n@@ -214,6 +214,12 @@ variable \"create_database_subnet_route_table\" {\n default = false\n }\n \n+variable \"create_outpost_subnet_route_table\" {\n+ description = \"Controls if separate route table for outpost should be created\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_redshift_subnet_route_table\" {\n description = \"Controls if separate route table for redshift should be created\"\n type = bool\n@@ -478,6 +484,12 @@ variable \"redshift_route_table_tags\" {\n default = {}\n }\n \n+variable \"outpost_route_table_tags\" {\n+ description = \"Additional tags for the outpost route tables\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"elasticache_route_table_tags\" {\n description = \"Additional tags for the elasticache route tables\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.outpost_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -311,6 +312,22 @@ resource \"aws_route_table\" \"redshift\" {\n )\n }\n \n+################################################################################\n+# Outposts routes\n+################################################################################\n+\n+resource \"aws_route_table\" \"outpost\" {\n+ count = var.create_vpc && var.create_outpost_subnet_route_table && length(var.outpost_subnets) > 0 ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+\n+ tags = merge(\n+ { \"Name\" = \"${var.name}-${var.outpost_subnet_suffix}\" },\n+ var.tags,\n+ var.outpost_route_table_tags,\n+ )\n+}\n+\n ################################################################################\n # Elasticache routes\n ################################################################################\n@@ -1076,11 +1093,8 @@ resource \"aws_route_table_association\" \"private\" {\n resource \"aws_route_table_association\" \"outpost\" {\n count = var.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n- subnet_id = element(aws_subnet.outpost[*].id, count.index)\n- route_table_id = element(\n- aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n- )\n+ subnet_id = element(aws_subnet.outpost[*].id, count.index)\n+ route_table_id = element(aws_route_table.outpost[*].id, 0)\n }\n \n resource \"aws_route_table_association\" \"database\" {\n---\noutputs.tf\n@@ -238,6 +238,11 @@ output \"public_route_table_ids\" {\n value = aws_route_table.public[*].id\n }\n \n+output \"outpost_route_table_ids\" {\n+ description = \"List of IDs of outpost route tables\"\n+ value = aws_route_table.outpost[*].id\n+}\n+\n output \"private_route_table_ids\" {\n description = \"List of IDs of private route tables\"\n value = aws_route_table.private[*].id\n---\nvariables.tf\n@@ -214,6 +214,12 @@ variable \"create_database_subnet_route_table\" {\n default = false\n }\n \n+variable \"create_outpost_subnet_route_table\" {\n+ description = \"Controls if separate route table for outpost should be created\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_redshift_subnet_route_table\" {\n description = \"Controls if separate route table for redshift should be created\"\n type = bool\n@@ -478,6 +484,12 @@ variable \"redshift_route_table_tags\" {\n default = {}\n }\n \n+variable \"outpost_route_table_tags\" {\n+ description = \"Additional tags for the outpost route tables\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"elasticache_route_table_tags\" {\n description = \"Additional tags for the elasticache route tables\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.outpost_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -311,6 +312,22 @@ resource \"aws_route_table\" \"redshift\" {\n )\n }\n \n+################################################################################\n+# Outposts routes\n+################################################################################\n+\n+resource \"aws_route_table\" \"outpost\" {\n+ count = var.create_vpc && var.create_outpost_subnet_route_table && length(var.outpost_subnets) > 0 ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+\n+ tags = merge(\n+ { \"Name\" = \"${var.name}-${var.outpost_subnet_suffix}\" },\n+ var.tags,\n+ var.outpost_route_table_tags,\n+ )\n+}\n+\n ################################################################################\n # Elasticache routes\n ################################################################################\n@@ -1076,11 +1093,8 @@ resource \"aws_route_table_association\" \"private\" {\n resource \"aws_route_table_association\" \"outpost\" {\n count = var.create_vpc && length(var.outpost_subnets) > 0 ? length(var.outpost_subnets) : 0\n \n- subnet_id = element(aws_subnet.outpost[*].id, count.index)\n- route_table_id = element(\n- aws_route_table.private[*].id,\n- var.single_nat_gateway ? 0 : count.index,\n- )\n+ subnet_id = element(aws_subnet.outpost[*].id, count.index)\n+ route_table_id = element(aws_route_table.outpost[*].id, 0)\n }\n \n resource \"aws_route_table_association\" \"database\" {\n---\noutputs.tf\n@@ -238,6 +238,11 @@ output \"public_route_table_ids\" {\n value = aws_route_table.public[*].id\n }\n \n+output \"outpost_route_table_ids\" {\n+ description = \"List of IDs of outpost route tables\"\n+ value = aws_route_table.outpost[*].id\n+}\n+\n output \"private_route_table_ids\" {\n description = \"List of IDs of private route tables\"\n value = aws_route_table.private[*].id\n---\nvariables.tf\n@@ -214,6 +214,12 @@ variable \"create_database_subnet_route_table\" {\n default = false\n }\n \n+variable \"create_outpost_subnet_route_table\" {\n+ description = \"Controls if separate route table for outpost should be created\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_redshift_subnet_route_table\" {\n description = \"Controls if separate route table for redshift should be created\"\n type = bool\n@@ -478,6 +484,12 @@ variable \"redshift_route_table_tags\" {\n default = {}\n }\n \n+variable \"outpost_route_table_tags\" {\n+ description = \"Additional tags for the outpost route tables\"\n+ type = map(string)\n+ default = variable \"elasticache_route_table_tags\" {\n description = \"Additional tags for the elasticache route tables\"\n type = map(string)\n---\n\n\n---\n" } ]
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\nAllows Vpc to have a nat gateway even with no private subnets\r\n\r\n## Motivation and Context\r\nError with below nat_gateway configs:\r\n\r\nprivate_subnet \"NOT SET\"\r\n\r\nenable_nat_gateway = true\r\nsingle_nat_gateway = true\r\none_nat_gateway_per_az = false\r\n\r\n│ Error: Error in function call\r\n│\r\n│ on .terraform/modules/openvpn_vpc/main.tf line 905, in resource \"aws_route\" \"private_nat_gateway\":\r\n│ 905: route_table_id = element(aws_route_table.private.*.id, count.index)\r\n│ ├────────────────\r\n│ │ aws_route_table.private is empty tuple\r\n│ │ count.index is 0\r\n│\r\n│ Call to function \"element\" failed: cannot use element function with an empty list.\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\nterraform apply with mentioned configs is running\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1040,7 +1040,7 : resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" 0 {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n" } ]
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\nAllows Vpc to have a nate gateway even with no private subnets\r\n\r\n## Motivation and Context\r\nError with below nat_gateway configs with no private subnet\r\n\r\n enable_nat_gateway = true \r\n single_nat_gateway = true \r\n one_nat_gateway_per_az = false\r\n\r\n│ Error: Error in function call\r\n│ \r\n│ on .terraform/modules/openvpn_vpc/main.tf line 905, in resource \"aws_route\" \"private_nat_gateway\":\r\n│ 905: route_table_id = element(aws_route_table.private.*.id, count.index)\r\n│ ├────────────────\r\n│ │ aws_route_table.private is empty tuple\r\n│ │ count.index is 0\r\n│ \r\n│ Call to function \"element\" failed: cannot use element function with an empty list.\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\nterraform apply with mentioned configs is running\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 count local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway main.tf\n@@ local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n" } ]
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 Vpc to have a nate gateway even with no private subnets\r\n\r\n## Motivation and Context\r\nError with below nat_gateway configs with no private subnet\r\n\r\n enable_nat_gateway = true \r\n single_nat_gateway = true \r\n one_nat_gateway_per_az = false\r\n\r\n│ Error: Error in function call\r\n│ \r\n│ on .terraform/modules/openvpn_vpc/main.tf line 905, in resource \"aws_route\" \"private_nat_gateway\":\r\n│ 905: route_table_id = element(aws_route_table.private.*.id, count.index)\r\n│ ├────────────────\r\n│ │ aws_route_table.private is empty tuple\r\n│ │ count.index is 0\r\n│ \r\n│ Call to function \"element\" failed: cannot use element function with an empty list.\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\nterraform apply with mentioned configs is running\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -1040,7 +1040,7 @@ \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1040,7 +1040,7 @@ resource \"aws_nat_gateway\" \"this\" {\n }\n \n resource \"aws_route\" \"private_nat_gateway\" {\n- count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n+ count = var.create_vpc && var.enable_nat_gateway && length(var.private_subnets) > 0 ? local.nat_gateway_count : 0\n \n route_table_id main.tf\n@@ = element(aws_route_table.private[*].id, count.index)\n destination_cidr_block = var.nat_gateway_destination_cidr_block\n---\n\n\n---\n" } ]
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\nWhen having a VPC with public and private subnets, there are cases where traffic from the private subnet that is destined for `0.0.0.0/0` does not need to go to the NAT Gateway but instead, it should be sent to another destination (e.g., transit gateway). And then only specific traffic that is destined for the internet (e.g., 8.8.8.8/32) should be sent to the NAT Gateway.\r\n\r\nTherefore, this change adds a new conditional variable that enables us to pass a custom destination CIDR block for the NAT Gateway.\r\n\r\n## Motivation and Context\r\n<!--- 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\nWhen having a VPC with public and private subnets, there are cases where traffic from the private subnet that is destined for `0.0.0.0/0` does not need to go to the NAT Gateway but instead, it should be sent to another destination (e.g., transit gateway). And then only specific traffic that is destined for the internet (e.g., 8.8.8.8/32) should be sent to the NAT Gateway.\r\n\r\n## Breaking Changes\r\n<!-- 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 breaking changes were noticed.\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -410,6 +410,7 @@ No modules.\n | <a name=\"input_map_public_ip_on_launch\"></a> [map\\_public\\_ip\\_on\\_launch](#input\\_map\\_public\\_ip\\_on\\_launch) | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n | <a name=\"input_name\"></a> [name](#input\\_name) | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\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_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---\nmain.tf\n@@ -1043,7 +1043,7 @@ resource \"aws_route\" \"private_nat_gateway\" {\n count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n- destination_cidr_block = \"0.0.0.0/0\"\n+ destination_cidr_block = var.nat_gateway_destination_cidr_block\n nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n \n timeouts {\n---\nvariables.tf\n@@ -298,6 +298,12 @@ variable \"enable_nat_gateway\" {\n default = false\n }\n \n+variable \"nat_gateway_destination_cidr_block\" {\n+ description = \"Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route.\"\n+ type = string\n+ default = \"0.0.0.0/0\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -410,6 +410,7 @@ No modules.\n | <a name=\"input_map_public_ip_on_launch\"></a> [map\\_public\\_ip\\_on\\_launch](#input\\_map\\_public\\_ip\\_on\\_launch) | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n | <a name=\"input_name\"></a> [name](#input\\_name) | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\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_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---\nmain.tf\n@@ -1043,7 +1043,7 @@ resource \"aws_route\" \"private_nat_gateway\" {\n count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n- destination_cidr_block = \"0.0.0.0/0\"\n+ destination_cidr_block = var.nat_gateway_destination_cidr_block\n to nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n \n timeouts {\n---\nvariables.tf\n@@ -298,6 +298,12 @@ variable \"enable_nat_gateway\" {\n default = false\n }\n \n+variable \"nat_gateway_destination_cidr_block\" {\n+ description = \"Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a destination route.\"\n+ type = string\n+ default = \"0.0.0.0/0\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -410,6 +410,7 @@ No modules.\n | <a name=\"input_map_public_ip_on_launch\"></a> [map\\_public\\_ip\\_on\\_launch](#input\\_map\\_public\\_ip\\_on\\_launch) | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n | <a name=\"input_name\"></a> [name](#input\\_name) | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\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_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---\nmain.tf\n@@ -1043,7 +1043,7 @@ resource \"aws_route\" \"private_nat_gateway\" {\n count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n- destination_cidr_block = \"0.0.0.0/0\"\n+ destination_cidr_block = var.nat_gateway_destination_cidr_block\n nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n \n timeouts {\n---\nvariables.tf\n@@ -298,6 +298,12 @@ variable \"enable_nat_gateway\" {\n default = false\n }\n \n+variable \"nat_gateway_destination_cidr_block\" {\n+ description = \"Used to pass a custom destination route for private NAT Gateway. If not specified, | default 0.0.0.0/0 is used as a destination route.\"\n+ type = string\n+ default = \"0.0.0.0/0\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -410,6 +410,7 @@ No modules.\n | <a name=\"input_map_public_ip_on_launch\"></a> [map\\_public\\_ip\\_on\\_launch](#input\\_map\\_public\\_ip\\_on\\_launch) | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n | <a name=\"input_name\"></a> [name](#input\\_name) | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\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_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---\nmain.tf\n@@ -1043,7 +1043,7 @@ resource \"aws_route\" \"private_nat_gateway\" {\n count = var.create_vpc && var.enable_nat_gateway ? local.nat_gateway_count : 0\n \n route_table_id = element(aws_route_table.private[*].id, count.index)\n- destination_cidr_block = \"0.0.0.0/0\"\n+ destination_cidr_block = var.nat_gateway_destination_cidr_block\n nat_gateway_id = element(aws_nat_gateway.this[*].id, count.index)\n \n timeouts {\n---\nvariables.tf\n@@ -298,6 +298,12 @@ variable \"enable_nat_gateway\" {\n default = false\n }\n \n+variable \"nat_gateway_destination_cidr_block\" {\n+ description = \"Used to pass a custom destination route for private NAT Gateway. If not specified, the default 0.0.0.0/0 is used as a route.\"\n+ type = string\n+ default = \"0.0.0.0/0\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n---\n\n\n---\n" } ]
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 as outputs maps of AZ to subnet ID for each subnet type (private, public, database, etc)\r\n\r\n## Motivation and Context\r\nHaving a mapping of which subnets were created in each AZ is useful e.g. when creating EKS node groups for each AZ with the terraform EKS module. This output would allow creation of per-az node groups with the AZ in the node group name.\r\n\r\n## Breaking Changes\r\nDoes not break backward compatibility with anything, it is just a collection of new outputs.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [ ] Verified that the output works with no subnets and also multiple subnets\r\n\n\n---\n\nChoice A:\noutputs.tf\n@@ -68,6 +68,11 @@ output \"vpc_owner_id\" {\n value = try(aws_vpc.this[0].owner_id, \"\")\n }\n \n+output \"private_subnet_resources\" {\n+ description = \"List of private subnet resources\"\n+ value = aws_subnet.private\n+}\n+\n output \"private_subnets\" {\n description = \"List of IDs of private subnets\"\n value = aws_subnet.private[*].id\n@@ -88,6 +93,11 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private[*].ipv6_cidr_block\n }\n \n+output \"public_subnet_resources\" {\n+ description = \"List of public subnet resources\"\n+ value = aws_subnet.public\n+}\n+\n output \"public_subnets\" {\n description = \"List of IDs of public subnets\"\n value = aws_subnet.public[*].id\n@@ -108,6 +118,11 @@ output \"public_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.public[*].ipv6_cidr_block\n }\n \n+output \"outpost_subnet_resources\" {\n+ description = \"List of outpost subnet resources\"\n+ value = aws_subnet.outpost\n+}\n+\n output \"outpost_subnets\" {\n description = \"List of IDs of outpost subnets\"\n value = aws_subnet.outpost[*].id\n@@ -128,6 +143,11 @@ output \"outpost_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.outpost[*].ipv6_cidr_block\n }\n \n+output \"database_subnet_resources\" {\n+ description = \"List of database subnet resources\"\n+ value = aws_subnet.database\n+}\n+\n output \"database_subnets\" {\n description = \"List of IDs of database subnets\"\n value = aws_subnet.database[*].id\n@@ -158,6 +178,11 @@ output \"database_subnet_group_name\" {\n value = try(aws_db_subnet_group.database[0].name, \"\")\n }\n \n+output \"redshift_subnet_resources\" {\n+ description = \"List of redshift subnet resources\"\n+ value = aws_subnet.redshift\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value = aws_subnet.redshift[*].id\n@@ -183,6 +208,11 @@ output \"redshift_subnet_group\" {\n value = try(aws_redshift_subnet_group.redshift[0].id, \"\")\n }\n \n+output \"elasticache_subnet_resources\" {\n+ description = \"List of elasticache subnet resources\"\n+ value = aws_subnet.elasticache\n+}\n+\n output \"elasticache_subnets\" {\n description = \"List of IDs of elasticache subnets\"\n value = aws_subnet.elasticache[*].id\n@@ -203,6 +233,11 @@ output \"elasticache_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.elasticache[*].ipv6_cidr_block\n }\n \n+output \"intra_subnet_resources\" {\n+ description = \"List of intra subnet resources\"\n+ value = aws_subnet.intra\n+}\n+\n output \"intra_subnets\" {\n description = \"List of IDs of intra subnets\"\n value = aws_subnet.intra[*].id\n---\n\n\n---\n\nChoice B:\noutputs.tf\n@@ -68,6 +68,11 @@ output \"vpc_owner_id\" {\n value = try(aws_vpc.this[0].owner_id, \"\")\n }\n \n+output \"private_subnet_resources\" {\n+ description = \"List of private subnet resources\"\n+ value = aws_subnet.private\n+}\n+\n output \"private_subnets\" {\n description = \"List of IDs of private subnets\"\n value = aws_subnet.private[*].id\n@@ -88,6 +93,11 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private[*].ipv6_cidr_block\n \n+output \"public_subnet_resources\" {\n+ description = \"List of public subnet resources\"\n+ value = aws_subnet.public\n+}\n+\n output \"public_subnets\" {\n description = \"List of IDs of public subnets\"\n value = aws_subnet.public[*].id\n@@ -108,6 +118,11 @@ output \"public_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.public[*].ipv6_cidr_block\n }\n \n+output \"outpost_subnet_resources\" {\n+ description = \"List of outpost subnet resources\"\n+ value = aws_subnet.outpost\n+}\n+\n output \"outpost_subnets\" {\n description = \"List of IDs of outpost subnets\"\n value = aws_subnet.outpost[*].id\n@@ -128,6 +143,11 @@ output \"outpost_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.outpost[*].ipv6_cidr_block\n }\n \n+output \"database_subnet_resources\" {\n+ description = \"List of database subnet resources\"\n+ value = aws_subnet.database\n+}\n+\n output \"database_subnets\" {\n description = \"List of IDs of database subnets\"\n value = aws_subnet.database[*].id\n@@ -158,6 +178,11 @@ output \"database_subnet_group_name\" {\n value = try(aws_db_subnet_group.database[0].name, \"\")\n }\n \n+output \"redshift_subnet_resources\" {\n+ description = \"List of redshift subnet resources\"\n+ value = aws_subnet.redshift\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value = aws_subnet.redshift[*].id\n@@ -183,6 +208,11 @@ output \"redshift_subnet_group\" {\n value = try(aws_redshift_subnet_group.redshift[0].id, \"\")\n }\n \n+output \"elasticache_subnet_resources\" {\n+ description = \"List of elasticache subnet resources\"\n+ value = aws_subnet.elasticache\n+}\n+\n output \"elasticache_subnets\" {\n description = \"List of IDs of elasticache subnets\"\n value = aws_subnet.elasticache[*].id\n@@ -203,6 +233,11 @@ output \"elasticache_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.elasticache[*].ipv6_cidr_block\n }\n \n+output \"intra_subnet_resources\" {\n+ description = \"List of intra subnet resources\"\n+ value = aws_subnet.intra\n+}\n+\n output \"intra_subnets\" {\n description = \"List of IDs of intra subnets\"\n value = aws_subnet.intra[*].id\n---\n\n\n---\n\nChoice C:\noutputs.tf\n@@ -68,6 +68,11 @@ output \"vpc_owner_id\" {\n value = try(aws_vpc.this[0].owner_id, \"\")\n }\n \n+output \"private_subnet_resources\" {\n+ description = \"List of private subnet resources\"\n+ value = aws_subnet.private\n+}\n+\n output \"private_subnets\" {\n description = \"List of IDs of private subnets\"\n value = aws_subnet.private[*].id\n@@ -88,6 +93,11 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private[*].ipv6_cidr_block\n }\n \n+output \"public_subnet_resources\" {\n+ description = \"List of public subnet resources\"\n+ value = aws_subnet.public\n+}\n+\n output \"public_subnets\" {\n description = \"List of IDs of public subnets\"\n value = aws_subnet.public[*].id\n@@ -108,6 +118,11 @@ output \"public_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.public[*].ipv6_cidr_block\n }\n \n+output \"outpost_subnet_resources\" {\n+ description = \"List of outpost subnet resources\"\n+ value = aws_subnet.outpost\n+}\n+\n output \"outpost_subnets\" {\n description = \"List of IDs of outpost subnets\"\n value = aws_subnet.outpost[*].id\n@@ -128,6 +143,11 @@ output \"outpost_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.outpost[*].ipv6_cidr_block\n }\n \n+output \"database_subnet_resources\" {\n+ description = \"List of database subnet resources\"\n+ value = aws_subnet.database\n+}\n+\n output \"database_subnets\" {\n description = \"List of IDs of database subnets\"\n value = aws_subnet.database[*].id\n@@ -158,6 +178,11 @@ output \"database_subnet_group_name\" {\n value = try(aws_db_subnet_group.database[0].name, \"\")\n }\n \n+output \"redshift_subnet_resources\" {\n+ description = \"List of redshift subnet resources\"\n+ value = aws_subnet.redshift\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value description = aws_subnet.redshift[*].id\n@@ -183,6 +208,11 @@ output \"redshift_subnet_group\" {\n value = try(aws_redshift_subnet_group.redshift[0].id, \"\")\n }\n \n+output \"elasticache_subnet_resources\" {\n+ description = \"List of elasticache subnet resources\"\n+ value = aws_subnet.elasticache\n+}\n+\n output \"elasticache_subnets\" {\n description = \"List of IDs of elasticache subnets\"\n value = aws_subnet.elasticache[*].id\n@@ -203,6 +233,11 @@ output \"elasticache_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.elasticache[*].ipv6_cidr_block\n }\n \n+output \"intra_subnet_resources\" {\n+ description = \"List of intra subnet resources\"\n+ value = aws_subnet.intra\n+}\n+\n output \"intra_subnets\" {\n description = \"List of IDs of intra subnets\"\n value = aws_subnet.intra[*].id\n---\n\n\n---\n\nChoice D:\noutputs.tf\n@@ -68,6 +68,11 @@ output \"vpc_owner_id\" {\n value = try(aws_vpc.this[0].owner_id, \"\")\n }\n \n+output \"private_subnet_resources\" {\n+ description = \"List of private subnet resources\"\n+ value = aws_subnet.private\n+}\n+\n output \"private_subnets\" {\n description = \"List of IDs of private subnets\"\n value = aws_subnet.private[*].id\n@@ -88,6 +93,11 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private[*].ipv6_cidr_block\n }\n \n+output \"public_subnet_resources\" {\n+ description = \"List of public subnet resources\"\n+ value = aws_subnet.public\n+}\n+\n output \"public_subnets\" {\n description = \"List of IDs of public subnets\"\n value = aws_subnet.public[*].id\n@@ -108,6 +118,11 @@ output \"public_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.public[*].ipv6_cidr_block\n }\n \n+output \"outpost_subnet_resources\" {\n+ description = \"List of outpost subnet resources\"\n+ value = aws_subnet.outpost\n+}\n+\n output \"outpost_subnets\" {\n description = \"List of IDs of outpost subnets\"\n value = aws_subnet.outpost[*].id\n@@ -128,6 +143,11 @@ output \"outpost_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.outpost[*].ipv6_cidr_block\n }\n \n+output \"database_subnet_resources\" {\n+ description = \"List of database subnet resources\"\n+ value = aws_subnet.database\n+}\n+\n output \"database_subnets\" {\n description = \"List of IDs of database subnets\"\n value = aws_subnet.database[*].id\n@@ -158,6 +178,11 @@ output \"database_subnet_group_name\" {\n value = try(aws_db_subnet_group.database[0].name, \"\")\n }\n \n+output \"redshift_subnet_resources\" {\n+ description = \"List of redshift subnet resources\"\n+ value = aws_subnet.redshift\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value = aws_subnet.redshift[*].id\n@@ +208,11 +208,11 @@ output \"redshift_subnet_group\" {\n value = try(aws_redshift_subnet_group.redshift[0].id, \"\")\n }\n \n+output \"elasticache_subnet_resources\" {\n+ description = \"List of elasticache subnet resources\"\n+ value = aws_subnet.elasticache\n+}\n+\n output \"elasticache_subnets\" {\n description = \"List of IDs of elasticache subnets\"\n value = aws_subnet.elasticache[*].id\n@@ -203,6 +233,11 @@ output \"elasticache_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.elasticache[*].ipv6_cidr_block\n }\n \n+output \"intra_subnet_resources\" {\n+ description = \"List of intra subnet resources\"\n+ value = aws_subnet.intra\n+}\n+\n output \"intra_subnets\" {\n description = \"List of IDs of intra subnets\"\n value = aws_subnet.intra[*].id\n---\n\n\n---\n" } ]
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 a new subnet type : tgwattach. The tgwattach subnet are usually small subnet range with no route table associated with unless you set the parameter `tgwattach_associate_private_route_table` to true to benefit from the default route to NAT Gateway in case of an outbound VPC.\r\n\r\n## Motivation and Context\r\nFollowing AWS best practices for Transit Gateway attachement: https://docs.aws.amazon.com/vpc/latest/tgw/tgw-best-design-practices.html:\r\n*Use a separate subnet for each transit gateway VPC attachment. For each subnet, use a small CIDR, for example /28, so that you have more addresses for EC2 resources*\r\n\r\nThese attachement subnets does not need ACLs neither route table, unless the VPC to be attached is an outbound VPC. In this case a route to NAT Gateway must be set. This is done by associating the `private` route table to those subnets with the parameter `tgwattach_associate_private_route_table` (set it to `true`or `false`)\r\n\r\n(if ACL is required, it is possible to enhance the module and add ACLs for the tgwattach subnets)\r\n\r\n## Breaking Changes\r\nNo breaking change noticed.\r\n\r\n## How Has This Been Tested?\r\nI tested the changes with a hub and spoke architecture, using a transit Gateway, three `application VPCs` (no internet gateway and NAT Gateway) and an outbound VPC (with IGW and NAT GW)\r\nThe new module is compatible with the Transit Gateway module. Attachement is performed thanks to the `tgwattach_subnets` IDs output.\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.tgwattach_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -578,6 +579,33 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+######################################################################################\n+# Transit Gateway Attachement subnets - private subnet for Transit Gateway Attachement\n+######################################################################################\n+\n+resource \"aws_subnet\" \"tgwattach\" {\n+ count = var.create_vpc && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = var.tgwattach_subnets[count.index]\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ assign_ipv6_address_on_creation = var.tgwattach_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.tgwattach_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.tgwattach_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.intra_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${var.tgwattach_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.tgwattach_subnet_tags,\n+ )\n+}\n+\n ################################################################################\n # Default Network ACLs\n ################################################################################\n@@ -594,6 +622,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_subnet.public[*].id,\n aws_subnet.private[*].id,\n aws_subnet.intra[*].id,\n+ aws_subnet.tgwattach[*].id,\n aws_subnet.database[*].id,\n aws_subnet.redshift[*].id,\n aws_subnet.elasticache[*].id,\n@@ -603,6 +632,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_network_acl.public[*].subnet_ids,\n aws_network_acl.private[*].subnet_ids,\n aws_network_acl.intra[*].subnet_ids,\n+ # aws_network_acl.tgwattach[*].subnet_ids,\n aws_network_acl.database[*].subnet_ids,\n aws_network_acl.redshift[*].subnet_ids,\n aws_network_acl.elasticache[*].subnet_ids,\n@@ -1148,6 +1178,16 @@ resource \"aws_route_table_association\" \"intra\" {\n route_table_id = element(aws_route_table.intra[*].id, 0)\n }\n \n+resource \"aws_route_table_association\" \"tgwattach\" {\n+ count = var.create_vpc && var.tgwattach_associate_private_route_table && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.tgwattach[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"public\" {\n count = var.create_vpc && length(var.public_subnets) > 0 ? length(var.public_subnets) : 0\n \n---\noutputs.tf\n@@ -223,6 +223,26 @@ output \"intra_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.intra[*].ipv6_cidr_block\n }\n \n+output \"tgwattach_subnets\" {\n+ description = \"List of IDs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].id\n+}\n+\n+output \"tgwattach_subnet_arns\" {\n+ description = \"List of ARNs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].arn\n+}\n+\n+output \"tgwattach_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].cidr_block\n+}\n+\n+output \"tgwattach_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of TGW Attachement subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.tgwattach[*].ipv6_cidr_block\n+}\n+\n output \"elasticache_subnet_group\" {\n description = \"ID of elasticache subnet group\"\n value = try(aws_elasticache_subnet_group.elasticache[0].id, \"\")\n@@ -328,6 +348,11 @@ output {\n value = aws_route_table_association.intra[*].id\n }\n \n+output \"tgwattach_route_table_association_ids\" {\n+ description = \"List of IDs of the TGW Attachement route table association\"\n+ value = aws_route_table_association.tgwattach[*].id\n+}\n+\n output \"public_route_table_association_ids\" {\n description = \"List of IDs of the public route table association\"\n value = aws_route_table_association.public[*].id\n---\nvariables.tf\n@@ -64,6 +64,12 @@ variable \"intra_subnet_ipv6_prefixes\" {\n default = []\n }\n \n+variable \"tgwattach_subnet_ipv6_prefixes\" {\n+ description = \"Assigns IPv6 TGW Attachement subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"assign_ipv6_address_on_creation\" {\n description = \"Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n type = bool\n@@ -112,6 +118,12 @@ variable \"intra_subnet_assign_ipv6_address_on_creation\" {\n default = null\n }\n \n+variable \"tgwattach_subnet_assign_ipv6_address_on_creation\" {\n+ description = \"Assign IPv6 address on TGW Attachement subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool\"\n type = list(string)\n@@ -148,6 +160,12 @@ variable \"intra_subnet_suffix\" {\n default = \"intra\"\n }\n \n+variable \"tgwattach_subnet_suffix\" {\n+ description = \"Suffix to append to TGW Attachement subnets name\"\n+ type = string\n+ default = \"tgwattach\"\n+}\n+\n variable \"database_subnet_suffix\" {\n description = \"Suffix to append to database subnets name\"\n type = string\n@@ -208,6 +226,12 @@ variable \"intra_subnets\" {\n default = []\n }\n \n+variable \"tgwattach_subnets\" {\n+ description = \"A list of TGW Attachement subnets\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"create_database_subnet_route_table\" {\n description = \"Controls if separate route table for database should be created\"\n type = bool\n@@ -262,6 +286,12 @@ variable \"create_database_nat_gateway_route\" {\n default = false\n }\n \n+variable \"tgwattach_associate_private_route_table\" {\n+ description = \"Controls if the private route talbe should be attached to give internet access to the TGW Attachement subnets\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"azs\" {\n description = \"A list of availability zones names or ids in the region\"\n type = list(string)\n@@ -544,6 +574,12 @@ variable \"intra_subnet_tags\" {\n default = {}\n }\n \n+variable \"tgwattach_subnet_tags\" {\n+ description = \"Additional tags for the TGW Attachement subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"public_acl_tags\" {\n description = \"Additional tags for the public subnets network ACL\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.tgwattach_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -578,6 +579,33 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+######################################################################################\n+# Transit Gateway Attachement subnets - private subnet for Transit Gateway Attachement\n+######################################################################################\n+\n+resource \"aws_subnet\" \"tgwattach\" {\n+ count = var.create_vpc && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = var.tgwattach_subnets[count.index]\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ assign_ipv6_address_on_creation = var.tgwattach_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.tgwattach_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.tgwattach_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.intra_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${var.tgwattach_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.tgwattach_subnet_tags,\n+ )\n+}\n+\n ################################################################################\n # Default Network ACLs\n ################################################################################\n@@ -594,6 +622,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_subnet.public[*].id,\n aws_subnet.private[*].id,\n aws_subnet.intra[*].id,\n+ aws_subnet.tgwattach[*].id,\n aws_subnet.database[*].id,\n aws_subnet.redshift[*].id,\n aws_subnet.elasticache[*].id,\n@@ -603,6 +632,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_network_acl.public[*].subnet_ids,\n aws_network_acl.private[*].subnet_ids,\n aws_network_acl.intra[*].subnet_ids,\n+ # aws_network_acl.tgwattach[*].subnet_ids,\n aws_network_acl.database[*].subnet_ids,\n aws_network_acl.redshift[*].subnet_ids,\n aws_network_acl.elasticache[*].subnet_ids,\n@@ -1148,6 +1178,16 @@ resource \"aws_route_table_association\" \"intra\" {\n route_table_id = element(aws_route_table.intra[*].id, 0)\n }\n \n+resource \"aws_route_table_association\" \"tgwattach\" {\n+ count = var.create_vpc && var.tgwattach_associate_private_route_table && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.tgwattach[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"public\" {\n count = var.create_vpc && length(var.public_subnets) > 0 ? length(var.public_subnets) : 0\n \n---\noutputs.tf\n@@ -223,6 +223,26 @@ output \"intra_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.intra[*].ipv6_cidr_block\n }\n \n+output \"tgwattach_subnets\" {\n+ description = \"List of IDs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].id\n+}\n+\n+output \"tgwattach_subnet_arns\" {\n+ description = \"List of ARNs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].arn\n+}\n+\n+output \"tgwattach_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].cidr_block\n+}\n+\n+output \"tgwattach_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of TGW Attachement subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.tgwattach[*].ipv6_cidr_block\n+}\n+\n output \"elasticache_subnet_group\" {\n description = \"ID of elasticache subnet group\"\n value = try(aws_elasticache_subnet_group.elasticache[0].id, \"\")\n@@ -328,6 +348,11 @@ output \"intra_route_table_association_ids\" {\n value = aws_route_table_association.intra[*].id\n }\n \n+output \"tgwattach_route_table_association_ids\" {\n+ description = \"List of IDs of the TGW Attachement route table association\"\n+ value = aws_route_table_association.tgwattach[*].id\n+}\n+\n output \"public_route_table_association_ids\" {\n description = \"List of IDs of the public route table association\"\n value = aws_route_table_association.public[*].id\n---\nvariables.tf\n@@ -64,6 +64,12 @@ variable \"intra_subnet_ipv6_prefixes\" {\n default = []\n }\n \n+variable \"tgwattach_subnet_ipv6_prefixes\" {\n+ description = \"Assigns IPv6 TGW Attachement subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"assign_ipv6_address_on_creation\" {\n description = \"Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n type = bool\n@@ -112,6 +118,12 @@ variable \"intra_subnet_assign_ipv6_address_on_creation\" {\n default = null\n }\n \n+variable \"tgwattach_subnet_assign_ipv6_address_on_creation\" {\n+ description = \"Assign IPv6 address on TGW Attachement subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool\"\n type = list(string)\n@@ -148,6 +160,12 @@ variable \"intra_subnet_suffix\" {\n default = \"intra\"\n }\n \n+variable \"tgwattach_subnet_suffix\" {\n+ description = \"Suffix to append to TGW Attachement subnets name\"\n+ type = string\n+ default = \"tgwattach\"\n+}\n+\n variable \"database_subnet_suffix\" {\n description = \"Suffix to append to database subnets name\"\n type = string\n@@ -208,6 +226,12 @@ variable \"intra_subnets\" {\n default = []\n }\n \n+variable \"tgwattach_subnets\" {\n+ description = \"A list of TGW Attachement subnets\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"create_database_subnet_route_table\" {\n description = \"Controls if separate route table for database should be created\"\n type = bool\n@@ -262,6 +286,12 @@ variable \"create_database_nat_gateway_route\" {\n default = false\n }\n \n+variable \"tgwattach_associate_private_route_table\" {\n+ description = \"Controls if the private route talbe should be attached to give internet access to the TGW Attachement subnets\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"azs\" {\n description = \"A list of availability zones names or ids in the region\"\n type = list(string)\n@@ -544,6 +574,12 @@ variable \"intra_subnet_tags\" {\n default = {}\n }\n \n+variable \"tgwattach_subnet_tags\" {\n+ description = \"Additional tags for the TGW Attachement subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"public_acl_tags\" {\n description = \"Additional tags for the public subnets network ACL\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.tgwattach_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -578,6 +579,33 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+######################################################################################\n+# Transit Gateway Attachement subnets - private subnet for Transit Gateway Attachement\n+######################################################################################\n+\n+resource \"aws_subnet\" \"tgwattach\" {\n+ count = var.create_vpc && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = var.tgwattach_subnets[count.index]\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ assign_ipv6_address_on_creation = var.tgwattach_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.tgwattach_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.tgwattach_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.intra_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${var.tgwattach_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.tgwattach_subnet_tags,\n+ )\n+}\n+\n ################################################################################\n # Default Network ACLs\n ################################################################################\n@@ -594,6 +622,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_subnet.public[*].id,\n aws_subnet.private[*].id,\n aws_subnet.intra[*].id,\n+ aws_subnet.tgwattach[*].id,\n aws_subnet.database[*].id,\n aws_subnet.redshift[*].id,\n aws_subnet.elasticache[*].id,\n@@ -603,6 +632,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_network_acl.public[*].subnet_ids,\n aws_network_acl.private[*].subnet_ids,\n aws_network_acl.intra[*].subnet_ids,\n+ # aws_network_acl.tgwattach[*].subnet_ids,\n aws_network_acl.database[*].subnet_ids,\n aws_network_acl.redshift[*].subnet_ids,\n aws_network_acl.elasticache[*].subnet_ids,\n@@ -1148,6 +1178,16 @@ resource \"aws_route_table_association\" \"intra\" {\n route_table_id = element(aws_route_table.intra[*].id, 0)\n }\n \n+resource \"aws_route_table_association\" \"tgwattach\" {\n+ count = var.create_vpc && var.tgwattach_associate_private_route_table && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.tgwattach[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"public\" {\n count = ACL\"\n && length(var.public_subnets) > 0 ? length(var.public_subnets) : 0\n \n---\noutputs.tf\n@@ -223,6 +223,26 @@ output \"intra_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.intra[*].ipv6_cidr_block\n }\n \n+output \"tgwattach_subnets\" {\n+ description = \"List of IDs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].id\n+}\n+\n+output \"tgwattach_subnet_arns\" {\n+ description = \"List of ARNs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].arn\n+}\n+\n+output \"tgwattach_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].cidr_block\n+}\n+\n+output \"tgwattach_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of TGW Attachement subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.tgwattach[*].ipv6_cidr_block\n+}\n+\n output \"elasticache_subnet_group\" {\n description = \"ID of elasticache subnet group\"\n value = try(aws_elasticache_subnet_group.elasticache[0].id, \"\")\n@@ -328,6 +348,11 @@ output \"intra_route_table_association_ids\" {\n value = aws_route_table_association.intra[*].id\n }\n \n+output \"tgwattach_route_table_association_ids\" {\n+ description = \"List of IDs of the TGW Attachement route table association\"\n+ value = aws_route_table_association.tgwattach[*].id\n+}\n+\n output \"public_route_table_association_ids\" {\n description = \"List of IDs of the public route table association\"\n value = aws_route_table_association.public[*].id\n---\nvariables.tf\n@@ -64,6 +64,12 @@ variable \"intra_subnet_ipv6_prefixes\" {\n default = []\n }\n \n+variable \"tgwattach_subnet_ipv6_prefixes\" {\n+ description = \"Assigns IPv6 TGW Attachement subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"assign_ipv6_address_on_creation\" {\n description = \"Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n type = bool\n@@ -112,6 +118,12 @@ variable \"intra_subnet_assign_ipv6_address_on_creation\" {\n default = null\n }\n \n+variable \"tgwattach_subnet_assign_ipv6_address_on_creation\" {\n+ description = \"Assign IPv6 address on TGW Attachement subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool\"\n type = list(string)\n@@ -148,6 +160,12 @@ variable \"intra_subnet_suffix\" {\n default = \"intra\"\n }\n \n+variable \"tgwattach_subnet_suffix\" {\n+ description = \"Suffix to append to TGW Attachement subnets name\"\n+ type = string\n+ default = \"tgwattach\"\n+}\n+\n variable \"database_subnet_suffix\" {\n description = \"Suffix to append to database subnets name\"\n type = string\n@@ -208,6 +226,12 @@ variable \"intra_subnets\" {\n default = []\n }\n \n+variable \"tgwattach_subnets\" {\n+ description = \"A list of TGW Attachement subnets\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"create_database_subnet_route_table\" {\n description = \"Controls if separate route table for database should be created\"\n type = bool\n@@ -262,6 +286,12 @@ variable \"create_database_nat_gateway_route\" {\n default = false\n }\n \n+variable \"tgwattach_associate_private_route_table\" {\n+ description = \"Controls if the private route talbe should be attached to give internet access to the TGW Attachement subnets\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"azs\" {\n description = \"A list of availability zones names or ids in the region\"\n type = list(string)\n@@ -544,6 +574,12 @@ variable \"intra_subnet_tags\" {\n default = {}\n }\n \n+variable \"tgwattach_subnet_tags\" {\n+ description = \"Additional tags for the TGW Attachement subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"public_acl_tags\" {\n description = \"Additional tags for the public subnets network ACL\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -4,6 +4,7 @@ locals {\n length(var.elasticache_subnets),\n length(var.database_subnets),\n length(var.redshift_subnets),\n+ length(var.tgwattach_subnets),\n )\n nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length\n \n@@ -578,6 +579,33 @@ resource \"aws_subnet\" \"intra\" {\n )\n }\n \n+######################################################################################\n+# Transit Gateway Attachement subnets - private subnet for Transit Gateway Attachement\n+######################################################################################\n+\n+resource \"aws_subnet\" \"tgwattach\" {\n+ count = var.create_vpc && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = var.tgwattach_subnets[count.index]\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index,\n+ : null\n+ assign_ipv6_address_on_creation = var.tgwattach_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.tgwattach_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.tgwattach_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.intra_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"${var.name}-${var.tgwattach_subnet_suffix}-%s\",\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.tgwattach_subnet_tags,\n+ )\n+}\n+\n ################################################################################\n # Default Network ACLs\n ################################################################################\n@@ -594,6 +622,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_subnet.public[*].id,\n aws_subnet.private[*].id,\n aws_subnet.intra[*].id,\n+ aws_subnet.tgwattach[*].id,\n aws_subnet.database[*].id,\n aws_subnet.redshift[*].id,\n aws_subnet.elasticache[*].id,\n@@ -603,6 +632,7 @@ resource \"aws_default_network_acl\" \"this\" {\n aws_network_acl.public[*].subnet_ids,\n aws_network_acl.private[*].subnet_ids,\n aws_network_acl.intra[*].subnet_ids,\n+ # aws_network_acl.tgwattach[*].subnet_ids,\n aws_network_acl.database[*].subnet_ids,\n aws_network_acl.redshift[*].subnet_ids,\n aws_network_acl.elasticache[*].subnet_ids,\n@@ -1148,6 +1178,16 @@ resource \"aws_route_table_association\" \"intra\" {\n route_table_id = element(aws_route_table.intra[*].id, 0)\n }\n \n+resource \"aws_route_table_association\" \"tgwattach\" {\n+ count = var.create_vpc && var.tgwattach_associate_private_route_table && length(var.tgwattach_subnets) > 0 ? length(var.tgwattach_subnets) : 0\n+\n+ subnet_id = element(aws_subnet.tgwattach[*].id, count.index)\n+ route_table_id = element(\n+ aws_route_table.private[*].id,\n+ var.single_nat_gateway ? 0 : count.index,\n+ )\n+}\n+\n resource \"aws_route_table_association\" \"public\" {\n count = var.create_vpc && length(var.public_subnets) > 0 ? length(var.public_subnets) : 0\n \n---\noutputs.tf\n@@ -223,6 +223,26 @@ output \"intra_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.intra[*].ipv6_cidr_block\n }\n \n+output \"tgwattach_subnets\" {\n+ description = \"List of IDs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].id\n+}\n+\n+output \"tgwattach_subnet_arns\" {\n+ description = \"List of ARNs of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].arn\n+}\n+\n+output \"tgwattach_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of TGW Attachement subnets\"\n+ value = aws_subnet.tgwattach[*].cidr_block\n+}\n+\n+output \"tgwattach_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of TGW Attachement subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.tgwattach[*].ipv6_cidr_block\n+}\n+\n output \"elasticache_subnet_group\" {\n description = \"ID of elasticache subnet group\"\n value = try(aws_elasticache_subnet_group.elasticache[0].id, \"\")\n@@ -328,6 +348,11 @@ output \"intra_route_table_association_ids\" {\n value = aws_route_table_association.intra[*].id\n }\n \n+output \"tgwattach_route_table_association_ids\" {\n+ description = \"List of IDs of the TGW Attachement route table association\"\n+ value = aws_route_table_association.tgwattach[*].id\n+}\n+\n output \"public_route_table_association_ids\" {\n description = \"List of IDs of the public route table association\"\n value = aws_route_table_association.public[*].id\n---\nvariables.tf\n@@ -64,6 +64,12 @@ variable \"intra_subnet_ipv6_prefixes\" {\n default = []\n }\n \n+variable \"tgwattach_subnet_ipv6_prefixes\" {\n+ description = \"Assigns IPv6 TGW Attachement subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"assign_ipv6_address_on_creation\" {\n description = \"Assign IPv6 address on subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n type = bool\n@@ -112,6 +118,12 @@ variable \"intra_subnet_assign_ipv6_address_on_creation\" {\n default = null\n }\n \n+variable \"tgwattach_subnet_assign_ipv6_address_on_creation\" {\n+ description = \"Assign IPv6 address on TGW Attachement subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch\"\n+ type = bool\n+ default = null\n+}\n+\n variable \"secondary_cidr_blocks\" {\n description = \"List of secondary CIDR blocks to associate with the VPC to extend the IP Address pool\"\n type = list(string)\n@@ -148,6 +160,12 @@ variable \"intra_subnet_suffix\" {\n default = \"intra\"\n }\n \n+variable \"tgwattach_subnet_suffix\" {\n+ description = \"Suffix to append to TGW Attachement subnets name\"\n+ type = string\n+ default = \"tgwattach\"\n+}\n+\n variable \"database_subnet_suffix\" {\n description = \"Suffix to append to database subnets name\"\n type = string\n@@ -208,6 +226,12 @@ variable \"intra_subnets\" {\n default = []\n }\n \n+variable \"tgwattach_subnets\" {\n+ description = \"A list of TGW Attachement subnets\"\n+ type = list(string)\n+ default = []\n+}\n+\n variable \"create_database_subnet_route_table\" {\n description = \"Controls if separate route table for database should be created\"\n type = bool\n@@ -262,6 +286,12 @@ variable \"create_database_nat_gateway_route\" {\n default = false\n }\n \n+variable \"tgwattach_associate_private_route_table\" {\n+ description = \"Controls if the private route talbe should be attached to give internet access to the TGW Attachement subnets\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"azs\" {\n description = \"A list of availability zones names or ids in the region\"\n type = list(string)\n@@ -544,6 +574,12 @@ variable \"intra_subnet_tags\" {\n default = {}\n }\n \n+variable \"tgwattach_subnet_tags\" {\n+ description = \"Additional tags for the TGW Attachement subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"public_acl_tags\" {\n description = \"Additional tags for the public subnets network ACL\"\n type = map(string)\n---\n\n\n---\n" } ]
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:\nfix for dynamodb resource not found error in the example.\r\n\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -208,7 +208,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n test = \"StringNotEquals\"\n variable = \"aws:sourceVpce\"\n \n- values = [data.aws_vpc_endpoint.dynamodb.id]\n+ values = [data.vpc.vpc_id]\n }\n }\n }\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -208,7 +208,7 @@ data \"aws_iam_policy_document\" {\n test = \"StringNotEquals\"\n variable = \"aws:sourceVpce\"\n \n- values = [data.aws_vpc_endpoint.dynamodb.id]\n+ values = [data.vpc.vpc_id]\n }\n }\n }\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -208,7 +208,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n test = \"StringNotEquals\"\n variable = \"aws:sourceVpce\"\n \n- values = [data.aws_vpc_endpoint.dynamodb.id]\n+ values = }\n }\n }\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -208,7 +208,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n test = \"StringNotEquals\"\n -208,7 variable = \"aws:sourceVpce\"\n \n- values = [data.aws_vpc_endpoint.dynamodb.id]\n+ values = [data.vpc.vpc_id]\n }\n }\n }\n---\n\n\n---\n" } ]
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:\nTested, described reasoning in the following issue:\r\nhttps://github.com/terraform-aws-modules/terraform-aws-vpc/issues/740\n\n---\n\nChoice A:\nmain.tf\n@@ -1074,6 +1074,27 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n egress_only_gateway_id = element(aws_egress_only_internet_gateway.this[*].id, 0)\n }\n \n+resource \"aws_route\" \"private_route_table_routes\" {\n+ count = length(var.private_subnets) * length(var.private_route_table_routes)\n+\n+ route_table_id = element(aws_route_table.private[*].id, floor(count.index / length(var.private_route_table_routes)))\n+ destination_cidr_block = element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))).cidr_block\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"gateway_id\", null)\n+ instance_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"instance_id\", null)\n+ nat_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"nat_gateway_id\", null)\n+ network_interface_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"network_interface_id\", null)\n+ transit_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_peering_connection_id\", null)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n ################################################################################\n # Route table association\n ################################################################################\n---\nvariables.tf\n@@ -406,6 +406,12 @@ variable \"default_route_table_routes\" {\n default = []\n }\n \n+variable \"private_route_table_routes\" {\n+ description = \"Configuration block of private routes.\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"default_route_table_tags\" {\n = \"Additional tags for the default route table\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -1074,6 +1074,27 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n egress_only_gateway_id = element(aws_egress_only_internet_gateway.this[*].id, 0)\n }\n \n+resource \"aws_route\" \"private_route_table_routes\" {\n+ count = length(var.private_subnets) * length(var.private_route_table_routes)\n+\n+ route_table_id = element(aws_route_table.private[*].id, floor(count.index / length(var.private_route_table_routes)))\n+ destination_cidr_block = element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))).cidr_block\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"gateway_id\", null)\n+ instance_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"instance_id\", null)\n+ nat_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"nat_gateway_id\", null)\n+ network_interface_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"network_interface_id\", null)\n+ transit_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_peering_connection_id\", null)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n ################################################################################\n # Route table association\n ################################################################################\n---\nvariables.tf\n@@ -406,6 +406,12 @@ variable \"default_route_table_routes\" {\n default = []\n }\n \n+variable \"private_route_table_routes\" {\n+ description = \"Configuration block of private routes.\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"default_route_table_tags\" {\n description = \"Additional for the default route table\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -1074,6 +1074,27 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n egress_only_gateway_id = element(aws_egress_only_internet_gateway.this[*].id, 0)\n }\n \n+resource \"aws_route\" \"private_route_table_routes\" {\n+ count = length(var.private_subnets) * length(var.private_route_table_routes)\n+\n+ route_table_id = element(aws_route_table.private[*].id, floor(count.index / length(var.private_route_table_routes)))\n+ destination_cidr_block = element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))).cidr_block\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"gateway_id\", null)\n+ instance_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"instance_id\", null)\n+ nat_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"nat_gateway_id\", null)\n+ network_interface_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"network_interface_id\", null)\n+ transit_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_peering_connection_id\", null)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n ################################################################################\n # Route table association\n ################################################################################\n---\nvariables.tf\n@@ -406,6 +406,12 @@ variable \"default_route_table_routes\" {\n default = []\n }\n \n+variable \"private_route_table_routes\" {\n+ description = \"Configuration block of private routes.\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"default_route_table_tags\" {\n description = \"Additional tags for the default route table\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -1074,6 +1074,27 @@ resource \"aws_route\" \"private_ipv6_egress\" {\n egress_only_gateway_id = element(aws_egress_only_internet_gateway.this[*].id, 0)\n }\n \n+resource \"aws_route\" \"private_route_table_routes\" {\n+ count = length(var.private_subnets) * length(var.private_route_table_routes)\n+\n+ route_table_id = element(aws_route_table.private[*].id, floor(count.index / length(var.private_route_table_routes)))\n+ destination_cidr_block = element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))).cidr_block\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"gateway_id\", null)\n+ instance_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"instance_id\", null)\n+ nat_gateway_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"nat_gateway_id\", null)\n+ network_interface_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"network_interface_id\", null)\n+ transit_gateway_id lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"transit_gateway_id\", null)\n+ vpc_endpoint_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(element(var.private_route_table_routes, floor(count.index / length(var.private_subnets))), \"vpc_peering_connection_id\", null)\n+\n+ timeouts {\n+ create = \"5m\"\n+ }\n+}\n+\n ################################################################################\n # Route table association\n ################################################################################\n---\nvariables.tf\n@@ -406,6 +406,12 @@ variable \"default_route_table_routes\" {\n default = []\n }\n \n+variable \"private_route_table_routes\" {\n+ description = \"Configuration block of private routes.\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n variable \"default_route_table_tags\" {\n description = \"Additional tags for the default route table\"\n type = map(string)\n---\n\n\n---\n" } ]
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:\nFixed #738\n\n---\n\nChoice A:\noutputs.tf\n@@ -250,7 +250,7 @@ output \"database_route_table_ids\" {\n \n output \"redshift_route_table_ids\" {\n description = \"List of IDs of route tables\"\n- value = try(coalescelist(aws_route_table.redshift[*].id, aws_route_table.public[*].id, aws_route_table.private[*].id), [])\n+ value = length(aws_route_table.redshift[*].id) > 0 ? aws_route_table.redshift[*].id : (var.enable_public_redshift ? aws_route_table.public[*].id : aws_route_table.private[*].id)\n }\n \n output \"elasticache_route_table_ids\" {\n---\n\n\n---\n\nChoice B:\noutputs.tf\n@@ -250,7 +250,7 @@ output \"database_route_table_ids\" {\n \n output \"redshift_route_table_ids\" {\n description = \"List of IDs of redshift route tables\"\n- value = try(coalescelist(aws_route_table.redshift[*].id, aws_route_table.public[*].id, aws_route_table.private[*].id), [])\n+ value = length(aws_route_table.redshift[*].id) : 0 ? aws_route_table.redshift[*].id : (var.enable_public_redshift ? aws_route_table.public[*].id : aws_route_table.private[*].id)\n }\n \n output \"elasticache_route_table_ids\" {\n---\n\n\n---\n\nChoice C:\noutputs.tf\n@@ -250,7 +250,7 @@ output \"database_route_table_ids\" {\n \n output \"redshift_route_table_ids\" {\n description = \"List of IDs of redshift route tables\"\n- value = try(coalescelist(aws_route_table.redshift[*].id, aws_route_table.public[*].id, aws_route_table.private[*].id), [])\n+ of value = length(aws_route_table.redshift[*].id) > 0 ? aws_route_table.redshift[*].id : (var.enable_public_redshift ? aws_route_table.public[*].id : aws_route_table.private[*].id)\n }\n \n output \"elasticache_route_table_ids\" {\n---\n\n\n---\n\nChoice D:\noutputs.tf\n@@ -250,7 +250,7 @@ output \"database_route_table_ids\" {\n \n output \"redshift_route_table_ids\" {\n description = \"List of IDs of redshift route tables\"\n- value = try(coalescelist(aws_route_table.redshift[*].id, aws_route_table.public[*].id, aws_route_table.private[*].id), [])\n+ value = length(aws_route_table.redshift[*].id) > 0 ? aws_route_table.redshift[*].id : (var.enable_public_redshift ? aws_route_table.public[*].id : aws_route_table.private[*].id)\n }\n \n output \"elasticache_route_table_ids\" {\n---\n\n\n---\n" } ]
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:\nAs noted in the [terraform docs][0], subnets using the default network acl\r\nwill generate a persistent diff if they are not specified to the aws_default_network_acl\r\nresource. This module was handling subnets created by the module, but\r\nof course is not aware of subnets created externally to the module.\r\n\r\nThe docs suggest using lifecycle ignore_changes as an option to avoid\r\nthe persistent diff, which is the approach implemented in this patch.\r\n\r\nFixes #736\r\n\r\n[0]: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_network_acl#managing-subnets-in-a-default-network-acl\r\n\r\n## Breaking Changes\r\n<!-- 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- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\r\n1. cd examples/network-acls\r\n2. run terraform apply\r\n3. manually create a new subnet in the vpc\r\n4. run terraform apply\r\n5. view that no changes are planned\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/README.md\n@@ -46,7 +46,6 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n-| [aws_vpc_endpoint.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint) | data source |\n \n ## Inputs\n \n---\nexamples/complete-vpc/main.tf\n@@ -187,12 +187,6 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint\" \"dynamodb\" {\n- vpc_id = module.vpc.vpc_id\n- service_name = \"com.amazonaws.${local.region}.dynamodb\"\n-}\n-\n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -208,7 +202,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n test = \"StringNotEquals\"\n variable = \"aws:sourceVpce\"\n \n- values = [data.vpc.vpc_id]\n+ values = [module.vpc.vpc_id]\n }\n }\n---\nmain.tf\n@@ -587,28 +587,9 @@ resource \"aws_default_network_acl\" \"this\" {\n \n default_network_acl_id = aws_vpc.this[0].default_network_acl_id\n \n- # The value of subnet_ids should be any subnet IDs that are not set as subnet_ids\n- # for any of the non-default network ACLs\n- subnet_ids = setsubtract(\n- compact(flatten([\n- aws_subnet.public[*].id,\n- aws_subnet.private[*].id,\n- aws_subnet.intra[*].id,\n- aws_subnet.database[*].id,\n- aws_subnet.redshift[*].id,\n- aws_subnet.elasticache[*].id,\n- aws_subnet.outpost[*].id,\n- ])),\n- compact(flatten([\n- aws_network_acl.public[*].subnet_ids,\n- aws_network_acl.private[*].subnet_ids,\n- aws_network_acl.intra[*].subnet_ids,\n- aws_network_acl.database[*].subnet_ids,\n- aws_network_acl.redshift[*].subnet_ids,\n- aws_network_acl.elasticache[*].subnet_ids,\n- aws_network_acl.outpost[*].subnet_ids,\n- ]))\n- )\n+ # subnet_ids is using lifecycle ignore_changes, so it is not necessary to list\n+ # any explicitly. See https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/736.\n+ subnet_ids = null\n \n dynamic \"ingress\" {\n for_each = var.default_network_acl_ingress\n@@ -644,6 +625,10 @@ resource \"aws_default_network_acl\" \"this\" {\n var.tags,\n var.default_network_acl_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [subnet_ids]\n+ }\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/README.md\n@@ -46,7 +46,6 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n-| [aws_vpc_endpoint.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint) | data source |\n \n ## Inputs\n \n---\nexamples/complete-vpc/main.tf\n@@ -187,12 +187,6 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint\" \"dynamodb\" {\n- vpc_id = module.vpc.vpc_id\n- service_name = \"com.amazonaws.${local.region}.dynamodb\"\n-}\n-\n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -208,7 +202,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n test = \"StringNotEquals\"\n variable = \"aws:sourceVpce\"\n \n- values = [data.vpc.vpc_id]\n+ values = [module.vpc.vpc_id]\n }\n }\n }\n---\nmain.tf\n@@ -587,28 +587,9 @@ resource \"aws_default_network_acl\" \"this\" {\n \n default_network_acl_id = aws_vpc.this[0].default_network_acl_id\n \n- # The value of subnet_ids should be any subnet IDs that are not set as subnet_ids\n- # for any of the non-default network ACLs\n- subnet_ids = setsubtract(\n- compact(flatten([\n- aws_subnet.public[*].id,\n- aws_subnet.private[*].id,\n- aws_subnet.intra[*].id,\n- aws_subnet.database[*].id,\n- aws_subnet.redshift[*].id,\n- aws_subnet.elasticache[*].id,\n- aws_subnet.outpost[*].id,\n- ])),\n- compact(flatten([\n- aws_network_acl.public[*].subnet_ids,\n- aws_network_acl.private[*].subnet_ids,\n- aws_network_acl.intra[*].subnet_ids,\n- aws_network_acl.database[*].subnet_ids,\n- aws_network_acl.redshift[*].subnet_ids,\n- aws_network_acl.elasticache[*].subnet_ids,\n- aws_network_acl.outpost[*].subnet_ids,\n- ]))\n- )\n+ # subnet_ids is using lifecycle ignore_changes, so it is not necessary to list\n+ # any explicitly. See https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/736.\n+ {\n subnet_ids = null\n \n dynamic \"ingress\" {\n for_each = var.default_network_acl_ingress\n@@ -644,6 +625,10 @@ resource \"aws_default_network_acl\" \"this\" {\n var.tags,\n var.default_network_acl_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [subnet_ids]\n+ }\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/README.md\n@@ -46,7 +46,6 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n-| [aws_vpc_endpoint.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint) | data source |\n \n ## Inputs\n \n---\nexamples/complete-vpc/main.tf\n@@ -187,12 +187,6 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint\" \"dynamodb\" {\n- vpc_id = module.vpc.vpc_id\n- service_name = \"com.amazonaws.${local.region}.dynamodb\"\n-}\n-\n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -208,7 +202,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n test = \"StringNotEquals\"\n variable = \"aws:sourceVpce\"\n \n- values = [data.vpc.vpc_id]\n+ values = [module.vpc.vpc_id]\n }\n }\n }\n---\nmain.tf\n@@ -587,28 +587,9 @@ resource \"aws_default_network_acl\" \"this\" {\n \n default_network_acl_id = aws_vpc.this[0].default_network_acl_id\n \n- # The value of subnet_ids should be any subnet IDs that are not set as subnet_ids\n- # for any of the non-default network ACLs\n- subnet_ids = setsubtract(\n- compact(flatten([\n- aws_subnet.public[*].id,\n- aws_subnet.private[*].id,\n- aws_subnet.intra[*].id,\n- aws_subnet.database[*].id,\n- aws_subnet.redshift[*].id,\n- aws_subnet.elasticache[*].id,\n- aws_subnet.outpost[*].id,\n- ])),\n- compact(flatten([\n- aws_network_acl.public[*].subnet_ids,\n- aws_network_acl.private[*].subnet_ids,\n- aws_network_acl.intra[*].subnet_ids,\n- aws_network_acl.database[*].subnet_ids,\n- aws_network_acl.redshift[*].subnet_ids,\n- aws_network_acl.elasticache[*].subnet_ids,\n- aws_network_acl.outpost[*].subnet_ids,\n- ]))\n- )\n+ # subnet_ids is using lifecycle ignore_changes, so it is not necessary to list\n+ # any explicitly. See https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/736.\n+ subnet_ids = null\n \n dynamic \"ingress\" {\n for_each = var.default_network_acl_ingress\n@@ -644,6 +625,10 @@ resource \"aws_default_network_acl\" -587,28 {\n var.tags,\n var.default_network_acl_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [subnet_ids]\n+ }\n }\n \n ################################################################################\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/README.md\n@@ -46,7 +46,6 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n-| [aws_vpc_endpoint.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint) | data source |\n \n ## Inputs\n \n---\nexamples/complete-vpc/main.tf\n@@ -187,12 +187,6 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint\" \"dynamodb\" {\n- vpc_id = module.vpc.vpc_id\n- service_name = \"com.amazonaws.${local.region}.dynamodb\"\n-}\n-\n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -208,7 +202,7 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n test = \"StringNotEquals\"\n variable = \"aws:sourceVpce\"\n \n- values = [data.vpc.vpc_id]\n+ values = [module.vpc.vpc_id]\n }\n }\n }\n---\nmain.tf\n@@ -587,28 +587,9 @@ resource \"aws_default_network_acl\" \"this\" {\n \n default_network_acl_id = aws_vpc.this[0].default_network_acl_id\n \n- # The value of subnet_ids should be any subnet IDs that are not set as subnet_ids\n- # for any of the non-default network ACLs\n- subnet_ids = setsubtract(\n- compact(flatten([\n- aws_subnet.public[*].id,\n- aws_subnet.private[*].id,\n- aws_subnet.intra[*].id,\n- aws_subnet.database[*].id,\n- aws_subnet.redshift[*].id,\n- aws_subnet.elasticache[*].id,\n- aws_subnet.outpost[*].id,\n- ])),\n- compact(flatten([\n- aws_network_acl.public[*].subnet_ids,\n- aws_network_acl.private[*].subnet_ids,\n- aws_network_acl.intra[*].subnet_ids,\n- aws_network_acl.database[*].subnet_ids,\n- aws_network_acl.redshift[*].subnet_ids,\n- aws_network_acl.elasticache[*].subnet_ids,\n- aws_network_acl.outpost[*].subnet_ids,\n- ]))\n- )\n+ # subnet_ids is using lifecycle ignore_changes, so it is not necessary to list\n+ # any explicitly. See https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/736.\n+ subnet_ids = null\n \n dynamic \"ingress\" {\n for_each = var.default_network_acl_ingress\n@@ -644,6 +625,10 @@ resource \"aws_default_network_acl\" \"this\" {\n var.tags,\n var.default_network_acl_tags,\n )\n+\n+ lifecycle {\n+ ignore_changes = [subnet_ids]\n+ }\n }\n \n ################################################################################\n---\n\n\n---\n" } ]
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\n\n- Update `.releaserc.json` to ensure conventional-commit standards are used by semantic-releaser\n- Update `.pre-commit-config.yaml` versions to latest and ensure `end-of-file-fixer` hook is used\n- Add `pr-title.yml` GitHub workflow for ensuring PR titles follow conventional-commit standards\n- Fix `release.yml` GitHub workflow to ensure release process does not run on forks; ref https://github.com/terraform-aws-modules/meta/issues/25\n- Add `stale-actions.yaml` to ensure issues and pull requests are routinely cleaned up; copie from EKS repository\n\n## Motivation and Context\n\n- Ensure organization configurations are aligned and standardized; most of these changes are copied from the current EKS repository\n\n## Breaking Changes\n\n- No\n\n## How Has This Been Tested?\n\n- CI checks only\n\n\n---\n\nChoice A:\n.github/workflows/pr-title.yml\n@@ -0,0 +1,52 @@\n+name: 'Validate PR title'\n+\n+on:\n+ pull_request_target:\n+ types:\n+ - opened\n+ - edited\n+ - synchronize\n+\n+jobs:\n+ main:\n+ name: Validate PR title\n+ runs-on: ubuntu-latest\n+ steps:\n+ # Please look up the latest version from\n+ # https://github.com/amannn/action-semantic-pull-request/releases\n+ - uses: amannn/[email protected]\n+ env:\n+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n+ with:\n+ # Configure which types are allowed.\n+ # Default: https://github.com/commitizen/conventional-commit-types\n+ types: |\n+ fix\n+ feat\n+ docs\n+ ci\n+ chore\n+ # Configure that a scope must always be provided.\n+ requireScope: false\n+ # Configure additional validation for the subject based on a regex.\n+ # This example ensures the subject starts with an uppercase character.\n+ subjectPattern: ^[A-Z].+$\n+ # If `subjectPattern` is configured, you can use this property to override\n+ # the default error message that is shown when the pattern doesn't match.\n+ # The variables `subject` and `title` can be used within the message.\n+ subjectPatternError: |\n+ The subject \"{subject}\" found in the pull request title \"{title}\"\n+ didn't match the configured pattern. Please ensure that the subject\n+ starts with an uppercase character.\n+ # For work-in-progress PRs you can typically use draft pull requests\n+ # from Github. However, private repositories on the free plan don't have\n+ # this option and therefore this action allows you to opt-in to using the\n+ # special \"[WIP]\" prefix to indicate this state. This will avoid the\n+ # validation of the PR title and the pull request checks remain pending.\n+ # Note that a second check will be reported if this is enabled.\n+ wip: true\n+ # When using \"Squash and merge\" on a PR with only one commit, GitHub\n+ # will suggest using that commit message instead of the PR title for the\n+ # merge commit, and it's easy to commit this by mistake. Enable this option\n+ # to also validate the commit message for one commit PRs.\n+ validateSingleCommit: false\n---\n.github/workflows/release.yml\n@@ -7,13 +7,17 @@ on:\n - main\n - master\n paths:\n+ - '**/*.tpl'\n - '**/*.py'\n - '**/*.tf'\n+ - '.github/workflows/release.yml'\n \n jobs:\n release:\n name: Release\n runs-on: ubuntu-latest\n+ # Skip running release workflow on forks\n+ if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n@@ -28,5 +32,6 @@ jobs:\n extra_plugins: |\n @semantic-release/[email protected]\n @semantic-release/[email protected]\n+ [email protected]\n env:\n GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}\n---\n.github/workflows/stale-actions.yaml\n@@ -0,0 +1,32 @@\n+name: 'Mark or close stale issues and PRs'\n+on:\n+ schedule:\n+ - cron: '0 0 * * *'\n+\n+jobs:\n+ stale:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/stale@v4\n+ with:\n+ repo-token: ${{ secrets.GITHUB_TOKEN }}\n+ # Staling issues and PR's\n+ days-before-stale: 30\n+ stale-issue-label: stale\n+ stale-pr-label: stale\n+ stale-issue-message: |\n+ This issue has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this issue will be closed in 10 days\n+ stale-pr-message: |\n+ This PR has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this PR will be closed in 10 days\n+ # Not stale if have this labels or part of milestone\n+ exempt-issue-labels: bug,wip,on-hold\n+ exempt-pr-labels: bug,wip,on-hold\n+ exempt-all-milestones: true\n+ # Close issue operations\n+ check-merge-conflict\n+ Label will be automatically removed if the issues are no longer closed nor locked.\n+ days-before-close: 10\n+ delete-branch: true\n+ close-issue-message: This issue was automatically closed because of stale in 10 days\n+ close-pr-message: This PR was automatically closed because of stale in 10 days\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.58.0\n+ rev: v1.62.3\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,6 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.0.1\n+ rev: v4.1.0\n hooks:\n - id: check-merge-conflict\n+ - id: end-of-file-fixer\n---\n.releaserc.json\n@@ -5,13 +5,22 @@\n ],\n \"ci\": false,\n \"plugins\": [\n- \"@semantic-release/commit-analyzer\",\n- \"@semantic-release/release-notes-generator\",\n+ [\n+ \"@semantic-release/commit-analyzer\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n+ [\n+ \"@semantic-release/release-notes-generator\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n [\n \"@semantic-release/github\",\n {\n- \"successComment\":\n- \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n+ \"successComment\": \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n \"labels\": false,\n \"releasedLabels\": false\n }\n---\nexamples/manage-default-vpc/main.tf\n@@ -19,4 +19,3 @@ module \"vpc\" {\n default_vpc_name = \"default\"\n default_vpc_enable_dns_hostnames = true\n }\n-\n---\nexamples/manage-default-vpc/outputs.tf\n@@ -8,4 +8,3 @@ output \"default_vpc_cidr_block\" {\n description = \"The CIDR block of the VPC\"\n value = module.vpc.default_vpc_cidr_block\n }\n-\n---\nexamples/secondary-cidr-blocks/outputs.tf\n@@ -31,4 +31,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\nexamples/simple-vpc/outputs.tf\n@@ -32,4 +32,3 @@ output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n-\n---\nexamples/vpc-flow-logs/outputs.tf\n@@ -55,4 +55,3 @@ output \"vpc_flow_logs_s3_bucket_vpc_flow_log_destination_type\" {\n description = \"The type of the destination for VPC Flow Logs\"\n value = module.vpc_with_flow_logs_s3_bucket.vpc_flow_log_destination_type\n }\n-\n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -35,4 +35,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\n\n\n---\n\nChoice B:\n.github/workflows/pr-title.yml\n@@ -0,0 +1,52 @@\n+name: 'Validate PR title'\n+\n+on:\n+ pull_request_target:\n+ types:\n+ - opened\n+ - edited\n+ - synchronize\n+\n+jobs:\n+ main:\n+ name: Validate PR title\n+ runs-on: ubuntu-latest\n+ steps:\n+ # Please look up the latest version from\n+ # https://github.com/amannn/action-semantic-pull-request/releases\n+ - uses: amannn/[email protected]\n+ env:\n+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n+ with:\n+ # Configure which types are allowed.\n+ # Default: https://github.com/commitizen/conventional-commit-types\n+ types: |\n+ fix\n+ feat\n+ docs\n+ ci\n+ chore\n+ # Configure that a scope must always be provided.\n+ requireScope: false\n+ # Configure additional validation for the subject based on a regex.\n+ # This example ensures the subject starts with an uppercase character.\n+ subjectPattern: ^[A-Z].+$\n+ # If `subjectPattern` is configured, you can use this property to override\n+ # the default error message that is shown when the pattern doesn't match.\n+ # The variables `subject` and `title` can be used within the message.\n+ subjectPatternError: |\n+ The subject \"{subject}\" found in the pull request title \"{title}\"\n+ didn't match the configured pattern. Please ensure that the subject\n+ starts with an uppercase character.\n+ # For work-in-progress PRs you can typically use draft pull requests\n+ # from Github. However, private repositories on the free plan don't have\n+ # this option and therefore this action allows you to opt-in to using the\n+ # special \"[WIP]\" prefix to indicate this state. This will avoid the\n+ # validation of the PR title and the pull request checks remain pending.\n+ # Note that a second check will be reported if this is enabled.\n+ wip: true\n+ # When using \"Squash and merge\" on a PR with only one commit, GitHub\n+ # will suggest using that commit message instead of the PR title for the\n+ # merge commit, and it's easy to commit this by mistake. Enable this option\n+ # to also validate the commit message for one commit PRs.\n+ validateSingleCommit: false\n---\n.github/workflows/release.yml\n@@ -7,13 +7,17 @@ on:\n - main\n - master\n paths:\n+ - '**/*.tpl'\n - '**/*.py'\n - '**/*.tf'\n+ - '.github/workflows/release.yml'\n \n jobs:\n release:\n name: Release\n runs-on: ubuntu-latest\n+ # Skip running release workflow on forks\n+ if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n@@ -28,5 +32,6 @@ jobs:\n extra_plugins: |\n @semantic-release/[email protected]\n @semantic-release/[email protected]\n+ [email protected]\n env:\n GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}\n---\n.github/workflows/stale-actions.yaml\n@@ -0,0 +1,32 @@\n+name: 'Mark or close stale issues and PRs'\n+on:\n+ schedule:\n+ - cron: '0 0 * * *'\n+\n+jobs:\n+ stale:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/stale@v4\n+ with:\n+ repo-token: ${{ secrets.GITHUB_TOKEN }}\n+ # Staling issues and PR's\n+ days-before-stale: 30\n+ stale-issue-label: stale\n+ stale-pr-label: stale\n+ stale-issue-message: |\n+ This issue has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this issue will be closed in 10 days\n+ stale-pr-message: |\n+ This PR has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this PR will be closed in 10 days\n+ # Not stale if have this labels or part of milestone\n+ exempt-issue-labels: bug,wip,on-hold\n+ exempt-pr-labels: bug,wip,on-hold\n+ exempt-all-milestones: true\n+ # Close issue operations\n+ # Label will be automatically removed if the issues are no longer closed nor locked.\n+ days-before-close: 10\n+ delete-branch: true\n+ close-issue-message: This issue was automatically closed because of stale in 10 days\n+ close-pr-message: This PR was automatically closed because of stale in 10 days\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.58.0\n+ rev: v1.62.3\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,6 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.0.1\n+ rev: v4.1.0\n hooks:\n - id: check-merge-conflict\n+ - id: end-of-file-fixer\n---\n.releaserc.json\n@@ -5,13 +5,22 @@\n ],\n \"ci\": false,\n \"plugins\": [\n- \"@semantic-release/commit-analyzer\",\n- \"@semantic-release/release-notes-generator\",\n+ [\n+ \"@semantic-release/commit-analyzer\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n+ [\n+ \"@semantic-release/release-notes-generator\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n [\n \"@semantic-release/github\",\n {\n- \"successComment\":\n- \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n+ \"successComment\": \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n \"labels\": false,\n \"releasedLabels\": false\n }\n---\nexamples/manage-default-vpc/main.tf\n@@ -19,4 +19,3 @@ module \"vpc\" {\n default_vpc_name = \"default\"\n default_vpc_enable_dns_hostnames = true\n }\n-\n---\nexamples/manage-default-vpc/outputs.tf\n@@ -8,4 +8,3 @@ output \"default_vpc_cidr_block\" {\n description = \"The CIDR block of the VPC\"\n value = module.vpc.default_vpc_cidr_block\n }\n-\n---\nexamples/secondary-cidr-blocks/outputs.tf\n@@ -31,4 +31,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\nexamples/simple-vpc/outputs.tf\n@@ -32,4 +32,3 @@ output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n-\n---\nexamples/vpc-flow-logs/outputs.tf\n@@ -55,4 +55,3 @@ output \"vpc_flow_logs_s3_bucket_vpc_flow_log_destination_type\" {\n description = \"The type of the destination for VPC Flow Logs\"\n value = module.vpc_with_flow_logs_s3_bucket.vpc_flow_log_destination_type\n }\n-\n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -35,4 +35,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\n\n\n---\n\nChoice C:\n.github/workflows/pr-title.yml\n@@ -0,0 +1,52 @@\n+name: 'Validate PR title'\n+\n+on:\n+ pull_request_target:\n+ types:\n+ - opened\n+ - edited\n+ - synchronize\n+\n+jobs:\n+ main:\n+ name: Validate PR title\n+ runs-on: ubuntu-latest\n+ steps:\n+ # Please look up the latest version from\n+ # https://github.com/amannn/action-semantic-pull-request/releases\n+ - uses: amannn/[email protected]\n+ env:\n+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n+ with:\n+ # Configure which types are allowed.\n+ # Default: https://github.com/commitizen/conventional-commit-types\n+ types: |\n+ fix\n+ feat\n+ docs\n+ ci\n+ chore\n+ # Configure that a scope must always be provided.\n+ requireScope: false\n+ # Configure additional validation for the subject based on a regex.\n+ # This example ensures the subject starts with an uppercase character.\n+ subjectPattern: ^[A-Z].+$\n+ # If `subjectPattern` is configured, you can use this property to override\n+ # the default error message that is shown when the pattern doesn't match.\n+ # The variables `subject` and `title` can be used within the message.\n+ subjectPatternError: |\n+ The subject \"{subject}\" found in the pull request title \"{title}\"\n+ didn't match the configured pattern. Please ensure that the subject\n+ starts with an uppercase character.\n+ # For work-in-progress PRs you can typically use draft pull requests\n+ # from Github. However, private repositories on the free plan don't have\n+ # this option and therefore this action allows you to opt-in to using the\n+ # special \"[WIP]\" prefix to indicate this state. This will avoid the\n+ # validation of the PR title and the pull request checks remain pending.\n+ # Note that a second check will be reported if this is enabled.\n+ wip: true\n+ # When using \"Squash and merge\" on a PR with only one commit, GitHub\n+ # will suggest using that commit message instead of the PR title for the\n+ # merge commit, and it's easy to commit this by mistake. Enable this option\n+ # to also validate the commit message for one commit PRs.\n+ validateSingleCommit: false\n---\n.github/workflows/release.yml\n@@ -7,13 +7,17 @@ on:\n - main\n - master\n paths:\n+ - '**/*.tpl'\n - '**/*.py'\n - '**/*.tf'\n+ - '.github/workflows/release.yml'\n \n jobs:\n release:\n name: Release\n runs-on: ubuntu-latest\n+ # Skip running release workflow on forks\n+ if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n@@ -28,5 +32,6 @@ jobs:\n extra_plugins: |\n @semantic-release/[email protected]\n @semantic-release/[email protected]\n+ [email protected]\n env:\n GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}\n---\n.github/workflows/stale-actions.yaml\n@@ -0,0 +1,32 @@\n+name: 'Mark or close stale issues and PRs'\n+on:\n+ schedule:\n+ - cron: '0 0 * * *'\n+\n+jobs:\n+ stale:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/stale@v4\n+ with:\n+ repo-token: ${{ secrets.GITHUB_TOKEN }}\n+ # Staling issues and PR's\n+ days-before-stale: 30\n+ stale-issue-label: stale\n+ stale-pr-label: stale\n+ stale-issue-message: |\n+ This issue has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this issue will be closed in 10 days\n+ stale-pr-message: |\n+ This PR has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this PR will be closed in 10 days\n+ # Not stale if have this labels or part of milestone\n+ exempt-issue-labels: bug,wip,on-hold\n+ exempt-pr-labels: bug,wip,on-hold\n+ exempt-all-milestones: true\n+ # Close issue operations\n+ # Label will be automatically removed if the issues are no longer closed nor locked.\n+ days-before-close: 10\n+ delete-branch: true\n+ close-issue-message: This issue was automatically closed because of stale in 10 days\n+ close-pr-message: This PR was automatically closed because of stale in 10 days\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.58.0\n+ rev: v1.62.3\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,6 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.0.1\n+ rev: v4.1.0\n hooks:\n - id: check-merge-conflict\n+ - id: end-of-file-fixer\n---\n.releaserc.json\n@@ -5,13 +5,22 @@\n ],\n \"ci\": false,\n \"plugins\": [\n- \"@semantic-release/commit-analyzer\",\n- \"@semantic-release/release-notes-generator\",\n+ [\n+ \"@semantic-release/commit-analyzer\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n+ [\n+ \"@semantic-release/release-notes-generator\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n [\n \"@semantic-release/github\",\n {\n- \"successComment\":\n- \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n+ \"successComment\": \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n \"labels\": false,\n \"releasedLabels\": false\n }\n---\nexamples/manage-default-vpc/main.tf\n@@ -19,4 +19,3 @@ module \"vpc\" {\n default_vpc_name = \"default\"\n default_vpc_enable_dns_hostnames = true\n }\n-\n---\nexamples/manage-default-vpc/outputs.tf\n@@ -8,4 +8,3 @@ output \"default_vpc_cidr_block\" {\n description = \"The CIDR block of the VPC\"\n value = module.vpc.default_vpc_cidr_block\n }\n-\n---\nexamples/secondary-cidr-blocks/outputs.tf\n@@ -31,4 +31,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\nexamples/simple-vpc/outputs.tf\n@@ -32,4 +32,3 @@ output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n-\n---\nexamples/vpc-flow-logs/outputs.tf\n@@ -55,4 +55,3 @@ output \"vpc_flow_logs_s3_bucket_vpc_flow_log_destination_type\" {\n description = \"The type of the destination for VPC Flow Logs\"\n value = module.vpc_with_flow_logs_s3_bucket.vpc_flow_log_destination_type\n }\n-\n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -35,4 +35,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\n\n\n---\n\nChoice D:\n.github/workflows/pr-title.yml\n@@ -0,0 +1,52 @@\n+name: 'Validate PR title'\n+\n+on:\n+ pull_request_target:\n+ types:\n+ - opened\n+ - edited\n+ - synchronize\n+\n+jobs:\n+ main:\n+ name: Validate PR title\n+ runs-on: ubuntu-latest\n+ steps:\n+ # Please look up the latest version from\n+ # https://github.com/amannn/action-semantic-pull-request/releases\n+ - uses: amannn/[email protected]\n+ env:\n+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n+ with:\n+ # Configure which types are allowed.\n+ # Default: https://github.com/commitizen/conventional-commit-types\n+ types: |\n+ fix\n+ feat\n+ docs\n+ ci\n+ chore\n+ # Configure that a scope must always be provided.\n+ requireScope: false\n+ # Configure additional validation for the subject based on a regex.\n+ # This example ensures the subject starts with an uppercase character.\n+ subjectPattern: ^[A-Z].+$\n+ # If `subjectPattern` is configured, you can use this property to override\n+ # the default error message that is shown when the pattern doesn't match.\n+ # The variables `subject` and `title` can be used within the message.\n+ subjectPatternError: |\n+ The subject \"{subject}\" found in the pull request title \"{title}\"\n+ didn't match the configured pattern. Please ensure that the subject\n+ starts with an uppercase character.\n+ # For work-in-progress PRs you can typically use draft pull requests\n+ # from Github. However, private repositories on the free plan don't have\n+ # this option and therefore this action allows you to opt-in to using the\n+ # special \"[WIP]\" prefix to indicate this state. This will avoid the\n+ # validation of the PR title and the pull request checks remain pending.\n+ # Note that a second check will be reported if this is enabled.\n+ wip: true\n+ # When using \"Squash and merge\" on a PR with only one commit, GitHub\n+ # will suggest using that commit message instead of the PR title for the\n+ # merge commit, and it's easy to commit this by mistake. Enable this option\n+ # to also validate the commit message for one commit PRs.\n+ validateSingleCommit: false\n---\n.github/workflows/release.yml\n@@ -7,13 +7,17 @@ on:\n - main\n - master\n paths:\n+ - '**/*.tpl'\n - '**/*.py'\n - '**/*.tf'\n+ - '.github/workflows/release.yml'\n \n jobs:\n release:\n name: Release\n runs-on: ubuntu-latest\n+ # Skip running release workflow on forks\n+ if: github.repository_owner == 'terraform-aws-modules'\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n@@ -28,5 +32,6 @@ jobs:\n extra_plugins: |\n @semantic-release/[email protected]\n @semantic-release/[email protected]\n+ [email protected]\n env:\n GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}\n---\n.github/workflows/stale-actions.yaml\n@@ -0,0 +1,32 @@\n+name: 'Mark or close stale issues and PRs'\n+on:\n+ schedule:\n+ - cron: '0 0 * * *'\n+\n+jobs:\n+ stale:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/stale@v4\n+ with:\n+ repo-token: ${{ secrets.GITHUB_TOKEN }}\n+ # Staling issues and PR's\n+ days-before-stale: 30\n+ stale-issue-label: stale\n+ stale-pr-label: stale\n+ stale-issue-message: |\n+ This issue has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this issue will be closed in 10 days\n+ stale-pr-message: |\n+ This PR has been automatically marked as stale because it has been open 30 days\n+ with no activity. Remove stale label or comment or this PR will be closed in 10 days\n+ # Not stale if have this labels or part of milestone\n+ exempt-issue-labels: bug,wip,on-hold\n+ exempt-pr-labels: bug,wip,on-hold\n+ exempt-all-milestones: true\n+ # Close issue operations\n+ # Label will be automatically removed if the issues are no longer closed nor locked.\n+ days-before-close: 10\n+ delete-branch: true\n+ close-issue-message: This issue was automatically closed because of stale in 10 days\n+ close-pr-message: This PR was automatically closed because of stale in 10 days\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: https://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.58.0\n+ rev: v1.62.3\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n@@ -23,6 +23,7 @@ repos:\n - '--args=--only=terraform_standard_module_structure'\n - '--args=--only=terraform_workspace_remote'\n - repo: https://github.com/pre-commit/pre-commit-hooks\n- rev: v4.0.1\n+ rev: v4.1.0\n hooks:\n - id: check-merge-conflict\n+ - id: end-of-file-fixer\n---\n.releaserc.json\n@@ -5,13 +5,22 @@\n ],\n \"ci\": false,\n \"plugins\": [\n- \"@semantic-release/commit-analyzer\",\n- \"@semantic-release/release-notes-generator\",\n+ [\n+ \"@semantic-release/commit-analyzer\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n+ [\n+ \"@semantic-release/release-notes-generator\",\n+ {\n+ \"preset\": \"conventionalcommits\"\n+ }\n+ ],\n [\n \"@semantic-release/github\",\n {\n- \"successComment\":\n- \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n+ \"successComment\": \"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:\",\n \"labels\": false,\n \"releasedLabels\": false\n }\n---\nexamples/manage-default-vpc/main.tf\n@@ -19,4 +19,3 @@ module \"vpc\" {\n default_vpc_name = \"default\"\n default_vpc_enable_dns_hostnames = true\n }\n-\n---\nexamples/manage-default-vpc/outputs.tf\n@@ -8,4 +8,3 @@ output \"default_vpc_cidr_block\" {\n description = \"The CIDR block of the VPC\"\n value = module.vpc.default_vpc_cidr_block\n }\n-\n---\nexamples/secondary-cidr-blocks/outputs.tf\n@@ -31,4 +31,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\nexamples/simple-vpc/outputs.tf\n@@ -32,4 +32,3 @@ output \"azs\" {\n description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n-\n---\nexamples/vpc-flow-logs/outputs.tf\n@@ -55,4 +55,3 @@ output \"vpc_flow_logs_s3_bucket_vpc_flow_log_destination_type\" {\n description = \"The type of the destination for VPC Flow Logs\"\n value = module.vpc_with_flow_logs_s3_bucket.vpc_flow_log_destination_type\n }\n-\n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -35,4 +35,3 @@ output \"nat_public_ips\" {\n description = \"List of public Elastic IPs created for AWS NAT Gateway\"\n value = module.vpc.nat_public_ips\n }\n-\n---\n\n\n---\n" } ]
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:\nthis is new moudle\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 tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nnewmodule\n@@ -0,0 +1 @@\n+this is module\n---\n module\n---\n\n\n---\n\nChoice B:\nnewmodule\n@@ -0,0 +1 @@\n+this is new module\n---\n\n\n---\n\nChoice C:\nnewmodule\n@@ -0,0 +1 is is new module\n---\n\n\n---\n\nChoice D:\nnewmodule\n@@ -0,0 +1 @@\n+this newmodule\n@@ new module\n---\n\n\n---\n" } ]
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 tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nnewmoudle\n@@ -0,0 +1,2 @@\n+adding @@\n+adding module\n+\n---\n\n\n---\n\nChoice B:\nnewmoudle\n@@ -0,0 +1,2 @@\n+adding new module\n+\n---\n\n\n---\n\nChoice C:\n-0,0 -0,0 +1,2 @@\n+adding new module\n+\n---\n\n\n---\n\nChoice D:\nnewmoudle\n@@ -0,0 newmoudle\n@@ @@\n+adding new module\n+\n---\n\n\n---\n" } ]
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 adds a minimal but complete example for an S3 Gateway VPC Endpoint. I would've loved to add a more complex example (ECR + S3), but the example was getting overwhelming.\r\n\r\n## Motivation and Context\r\nThis PR is motivated by 2 reasons:\r\n- the previous S3 example did not create a (free) Gateway Endpoint, which led to an embarrassing NAT Gateway bill for me\r\n- it took me longer than I would've liked to figure out how to use the resulting VPC Endpoints\r\n\r\n## Breaking Changes\r\nN/A\r\n\r\n## How Has This Been Tested?\r\nI ran a `terraform fmt` and `terraform validate` on the `examples/complete-vpc` code. The VPC Endpoint definition was copied from a private project where everything seems to be working fine.\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/README.md\n@@ -44,6 +44,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n |------|------|\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_iam_policy_document.s3_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n---\nexamples/complete-vpc/main.tf\n@@ -87,9 +87,22 @@ module \"vpc_endpoints\" {\n security_group_ids = [data.aws_security_group.default.id]\n \n endpoints = {\n+ # S3 Interface Endpoint\n+ # s3 = {\n+ # service = \"s3\"\n+ # tags = { Name = \"s3-vpc-endpoint\" }\n+ # },\n+ # S3 Gateway Endpoint, which is free\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([\n+ module.vpc.default_route_table_id,\n+ module.vpc.private_route_table_ids,\n+ module.vpc.public_route_table_ids,\n+ ])\n+ policy = data.aws_iam_policy_document.s3_endpoint_policy.json\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n@@ -232,3 +245,31 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n }\n }\n }\n+\n+# Example VPC Endpoint Policy for the S3 VPC Endpoint that only allows 1 action on 1 bucket.\n+# The S3 bucket policy can then be modified to only allow requests coming from the VPC Endpoint:\n+# condition {\n+# test = \"StringEquals\"\n+# variable = \"aws:sourceVpce\"\n+# values = [\n+# module.vpc_endpoints.endpoints[\"s3\"].id,\n+# ]\n+# }\n+data \"aws_iam_policy_document\" \"s3_endpoint_policy\" {\n+ statement {\n+ effect = \"Allow\"\n+\n+ actions = [\n+ \"s3:GetObject\",\n+ ]\n+\n+ resources = [\n+ \"arn:aws:s3:::example-bucket/*\",\n+ ]\n+\n+ principals {\n+ type = \"*\"\n+ identifiers = [\"*\"]\n+ }\n+ }\n+}\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/README.md\n@@ -44,6 +44,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n |------|------|\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_iam_policy_document.s3_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n---\nexamples/complete-vpc/main.tf\n@@ -87,9 +87,22 @@ module \"vpc_endpoints\" {\n security_group_ids = [data.aws_security_group.default.id]\n \n endpoints = {\n+ # S3 Interface Endpoint\n+ # s3 = {\n+ # service = \"s3\"\n+ # tags = { Name = \"s3-vpc-endpoint\" }\n+ # },\n+ # S3 Gateway Endpoint, which is free\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([\n+ module.vpc.default_route_table_id,\n+ module.vpc.private_route_table_ids,\n+ module.vpc.public_route_table_ids,\n+ ])\n+ policy = data.aws_iam_policy_document.s3_endpoint_policy.json\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n@@ -232,3 +245,31 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n }\n }\n }\n+\n+# Example VPC Endpoint Policy for the S3 VPC Endpoint that only allows 1 action on 1 bucket.\n+# The S3 bucket policy can then be modified to only allow requests coming from the VPC Endpoint:\n+# condition {\n+# test = \"StringEquals\"\n+# variable = \"aws:sourceVpce\"\n+# values = [\n+# module.vpc_endpoints.endpoints[\"s3\"].id,\n+# ]\n+# }\n+data \"aws_iam_policy_document\" \"s3_endpoint_policy\" {\n+ statement {\n+ effect = \"Allow\"\n+\n+ actions = [\n+ allows \"s3:GetObject\",\n+ ]\n+\n+ resources = [\n+ \"arn:aws:s3:::example-bucket/*\",\n+ ]\n+\n+ principals {\n+ type = \"*\"\n+ identifiers = [\"*\"]\n+ }\n+ }\n+}\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/README.md\n@@ -44,6 +44,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n |------|------|\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_iam_policy_document.s3_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n---\nexamples/complete-vpc/main.tf\n@@ -87,9 +87,22 @@ module \"vpc_endpoints\" {\n security_group_ids = [data.aws_security_group.default.id]\n \n endpoints = {\n+ # S3 Interface Endpoint\n+ # s3 = {\n+ # service = \"s3\"\n+ # tags = { Name = \"s3-vpc-endpoint\" }\n+ # },\n+ # S3 Gateway Endpoint, which is free\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([\n+ module.vpc.default_route_table_id,\n+ module.vpc.private_route_table_ids,\n+ module.vpc.public_route_table_ids,\n+ ])\n+ policy = data.aws_iam_policy_document.s3_endpoint_policy.json\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n@@ -232,3 +245,31 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n }\n }\n }\n+\n+# Example VPC Endpoint Policy for the S3 VPC Endpoint that only allows 1 action on 1 bucket.\n+# The S3 bucket policy can then be modified to only [\n+# requests coming from the VPC Endpoint:\n+# condition {\n+# test = \"StringEquals\"\n+# variable = \"aws:sourceVpce\"\n+# values = [\n+# module.vpc_endpoints.endpoints[\"s3\"].id,\n+# ]\n+# }\n+data \"aws_iam_policy_document\" \"s3_endpoint_policy\" {\n+ statement {\n+ effect = \"Allow\"\n+\n+ actions = [\n+ \"s3:GetObject\",\n+ ]\n+\n+ resources = [\n+ \"arn:aws:s3:::example-bucket/*\",\n+ ]\n+\n+ principals {\n+ type = \"*\"\n+ identifiers = [\"*\"]\n+ }\n+ }\n+}\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/README.md\n@@ -44,6 +44,7 @@ Note that this example may create resources which can cost (AWS Elastic IP\n |------|------|\n | [aws_iam_policy_document.dynamodb_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_iam_policy_document.generic_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n+| [aws_iam_policy_document.s3_endpoint_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |\n | [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |\n | [aws_vpc_endpoint_service.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) | data source |\n \n---\nexamples/complete-vpc/main.tf\n@@ -87,9 +87,22 @@ module \"vpc_endpoints\" {\n security_group_ids = [data.aws_security_group.default.id]\n \n endpoints = {\n+ # S3 Interface Endpoint\n+ # s3 = {\n+ # service = \"s3\"\n+ # tags = { Name = \"s3-vpc-endpoint\" }\n+ # },\n+ # S3 Gateway Endpoint, which is free\n s3 = {\n- service = \"s3\"\n- tags = { Name = \"s3-vpc-endpoint\" }\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+ route_table_ids = flatten([\n+ module.vpc.default_route_table_id,\n+ module.vpc.private_route_table_ids,\n+ module.vpc.public_route_table_ids,\n+ ])\n+ policy = data.aws_iam_policy_document.s3_endpoint_policy.json\n+ tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n service = \"dynamodb\"\n@@ -232,3 +245,31 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n }\n }\n }\n+\n+# Example VPC Endpoint Policy for the S3 VPC Endpoint that only allows 1 action on 1 bucket.\n+# The S3 bucket policy can then be modified to only allow requests coming from the VPC Endpoint:\n+# condition {\n+# test = \"StringEquals\"\n+# variable = \"aws:sourceVpce\"\n+# values = [\n+# module.vpc_endpoints.endpoints[\"s3\"].id,\n+# ]\n+# }\n+data \"aws_iam_policy_document\" \"s3_endpoint_policy\" {\n+ statement {\n+ effect = \"Allow\"\n+\n+ actions = [\n+ \"s3:GetObject\",\n+ ]\n+\n+ resources = [\n+ \"arn:aws:s3:::example-bucket/*\",\n+ ]\n+\n+ principals {\n+ type = \"*\"\n+ identifiers = [\"*\"]\n+ }\n+ }\n+}\n---\n\n\n---\n" } ]
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\nRather than adding an internet gateway and route table to the private database subnets, this will create a public subnet database group. This way, private databases can still be created in the database subnet. If there's a need for a public database, it can be created in the public DB subnet group, which will put in the public subnets.\r\n\r\n## Motivation and Context\r\n<!--- 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\nAllows the databse subnet to still be kept private without public ingress, while also allowing the creation of public databases if the need arises.\r\n\r\n## Breaking Changes\r\n<!-- 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 breaking changes, instead a couple new variables are added to create a new resource: `aws_db_subnet_group.database_public[0]` if `create_database_public_subnet_group` is set to `true`.\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\r\nTested with `examples/complete-vpc` by added `create_database_public_subnet_group = true` to the module. As expected, the additional resource was created.\r\n\r\nTruncated output from `terraform plan` when `create_database_public_subnet_group = true`:\r\n```hcl\r\n # aws_db_subnet_group.database_public[0] will be created\r\n + resource \"aws_db_subnet_group\" \"database_public\" {\r\n + arn = (known after apply)\r\n + description = \"Database public subnet group for test-vpc\"\r\n + id = (known after apply)\r\n + name = \"test-vpc-public\"\r\n + name_prefix = (known after apply)\r\n + subnet_ids = [\r\n + \"subnet-publicsubnet-1\",\r\n + \"subnet-publicsubnet-2\",\r\n + \"subnet-publicsubnet-3\",\r\n ]\r\n + tags = {\r\n + \"Name\" = \"test-vpc-public\"\r\n + \"Service\" = \"test VPC\"\r\n }\r\n + tags_all = {\r\n + \"Name\" = \"test-vpc-public\"\r\n + \"Role\" = \"Dev\"\r\n + \"Service\" = \"test VPC\"\r\n }\r\n }\r\n```\r\n\r\nI have also tested with an existing VPC where a db public subnet group exists. I was able to import that subnet group into the state file and run Terraform against that resource.\n\n---\n\nChoice A:\nREADME.md\n@@ -159,6 +159,15 @@ Sometimes it is handy to have public access to RDS instances (it is not recommen\n enable_dns_support = true\n ```\n \n+Alternatively, rather than creating an internet gateway to the entire database subnets, the following can be set:\n+\n+```hcl\n+create_database_public_subnet_group = true\n+```\n+\n+Setting this value to `true` will create a database subnet group within the public subnets. Any database created in this subnet group will have public access (in most cases, this is not recommended).\n+\n+\n ## Network Access Control Lists (ACL or NACL)\n \n This module can manage network ACL and rules. Once VPC is created, AWS creates the default network ACL, which can be controlled using this module (`manage_default_network_acl = true`).\n---\nmain.tf\n@@ -499,6 +499,22 @@ resource \"aws_db_subnet_group\" \"database\" {\n )\n }\n \n+resource \"aws_db_subnet_group\" \"database_public\" {\n+ count = var.create_vpc && length(var.public_subnets) > 0 && var.create_database_public_subnet_group ? 1 : 0\n+\n+ name = lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\"))\n+ description = \"Database public subnet group for ${var.name}\"\n+ subnet_ids = aws_subnet.public.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\")))\n+ },\n+ var.tags,\n+ var.database_public_subnet_group_tags,\n+ )\n+}\n+\n ################################################################################\n # Redshift subnet\n ################################################################################\n---\nvariables.tf\n@@ -238,6 +238,12 @@ variable \"create_database_subnet_group\" {\n default = true\n }\n \n+variable \"create_database_public_subnet_group\" {\n+ description = \"Controls if database public subnet group should be created (n.b. public_subnets must also be set). This will allow databases to be created for public access.\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_elasticache_subnet_group\" {\n description = \"Controls if elasticache subnet group should be created\"\n type = bool\n@@ -484,6 +490,12 @@ variable \"database_subnet_group_name\" {\n default = null\n }\n \n+variable \"database_public_subnet_group_name\" {\n+ description = \"Name of database public subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n@@ -496,6 +508,12 @@ variable \"database_subnet_group_tags\" {\n default = {}\n }\n \n+variable \"database_public_subnet_group_tags\" {\n+ description = \"Additional tags for the database public subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"redshift_subnet_tags\" {\n description = \"Additional tags for the redshift subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -159,6 +159,15 @@ Sometimes it is handy to have public access to RDS instances (it is not recommen\n enable_dns_support = true\n ```\n \n+Alternatively, rather than creating an internet gateway to the entire database subnets, the following can be set:\n+\n+```hcl\n+create_database_public_subnet_group = true\n+```\n+\n+Setting this value to `true` will create a database subnet group within the public subnets. Any database created in this subnet group will have public access (in most cases, this is not recommended).\n+\n+\n ## Network Access Control Lists (ACL or NACL)\n \n This module can manage network ACL and rules. Once = is created, AWS creates the default network ACL, which can be controlled using this module (`manage_default_network_acl = true`).\n---\nmain.tf\n@@ -499,6 +499,22 @@ resource \"aws_db_subnet_group\" \"database\" {\n )\n }\n \n+resource \"aws_db_subnet_group\" \"database_public\" {\n+ count = var.create_vpc && length(var.public_subnets) > 0 && var.create_database_public_subnet_group ? 1 : 0\n+\n+ name = lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\"))\n+ description = \"Database public subnet group for ${var.name}\"\n+ subnet_ids = aws_subnet.public.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\")))\n+ },\n+ var.tags,\n+ var.database_public_subnet_group_tags,\n+ )\n+}\n+\n ################################################################################\n # Redshift subnet\n ################################################################################\n---\nvariables.tf\n@@ -238,6 +238,12 @@ variable \"create_database_subnet_group\" {\n default = true\n }\n \n+variable \"create_database_public_subnet_group\" {\n+ description = \"Controls if database public subnet group should be created (n.b. public_subnets must also be set). This will allow databases to be created for public access.\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_elasticache_subnet_group\" {\n description = \"Controls if elasticache subnet group should be created\"\n type = bool\n@@ -484,6 +490,12 @@ variable \"database_subnet_group_name\" {\n default = null\n }\n \n+variable \"database_public_subnet_group_name\" {\n+ description = \"Name of database public subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n@@ -496,6 +508,12 @@ variable \"database_subnet_group_tags\" {\n default = {}\n }\n \n+variable \"database_public_subnet_group_tags\" {\n+ description = \"Additional tags for the database public subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"redshift_subnet_tags\" {\n description = \"Additional tags for the redshift subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -159,6 +159,15 @@ Sometimes it is handy to have public access to RDS instances (it is not recommen\n enable_dns_support = true\n ```\n \n+Alternatively, rather than creating an internet gateway to the entire database subnets, the following can be set:\n+\n+```hcl\n+create_database_public_subnet_group = true\n+```\n+\n+Setting this value to `true` will create a database subnet group within the public subnets. Any database created in this subnet group will have public access (in most cases, this is not recommended).\n+\n+\n ## Network Access Control Lists (ACL or NACL)\n \n This module can manage network ACL and rules. Once VPC is created, AWS creates the default network ACL, which can be controlled using this module (`manage_default_network_acl = true`).\n---\nmain.tf\n@@ -499,6 +499,22 @@ resource \"aws_db_subnet_group\" \"database\" {\n )\n }\n \n+resource \"aws_db_subnet_group\" \"database_public\" {\n+ count = var.create_vpc && length(var.public_subnets) > 0 && var.create_database_public_subnet_group ? 1 : 0\n+\n+ name = lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\"))\n+ description = \"Database public subnet group for ${var.name}\"\n+ subnet_ids = aws_subnet.public.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\")))\n+ },\n+ var.tags,\n+ var.database_public_subnet_group_tags,\n+ )\n+}\n+\n ################################################################################\n # Redshift subnet\n ################################################################################\n---\nvariables.tf\n@@ -238,6 +238,12 @@ variable \"create_database_subnet_group\" {\n default = true\n }\n \n+variable \"create_database_public_subnet_group\" {\n+ description = \"Controls if database public subnet group should be created (n.b. public_subnets must also be set). This will allow databases to be created for public access.\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_elasticache_subnet_group\" {\n description = \"Controls if elasticache subnet group should be created\"\n type = bool\n@@ -484,6 +490,12 @@ variable \"database_subnet_group_name\" {\n default = null\n }\n \n+variable \"database_public_subnet_group_name\" {\n+ description = \"Name of {\n public subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n@@ -496,6 +508,12 @@ variable \"database_subnet_group_tags\" {\n default = {}\n }\n \n+variable \"database_public_subnet_group_tags\" {\n+ description = \"Additional tags for the database public subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"redshift_subnet_tags\" {\n description = \"Additional tags for the redshift subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -159,6 +159,15 @@ Sometimes it is handy to have public access to RDS instances (it is not recommen\n enable_dns_support = true\n ```\n \n+Alternatively, rather than creating an internet gateway to the entire database subnets, the following can be set:\n+\n+```hcl\n+create_database_public_subnet_group = true\n+```\n+\n+Setting this value to `true` will create a database subnet group within the public subnets. Any database created in this subnet group will have public access (in most cases, this is not recommended).\n+\n+\n ## Network Access Control Lists (ACL or NACL)\n \n This module can manage network ACL and rules. Once VPC is created, AWS creates the default network ACL, which can be controlled using this module (`manage_default_network_acl = true`).\n---\nmain.tf\n@@ -499,6 +499,22 @@ resource \"aws_db_subnet_group\" \"database\" {\n )\n }\n \n+resource \"aws_db_subnet_group\" \"database_public\" {\n+ count = var.create_vpc && length(var.public_subnets) > 0 && var.create_database_public_subnet_group ? 1 : 0\n+\n+ name = lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\"))\n+ description = \"Database public subnet group for ${var.name}\"\n+ subnet_ids = aws_subnet.public.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_public_subnet_group_name, \"${var.name}-public\")))\n+ },\n+ var.tags,\n+ var.database_public_subnet_group_tags,\n+ )\n+}\n+\n ################################################################################\n # Redshift subnet\n ################################################################################\n---\nvariables.tf\n@@ -238,6 +238,12 @@ variable \"create_database_subnet_group\" {\n default = true\n }\n \n+variable \"create_database_public_subnet_group\" {\n+ description = \"Controls if database public subnet group should be created (n.b. public_subnets must also be set). This will allow databases to be created for public access.\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"create_elasticache_subnet_group\" {\n description = \"Controls if elasticache subnet group should be created\"\n type = bool\n@@ -484,6 +490,12 @@ variable \"database_subnet_group_name\" {\n default = null\n }\n \n+variable \"database_public_subnet_group_name\" {\n+ description = \"Name of database public subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n@@ -496,6 +508,12 @@ variable \"database_subnet_group_tags\" {\n default = {}\n }\n \n+variable \"database_public_subnet_group_tags\" {\n+ description = \"Additional tags for the database public subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n manage \"redshift_subnet_tags\" {\n description = \"Additional tags for the redshift subnets\"\n type = map(string)\n---\n\n\n---\n" } ]
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\nAdding the user provided tags to the IAM policy created by this terraform module\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? --> In order to enforce tagging requirements through Terraform Sentinel, all resources must be tagged.\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? --> No\r\n\r\n\r\n## How Has This Been Tested?\r\n- [-] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n\n\n---\n\nChoice A:\nvpc-flow-logs.tf\n@@ -90,6 +90,7 @@ resource \"aws_iam_policy\" \"vpc_flow_log_cloudwatch\" {\n \n name_prefix = \"vpc-flow-log-to-cloudwatch-\"\n policy = data.aws_iam_policy_document.vpc_flow_log_cloudwatch[0].json\n+ tags = merge(var.tags, }\n \n data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n---\n\n\n---\n\nChoice B:\nvpc-flow-logs.tf\n@@ -90,6 +90,7 @@ resource \"aws_iam_policy\" \"vpc_flow_log_cloudwatch\" {\n \n name_prefix = \"vpc-flow-log-to-cloudwatch-\"\n data.aws_iam_policy_document.vpc_flow_log_cloudwatch[0].json\n+ policy = data.aws_iam_policy_document.vpc_flow_log_cloudwatch[0].json\n+ tags = merge(var.tags, var.vpc_flow_log_tags)\n }\n \n data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n---\n\n\n---\n\nChoice C:\nvpc-flow-logs.tf\n@@ -90,6 +90,7 @@ resource \"aws_iam_policy\" \"vpc_flow_log_cloudwatch\" {\n \n name_prefix = \"vpc-flow-log-to-cloudwatch-\"\n policy = data.aws_iam_policy_document.vpc_flow_log_cloudwatch[0].json\n+ tags = merge(var.tags, var.vpc_flow_log_tags)\n }\n \n data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n---\n\n\n---\n\nChoice D:\nvpc-flow-logs.tf\n@@ -90,6 }\n @@ resource \"aws_iam_policy\" \"vpc_flow_log_cloudwatch\" {\n \n name_prefix = \"vpc-flow-log-to-cloudwatch-\"\n policy = data.aws_iam_policy_document.vpc_flow_log_cloudwatch[0].json\n+ tags = merge(var.tags, var.vpc_flow_log_tags)\n }\n \n data \"aws_iam_policy_document\" \"vpc_flow_log_cloudwatch\" {\n---\n\n\n---\n" } ]
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\nEnclosed `destination_options` block in `aws_flow_log` resource inside\r\n\"conditional\" dynamic block since it is needed only for `s3` destination type\r\n\r\n## Motivation and Context\r\n`destination_options` block is unnecessary for `cloud-watch-logs` destination type. I received `InvalidParameter` error while running it with `cloud-watch-logs` type. Full description of the issue is included in #702 \r\n\r\n- Closes #702 \r\n\r\n## Breaking Changes\r\nNo\r\n\r\n## How Has This Been Tested?\r\nTested on the project, where we use VPC module. Also tried to create a log in `s3` as well.\r\n\n\n---\n\nChoice A:\nvpc-flow-logs.tf\n@@ -24,10 +24,14 @@ resource \"aws_flow_log\" \"this\" {\n vpc_id = local.vpc_id\n max_aggregation_interval = var.flow_log_max_aggregation_interval\n \n- destination_options {\n- file_format = var.flow_log_file_format\n- hive_compatible_partitions = var.flow_log_hive_compatible_partitions\n- ? per_hour_partition = var.flow_log_per_hour_partition\n+ dynamic \"destination_options\" {\n+ for_each = var.flow_log_destination_type == \"s3\" ? [true] : []\n+\n+ content {\n+ file_format = var.flow_log_file_format\n+ hive_compatible_partitions = var.flow_log_hive_compatible_partitions\n+ per_hour_partition = var.flow_log_per_hour_partition\n+ }\n }\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n---\n\n\n---\n\nChoice B:\nvpc-flow-logs.tf\n@@ -24,10 +24,14 @@ resource \"aws_flow_log\" \"this\" {\n vpc_id = local.vpc_id\n max_aggregation_interval = var.flow_log_max_aggregation_interval\n \n- destination_options {\n- file_format = var.flow_log_file_format\n- hive_compatible_partitions = var.flow_log_hive_compatible_partitions\n- per_hour_partition = var.flow_log_per_hour_partition\n+ dynamic \"destination_options\" {\n+ for_each = var.flow_log_destination_type == \"s3\" ? [true] : []\n+\n+ content {\n+ file_format = var.flow_log_file_format\n+ hive_compatible_partitions = var.flow_log_hive_compatible_partitions\n+ per_hour_partition = var.flow_log_per_hour_partition\n+ }\n }\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n---\n\n\n---\n\nChoice C:\nvpc-flow-logs.tf\n@@ -24,10 +24,14 @@ resource \"aws_flow_log\" \"this\" {\n vpc_id = local.vpc_id\n max_aggregation_interval = var.flow_log_max_aggregation_interval\n \n- destination_options {\n- file_format = var.flow_log_file_format\n- hive_compatible_partitions = var.flow_log_hive_compatible_partitions\n- per_hour_partition = var.flow_log_per_hour_partition\n+ dynamic \"destination_options\" {\n+ for_each = var.flow_log_destination_type == \"s3\" ? [true] : []\n+\n+ content {\n+ file_format = var.flow_log_file_format\n+ hive_compatible_partitions = var.flow_log_hive_compatible_partitions\n+ per_hour_partition = var.flow_log_per_hour_partition\n+ }\n }\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n---\n\n\n---\n\nChoice D:\nvpc-flow-logs.tf\n@@ -24,10 +24,14 @@ resource \"aws_flow_log\" \"this\" {\n vpc_id = local.vpc_id\n max_aggregation_interval = var.flow_log_max_aggregation_interval\n \n- destination_options {\n- file_format = var.flow_log_file_format\n- hive_compatible_partitions = var.flow_log_hive_compatible_partitions\n- per_hour_partition = var.flow_log_per_hour_partition\n+ dynamic \"destination_options\" {\n+ for_each = var.flow_log_destination_type == \"s3\" ? [true] : []\n+\n+ content {\n+ file_format = var.flow_log_file_format\n+ hive_compatible_partitions var.flow_log_hive_compatible_partitions\n+ per_hour_partition = var.flow_log_per_hour_partition\n+ }\n }\n \n tags = merge(var.tags, var.vpc_flow_log_tags)\n---\n\n\n---\n" } ]
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\nAdded timeout block to the `aws_default_route_table` vpc resource .\r\n\r\n## Motivation and Context\r\nUpdates the TF VPC module with the latest aws provider release enhancements.\r\n[3.62.0](https://github.com/hashicorp/terraform-provider-aws/blob/main/CHANGELOG.md#3620-october-08-2021)\r\n\r\n> resource/aws_default_route_table: Add custom timeouts block (#21161)\r\n\r\n## Breaking Changes\r\nNo\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n*Testing*\r\n\r\nTested the example/complete_vpc terraform template.\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -184,6 +184,11 @@ resource \"aws_default_route_table\" \"default\" {\n }\n }\n \n+ timeouts {\n+ create = \"5m\"\n+ update = \"5m\"\n+ }\n+\n tags = merge(\n { \"Name\" = var.name },\n var.tags,\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -184,6 +184,11 @@ resource \"aws_default_route_table\" \"default\" {\n }\n }\n \n+ timeouts {\n+ create = \"5m\"\n+ update = \"5m\"\n+ }\n+\n tags = merge(\n { {\n+ = var.name },\n var.tags,\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -184,6 +184,11 @@ resource \"aws_default_route_table\" \"default\" {\n }\n }\n \n+ timeouts {\n+ create = \"5m\"\n+ update = \"5m\"\n+ }\n+\n tags = merge(\n { \"Name\" = var.name },\n = var.tags,\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -184,6 +184,11 @@ resource \"aws_default_route_table\" \"default\" {\n }\n }\n \n+ timeouts {\n+ create = \"5m\"\n+ update = \"5m\"\n+ }\n+\n tags = merge(\n { \"Name\" = var.name },\n var.tags,\n---\n\n\n---\n" } ]
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 tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\n143\n@@ -0,0 +1 @@\n+\n---\n\n\n---\n\nChoice B:\n143\n@@ 143\n@@ +1 @@\n+\n---\n\n\n---\n\nChoice C:\n143\n@@ -0,0 @@\n+\n---\n @@\n+\n---\n\n\n---\n\nChoice D:\n143\n@@ -0,0 143\n@@ @@\n+\n---\n\n\n---\n" } ]
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:\nJust corrected a small typo in AZs\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 tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nexamples/simple-vpc/outputs.tf\n@@ -29,7 +29,7 @@ output \"nat_public_ips\" {\n \n # AZs\n output \"azs\" {\n- description = \"A list of availability zones spefified as argument \n this module\"\n+ description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n \n---\n\n\n---\n\nChoice B:\nexamples/simple-vpc/outputs.tf\n@@ -29,7 +29,7 @@ output \"nat_public_ips\" {\n \n # AZs\n output \"azs\" {\n- description = \"A list of availability zones \"nat_public_ips\" as argument to this module\"\n+ description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n \n---\n\n\n---\n\nChoice C:\nexamples/simple-vpc/outputs.tf\n@@ -29,7 +29,7 @@ output \"nat_public_ips\" {\n \n # AZs\n output \"azs\" description = \"A list of availability zones spefified as argument to this module\"\n+ description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n \n---\n\n\n---\n\nChoice D:\nexamples/simple-vpc/outputs.tf\n@@ -29,7 +29,7 @@ output \"nat_public_ips\" {\n \n # AZs\n output \"azs\" {\n- description = \"A list of availability zones spefified as argument to this module\"\n+ description = \"A list of availability zones specified as argument to this module\"\n value = module.vpc.azs\n }\n \n---\n\n\n---\n" } ]
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\nAdd support for elasticache_subnet_group_name, elasticache_subnet_group_tags and redshift_subnet_group_name similar to what database subnet group already has\r\n\r\n## Motivation and Context\r\nIt is expected that naming and tagging of subnet groups work similarily in each case\r\n\r\n## Breaking Changes\r\nShould not break anything\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -189,13 +189,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n-| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.28 |\n+| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.38 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.28 |\n+| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.38 |\n \n ## Modules\n \n@@ -346,6 +346,8 @@ No modules.\n | <a name=\"input_elasticache_outbound_acl_rules\"></a> [elasticache\\_outbound\\_acl\\_rules](#input\\_elasticache\\_outbound\\_acl\\_rules) | Elasticache subnets outbound network ACL rules | `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_elasticache_route_table_tags\"></a> [elasticache\\_route\\_table\\_tags](#input\\_elasticache\\_route\\_table\\_tags) | Additional tags for the elasticache route tables | `map(string)` | `{}` | no |\n | <a name=\"input_elasticache_subnet_assign_ipv6_address_on_creation\"></a> [elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on elasticache subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| <a name=\"input_elasticache_subnet_group_name\"></a> [elasticache\\_subnet\\_group\\_name](#input\\_elasticache\\_subnet\\_group\\_name) | Name of elasticache subnet group | `string` | `null` | no |\n+| <a name=\"input_elasticache_subnet_group_tags\"></a> [elasticache\\_subnet\\_group\\_tags](#input\\_elasticache\\_subnet\\_group\\_tags) | Additional tags for the elasticache subnet group | `map(string)` | `{}` | no |\n | <a name=\"input_elasticache_subnet_ipv6_prefixes\"></a> [elasticache\\_subnet\\_ipv6\\_prefixes](#input\\_elasticache\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 elasticache subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | <a name=\"input_elasticache_subnet_suffix\"></a> [elasticache\\_subnet\\_suffix](#input\\_elasticache\\_subnet\\_suffix) | Suffix to append to elasticache subnets name | `string` | `\"elasticache\"` | no |\n | <a name=\"input_elasticache_subnet_tags\"></a> [elasticache\\_subnet\\_tags](#input\\_elasticache\\_subnet\\_tags) | Additional tags for the elasticache subnets | `map(string)` | `{}` | no |\n@@ -432,6 +434,7 @@ No modules.\n | <a name=\"input_redshift_outbound_acl_rules\"></a> [redshift\\_outbound\\_acl\\_rules](#input\\_redshift\\_outbound\\_acl\\_rules) | Redshift subnets outbound network ACL rules | `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_redshift_route_table_tags\"></a> [redshift\\_route\\_table\\_tags](#input\\_redshift\\_route\\_table\\_tags) | Additional tags for the redshift route tables | `map(string)` | `{}` | no |\n | <a name=\"input_redshift_subnet_assign_ipv6_address_on_creation\"></a> [redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on redshift subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| <a name=\"input_redshift_subnet_group_name\"></a> [redshift\\_subnet\\_group\\_name](#input\\_redshift\\_subnet\\_group\\_name) | Name of redshift subnet group | `string` | `null` | no |\n | <a name=\"input_redshift_subnet_group_tags\"></a> [redshift\\_subnet\\_group\\_tags](#input\\_redshift\\_subnet\\_group\\_tags) | Additional tags for the redshift subnet group | `map(string)` | `{}` | no |\n | <a name=\"input_redshift_subnet_ipv6_prefixes\"></a> [redshift\\_subnet\\_ipv6\\_prefixes](#input\\_redshift\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 redshift subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | <a name=\"input_redshift_subnet_suffix\"></a> [redshift\\_subnet\\_suffix](#input\\_redshift\\_subnet\\_suffix) | Suffix to append to redshift subnets name | `string` | `\"redshift\"` | no |\n---\nmain.tf\n@@ -525,13 +525,13 @@ resource \"aws_subnet\" \"redshift\" {\n resource \"aws_redshift_subnet_group\" \"redshift\" {\n count = var.create_vpc && length(var.redshift_subnets) > 0 && var.create_redshift_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.redshift_subnet_group_name, var.name))\n description = \"Redshift subnet group for ${var.name}\"\n subnet_ids = aws_subnet.redshift.*.id\n \n tags = merge(\n {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = format(\"%s\", coalesce(var.redshift_subnet_group_name, var.name))\n },\n var.tags,\n var.redshift_subnet_group_tags,\n@@ -569,9 +569,17 @@ resource \"aws_subnet\" \"elasticache\" {\n resource \"aws_elasticache_subnet_group\" \"elasticache\" {\n count = var.create_vpc && length(var.elasticache_subnets) > 0 && var.create_elasticache_subnet_group ? 1 : 0\n \n- name = var.name\n+ name = coalesce(var.elasticache_subnet_group_name, var.name)\n description = \"ElastiCache subnet group for ${var.name}\"\n subnet_ids = aws_subnet.elasticache.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", coalesce(var.elasticache_subnet_group_name, var.name))\n+ },\n+ var.tags,\n+ var.elasticache_subnet_group_tags,\n+ )\n }\n \n ################################################################################\n---\nvariables.tf\n@@ -502,12 +502,30 @@ variable \"redshift_subnet_tags\" {\n default = {}\n }\n \n+variable \"redshift_subnet_group_name\" {\n+ description = \"Name of redshift subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"redshift_subnet_group_tags\" {\n description = \"Additional tags for the redshift subnet group\"\n type = map(string)\n default = {}\n }\n \n+variable \"elasticache_subnet_group_name\" {\n+ description = \"Name of elasticache subnet group\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"elasticache_subnet_group_tags\" {\n+ description = \"Additional tags for the elasticache subnet group\"\n+ subnet, = map(string)\n+ default = {}\n+}\n+\n variable \"elasticache_subnet_tags\" {\n description = \"Additional tags for the elasticache subnets\"\n type = map(string)\n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.28\"\n+ version = \">= 3.38\"\n }\n }\n }\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -189,13 +189,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n-| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.28 |\n+| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.38 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.28 |\n+| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.38 |\n \n ## Modules\n \n@@ -346,6 +346,8 @@ No modules.\n | <a name=\"input_elasticache_outbound_acl_rules\"></a> [elasticache\\_outbound\\_acl\\_rules](#input\\_elasticache\\_outbound\\_acl\\_rules) | Elasticache subnets outbound network ACL rules | `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_elasticache_route_table_tags\"></a> [elasticache\\_route\\_table\\_tags](#input\\_elasticache\\_route\\_table\\_tags) | Additional tags for the elasticache route tables | `map(string)` | `{}` | no |\n | <a name=\"input_elasticache_subnet_assign_ipv6_address_on_creation\"></a> [elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on elasticache subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| <a name=\"input_elasticache_subnet_group_name\"></a> [elasticache\\_subnet\\_group\\_name](#input\\_elasticache\\_subnet\\_group\\_name) | Name of elasticache subnet group | `string` | `null` | no |\n+| <a name=\"input_elasticache_subnet_group_tags\"></a> [elasticache\\_subnet\\_group\\_tags](#input\\_elasticache\\_subnet\\_group\\_tags) | Additional tags for the elasticache subnet group | `map(string)` | `{}` | no |\n | <a name=\"input_elasticache_subnet_ipv6_prefixes\"></a> [elasticache\\_subnet\\_ipv6\\_prefixes](#input\\_elasticache\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 elasticache subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | <a name=\"input_elasticache_subnet_suffix\"></a> [elasticache\\_subnet\\_suffix](#input\\_elasticache\\_subnet\\_suffix) | Suffix to append to elasticache subnets name | `string` | `\"elasticache\"` | no |\n | <a name=\"input_elasticache_subnet_tags\"></a> [elasticache\\_subnet\\_tags](#input\\_elasticache\\_subnet\\_tags) | Additional tags for the elasticache subnets | `map(string)` | `{}` | no |\n@@ -432,6 +434,7 @@ No modules.\n | <a name=\"input_redshift_outbound_acl_rules\"></a> [redshift\\_outbound\\_acl\\_rules](#input\\_redshift\\_outbound\\_acl\\_rules) | Redshift subnets outbound network ACL rules | `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_redshift_route_table_tags\"></a> [redshift\\_route\\_table\\_tags](#input\\_redshift\\_route\\_table\\_tags) | Additional tags for the redshift route tables | `map(string)` | `{}` | no |\n | <a name=\"input_redshift_subnet_assign_ipv6_address_on_creation\"></a> [redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on redshift subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| <a name=\"input_redshift_subnet_group_name\"></a> [redshift\\_subnet\\_group\\_name](#input\\_redshift\\_subnet\\_group\\_name) | Name of redshift subnet group | `string` | `null` | no |\n | <a name=\"input_redshift_subnet_group_tags\"></a> [redshift\\_subnet\\_group\\_tags](#input\\_redshift\\_subnet\\_group\\_tags) | Additional tags for the redshift subnet group | `map(string)` | `{}` | no |\n | <a name=\"input_redshift_subnet_ipv6_prefixes\"></a> [redshift\\_subnet\\_ipv6\\_prefixes](#input\\_redshift\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 redshift subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | <a name=\"input_redshift_subnet_suffix\"></a> [redshift\\_subnet\\_suffix](#input\\_redshift\\_subnet\\_suffix) | Suffix to append to redshift subnets name | `string` | `\"redshift\"` | no |\n---\nmain.tf\n@@ -525,13 +525,13 @@ resource \"aws_subnet\" \"redshift\" {\n resource \"aws_redshift_subnet_group\" \"redshift\" count = var.create_vpc && length(var.redshift_subnets) > 0 && var.create_redshift_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.redshift_subnet_group_name, var.name))\n description = \"Redshift subnet group for ${var.name}\"\n subnet_ids = aws_subnet.redshift.*.id\n \n tags = merge(\n {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = format(\"%s\", coalesce(var.redshift_subnet_group_name, var.name))\n },\n var.tags,\n var.redshift_subnet_group_tags,\n@@ -569,9 +569,17 @@ resource \"aws_subnet\" \"elasticache\" {\n resource \"aws_elasticache_subnet_group\" \"elasticache\" {\n count = var.create_vpc && length(var.elasticache_subnets) > 0 && var.create_elasticache_subnet_group ? 1 : 0\n \n- name = var.name\n+ name = coalesce(var.elasticache_subnet_group_name, var.name)\n description = \"ElastiCache subnet group for ${var.name}\"\n subnet_ids = aws_subnet.elasticache.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", coalesce(var.elasticache_subnet_group_name, var.name))\n+ },\n+ var.tags,\n+ var.elasticache_subnet_group_tags,\n+ )\n }\n \n ################################################################################\n---\nvariables.tf\n@@ -502,12 +502,30 @@ variable \"redshift_subnet_tags\" {\n default = {}\n }\n \n+variable \"redshift_subnet_group_name\" {\n+ description = \"Name of redshift subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"redshift_subnet_group_tags\" {\n description = \"Additional tags for the redshift subnet group\"\n type = map(string)\n default = {}\n }\n \n+variable \"elasticache_subnet_group_name\" {\n+ description = \"Name of elasticache subnet group\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"elasticache_subnet_group_tags\" {\n+ description = \"Additional tags for the elasticache subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"elasticache_subnet_tags\" {\n description = \"Additional tags for the elasticache subnets\"\n type = map(string)\n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.28\"\n+ version = \">= 3.38\"\n }\n }\n }\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -189,13 +189,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n-| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.28 |\n+| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.38 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.28 |\n+| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.38 |\n \n ## Modules\n \n@@ -346,6 +346,8 @@ No modules.\n | <a name=\"input_elasticache_outbound_acl_rules\"></a> [elasticache\\_outbound\\_acl\\_rules](#input\\_elasticache\\_outbound\\_acl\\_rules) | Elasticache subnets outbound network ACL rules | `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_elasticache_route_table_tags\"></a> [elasticache\\_route\\_table\\_tags](#input\\_elasticache\\_route\\_table\\_tags) | Additional tags for the elasticache route tables | `map(string)` | `{}` | no |\n | <a name=\"input_elasticache_subnet_assign_ipv6_address_on_creation\"></a> [elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on elasticache subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| <a name=\"input_elasticache_subnet_group_name\"></a> [elasticache\\_subnet\\_group\\_name](#input\\_elasticache\\_subnet\\_group\\_name) | Name of elasticache subnet group | `string` | `null` | no |\n+| <a name=\"input_elasticache_subnet_group_tags\"></a> [elasticache\\_subnet\\_group\\_tags](#input\\_elasticache\\_subnet\\_group\\_tags) | Additional tags for the elasticache subnet group | `map(string)` | `{}` | no |\n | <a name=\"input_elasticache_subnet_ipv6_prefixes\"></a> [elasticache\\_subnet\\_ipv6\\_prefixes](#input\\_elasticache\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 elasticache subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | <a name=\"input_elasticache_subnet_suffix\"></a> [elasticache\\_subnet\\_suffix](#input\\_elasticache\\_subnet\\_suffix) | Suffix to append to elasticache subnets name | `string` | `\"elasticache\"` | no |\n | <a name=\"input_elasticache_subnet_tags\"></a> [elasticache\\_subnet\\_tags](#input\\_elasticache\\_subnet\\_tags) | Additional tags for the elasticache subnets | `map(string)` | `{}` | no |\n@@ -432,6 +434,7 @@ No modules.\n | <a name=\"input_redshift_outbound_acl_rules\"></a> [redshift\\_outbound\\_acl\\_rules](#input\\_redshift\\_outbound\\_acl\\_rules) | Redshift subnets outbound network ACL rules | `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_redshift_route_table_tags\"></a> [redshift\\_route\\_table\\_tags](#input\\_redshift\\_route\\_table\\_tags) | Additional tags for the redshift route tables | `map(string)` | `{}` | no |\n | <a name=\"input_redshift_subnet_assign_ipv6_address_on_creation\"></a> [redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on redshift subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| <a name=\"input_redshift_subnet_group_name\"></a> [redshift\\_subnet\\_group\\_name](#input\\_redshift\\_subnet\\_group\\_name) | Name of redshift subnet group | `string` | `null` | no |\n | <a name=\"input_redshift_subnet_group_tags\"></a> [redshift\\_subnet\\_group\\_tags](#input\\_redshift\\_subnet\\_group\\_tags) | Additional tags for the redshift subnet group | `map(string)` | `{}` | no |\n | <a name=\"input_redshift_subnet_ipv6_prefixes\"></a> [redshift\\_subnet\\_ipv6\\_prefixes](#input\\_redshift\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 redshift subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | <a name=\"input_redshift_subnet_suffix\"></a> [redshift\\_subnet\\_suffix](#input\\_redshift\\_subnet\\_suffix) | Suffix to append to redshift subnets name | `string` | `\"redshift\"` | no |\n---\nmain.tf\n@@ -525,13 +525,13 @@ resource \"aws_subnet\" \"redshift\" {\n resource \"aws_redshift_subnet_group\" \"redshift\" {\n count = var.create_vpc && length(var.redshift_subnets) > 0 && var.create_redshift_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.redshift_subnet_group_name, var.name))\n description = \"Redshift subnet group for ${var.name}\"\n subnet_ids = aws_subnet.redshift.*.id\n \n tags = merge(\n {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = format(\"%s\", coalesce(var.redshift_subnet_group_name, var.name))\n },\n var.tags,\n var.redshift_subnet_group_tags,\n@@ -569,9 +569,17 @@ resource \"aws_subnet\" \"elasticache\" {\n resource \"aws_elasticache_subnet_group\" \"elasticache\" {\n count = var.create_vpc && length(var.elasticache_subnets) > 0 && var.create_elasticache_subnet_group ? 1 : 0\n \n- name = var.name\n+ name = coalesce(var.elasticache_subnet_group_name, var.name)\n description = \"ElastiCache subnet group for ${var.name}\"\n subnet_ids = aws_subnet.elasticache.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", coalesce(var.elasticache_subnet_group_name, var.name))\n+ },\n+ var.tags,\n+ var.elasticache_subnet_group_tags,\n+ )\n }\n \n ################################################################################\n---\nvariables.tf\n@@ -502,12 +502,30 @@ variable \"redshift_subnet_tags\" {\n default = {}\n }\n \n+variable \"redshift_subnet_group_name\" {\n+ description = \"Name of redshift subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"redshift_subnet_group_tags\" {\n description = \"Additional tags for the redshift subnet group\"\n type = map(string)\n default = {}\n }\n \n+variable \"elasticache_subnet_group_name\" {\n+ description = \"Name of elasticache subnet group\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"elasticache_subnet_group_tags\" {\n+ description = \"Additional tags for the elasticache subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"elasticache_subnet_tags\" {\n description = \"Additional tags for the elasticache subnets\"\n type = map(string)\n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.28\"\n+ version = \">= 3.38\"\n }\n }\n }\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -189,13 +189,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n-| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.28 |\n+| <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.38 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.28 |\n+| <a name=\"provider_aws\"></a> [aws](#provider\\_aws) | >= 3.38 |\n \n ## Modules\n \n@@ -346,6 +346,8 @@ No modules.\n | <a name=\"input_elasticache_outbound_acl_rules\"></a> [elasticache\\_outbound\\_acl\\_rules](#input\\_elasticache\\_outbound\\_acl\\_rules) | Elasticache subnets outbound network ACL rules | `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_elasticache_route_table_tags\"></a> [elasticache\\_route\\_table\\_tags](#input\\_elasticache\\_route\\_table\\_tags) | Additional tags for the elasticache route tables | `map(string)` | `{}` | no |\n | <a name=\"input_elasticache_subnet_assign_ipv6_address_on_creation\"></a> [elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_elasticache\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on elasticache subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| <a name=\"input_elasticache_subnet_group_name\"></a> [elasticache\\_subnet\\_group\\_name](#input\\_elasticache\\_subnet\\_group\\_name) | Name of elasticache subnet group | `string` | `null` | no |\n+| <a name=\"input_elasticache_subnet_group_tags\"></a> [elasticache\\_subnet\\_group\\_tags](#input\\_elasticache\\_subnet\\_group\\_tags) | Additional tags for the elasticache subnet group | `map(string)` | `{}` | no |\n | <a name=\"input_elasticache_subnet_ipv6_prefixes\"></a> [elasticache\\_subnet\\_ipv6\\_prefixes](#input\\_elasticache\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 elasticache subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | <a name=\"input_elasticache_subnet_suffix\"></a> [elasticache\\_subnet\\_suffix](#input\\_elasticache\\_subnet\\_suffix) | Suffix to append to elasticache subnets name | `string` | `\"elasticache\"` | no |\n | <a name=\"input_elasticache_subnet_tags\"></a> [elasticache\\_subnet\\_tags](#input\\_elasticache\\_subnet\\_tags) | Additional tags for the elasticache subnets | `map(string)` | `{}` | no |\n@@ -432,6 +434,7 @@ No modules.\n | <a name=\"input_redshift_outbound_acl_rules\"></a> [redshift\\_outbound\\_acl\\_rules](#input\\_redshift\\_outbound\\_acl\\_rules) | Redshift subnets outbound network ACL rules | `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_redshift_route_table_tags\"></a> [redshift\\_route\\_table\\_tags](#input\\_redshift\\_route\\_table\\_tags) | Additional tags for the redshift route tables | `map(string)` | `{}` | no |\n | <a name=\"input_redshift_subnet_assign_ipv6_address_on_creation\"></a> [redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_redshift\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on redshift subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| <a name=\"input_redshift_subnet_group_name\"></a> [redshift\\_subnet\\_group\\_name](#input\\_redshift\\_subnet\\_group\\_name) | Name of redshift subnet group | `string` | `null` | no |\n | <a name=\"input_redshift_subnet_group_tags\"></a> [redshift\\_subnet\\_group\\_tags](#input\\_redshift\\_subnet\\_group\\_tags) | Additional tags for the redshift subnet group | `map(string)` | `{}` | no |\n | <a name=\"input_redshift_subnet_ipv6_prefixes\"></a> [redshift\\_subnet\\_ipv6\\_prefixes](#input\\_redshift\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 redshift subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | <a name=\"input_redshift_subnet_suffix\"></a> [redshift\\_subnet\\_suffix](#input\\_redshift\\_subnet\\_suffix) | Suffix to append to redshift subnets name | `string` | `\"redshift\"` | no |\n---\nmain.tf\n@@ -525,13 +525,13 @@ resource \"aws_subnet\" \"redshift\" {\n resource \"aws_redshift_subnet_group\" \"redshift\" {\n count = var.create_vpc && length(var.redshift_subnets) > 0 && var.create_redshift_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.redshift_subnet_group_name, var.name))\n description = \"Redshift subnet group for ${var.name}\"\n subnet_ids = aws_subnet.redshift.*.id\n \n tags = merge(\n {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = coalesce(var.redshift_subnet_group_name, var.name))\n },\n var.tags,\n var.redshift_subnet_group_tags,\n@@ -569,9 +569,17 @@ resource \"aws_subnet\" \"elasticache\" {\n resource \"aws_elasticache_subnet_group\" \"elasticache\" {\n count = var.create_vpc && length(var.elasticache_subnets) > 0 && var.create_elasticache_subnet_group ? 1 : 0\n \n- name = var.name\n+ name = coalesce(var.elasticache_subnet_group_name, var.name)\n description = \"ElastiCache subnet group for ${var.name}\"\n subnet_ids = aws_subnet.elasticache.*.id\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\"%s\", coalesce(var.elasticache_subnet_group_name, var.name))\n+ },\n+ var.tags,\n+ var.elasticache_subnet_group_tags,\n+ )\n }\n \n ################################################################################\n---\nvariables.tf\n@@ -502,12 +502,30 @@ variable \"redshift_subnet_tags\" {\n default = {}\n }\n \n+variable \"redshift_subnet_group_name\" {\n+ description = \"Name of redshift subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"redshift_subnet_group_tags\" {\n description = \"Additional tags for the redshift subnet group\"\n type = map(string)\n default = {}\n }\n \n+variable \"elasticache_subnet_group_name\" {\n+ description = \"Name of elasticache subnet group\"\n+ type = string\n+ default = null\n+}\n+\n+variable \"elasticache_subnet_group_tags\" {\n+ description = \"Additional tags for the elasticache subnet group\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"elasticache_subnet_tags\" {\n description = \"Additional tags for the elasticache subnets\"\n type = map(string)\n---\nversions.tf\n@@ -4,7 +4,7 @@ terraform {\n required_providers {\n aws = {\n source = \"hashicorp/aws\"\n- version = \">= 3.28\"\n+ version = \">= 3.38\"\n }\n }\n }\n---\n\n\n---\n" } ]
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\nDHCP option sets should default to AWS provided NTP servers\r\n\r\n## Motivation and Context\r\nJust as DHCP option sets default to `AmazonProvidedDNS`, they should also default to Amazon provided NTP, served by the [Amazon Time Sync Service](https://aws.amazon.com/blogs/mt/manage-amazon-ec2-instance-clock-accuracy-using-amazon-time-sync-service-and-amazon-cloudwatch-part-1/).\r\nSince AWS inexplicably provides no analogous symbol `AmazonProvidedNTP`, we serve the link-local IPv4 address `169.254.169.123` for use by DHCP clients that don't configure it statically (e.g. recent AWS [Linux](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html) or [Windows](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/windows-set-time.html) AMIs).\r\n\r\n## Breaking Changes\r\nnone\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n```\r\n$ git checkout use-amazon-time-sync-service\r\n$ cd examples/simple-vpc\r\n$ terraform -version\r\nTerraform v1.0.4\r\non darwin_amd64\r\n+ provider registry.terraform.io/hashicorp/aws v3.54.0\r\n$ terraform -chdir=../.. init\r\n(...)\r\n$ terraform -chdir=../.. plan -var 'enable_dhcp_options=true' -var 'cidr=172.16.0.0/20'\r\nprovider.aws.region\r\n The region where AWS operations will take place. Examples\r\n are us-east-1, us-west-2, etc.\r\n\r\n Enter a value: us-west-2\r\n(...)\r\n # aws_vpc_dhcp_options.this[0] will be created\r\n + resource \"aws_vpc_dhcp_options\" \"this\" {\r\n + arn = (known after apply)\r\n + domain_name_servers = [\r\n + \"AmazonProvidedDNS\",\r\n ]\r\n + id = (known after apply)\r\n + netbios_name_servers = []\r\n + ntp_servers = [\r\n + \"169.254.169.123\",\r\n ]\r\n + owner_id = (known after apply)\r\n + tags = {\r\n + \"Name\" = \"\"\r\n }\r\n + tags_all = {\r\n + \"Name\" = (known after apply)\r\n }\r\n }\r\n(...)\r\n$ \r\n```\n\n---\n\nChoice A:\nvariables.tf\n@@ -623,9 +623,9 @@ variable \"dhcp_options_domain_name_servers\" {\n }\n \n variable \"dhcp_options_ntp_servers\" {\n- description = \"Specify a list of NTP servers for DHCP options set (requires enable_dhcp_options for to true)\"\n+ description = \"Specify a list of NTP server addresses for DHCP options set, default to AWS provided (requires enable_dhcp_options set to true)\"\n type = list(string)\n- default = []\n+ default = [\"169.254.169.123\"]\n }\n \n variable \"dhcp_options_netbios_name_servers\" {\n---\n\n\n---\n\nChoice B:\nvariables.tf\n@@ -623,9 +623,9 @@ variable \"dhcp_options_domain_name_servers\" {\n }\n \n variable \"dhcp_options_ntp_servers\" {\n- description = \"Specify a list of NTP servers for DHCP options set (requires enable_dhcp_options set to set description = \"Specify a list of NTP server addresses for DHCP options set, default to AWS provided (requires enable_dhcp_options set to true)\"\n type = list(string)\n- default = []\n+ default = [\"169.254.169.123\"]\n }\n \n variable \"dhcp_options_netbios_name_servers\" {\n---\n\n\n---\n\nChoice C:\nvariables.tf\n@@ -623,9 +623,9 @@ variable \"dhcp_options_domain_name_servers\" {\n }\n \n variable \"dhcp_options_ntp_servers\" {\n- description = \"Specify a list of NTP servers for DHCP options set (requires enable_dhcp_options set to true)\"\n+ description = \"Specify a list of NTP server addresses for DHCP options set, default to AWS provided (requires enable_dhcp_options set to true)\"\n type = list(string)\n- default = = default = [\"169.254.169.123\"]\n }\n \n variable \"dhcp_options_netbios_name_servers\" {\n---\n\n\n---\n\nChoice D:\nvariables.tf\n@@ -623,9 +623,9 @@ variable \"dhcp_options_domain_name_servers\" {\n }\n \n variable \"dhcp_options_ntp_servers\" {\n- description = \"Specify a list of NTP servers for DHCP options set (requires enable_dhcp_options set to true)\"\n+ description = \"Specify a list of NTP server addresses for DHCP options set, default to AWS provided (requires enable_dhcp_options set to true)\"\n type = list(string)\n- default = []\n+ default = [\"169.254.169.123\"]\n }\n \n variable \"dhcp_options_netbios_name_servers\" {\n---\n\n\n---\n" } ]
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\nFixes #679 \r\n\r\nUpdates the minimum terraform version to 0.12.31 to support the new HashiCorp Signatures\r\n\r\n## Motivation and Context\r\nTerraform versions before 0.12.31 only support the AWS Provider version up to 3.37.0 because the GPG key used to create the signatures was changed at this point.\r\n\r\n## Breaking Changes\r\nNone. This change only increments the terraform version to the latest minor version of the same release version.\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\n- Verified that for each of the examples fails init when the module's aws provider version is set to 3.38 and the terraform version is 0.12.26\r\n- Verified that it inits as expected when the terraform version is set to 0.12.31.\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -188,7 +188,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/ipv6/README.md\n@@ -19,7 +19,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/ipv6/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/issues/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/issues/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/manage-default-vpc/README.md\n@@ -21,7 +21,7 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/network-acls/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/network-acls/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/outpost/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which -1,5 cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/outpost/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/simple-vpc/README.md\n@@ -25,7 +25,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/simple-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n | <a name=\"requirement_random\"></a> [random](#requirement\\_random) | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nmodules/vpc-endpoints/README.md\n@@ -55,7 +55,7 @@ module \"endpoints\" {\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nmodules/vpc-endpoints/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nversions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -188,7 +188,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/ipv6/README.md\n@@ -19,7 +19,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/ipv6/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/issues/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/issues/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/manage-default-vpc/README.md\n@@ -21,7 +21,7 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/network-acls/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/network-acls/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/outpost/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/outpost/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/simple-vpc/README.md\n@@ -25,7 +25,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/simple-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n | <a name=\"requirement_random\"></a> [random](#requirement\\_random) | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nmodules/vpc-endpoints/README.md\n@@ -55,7 +55,7 @@ module \"endpoints\" {\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nmodules/vpc-endpoints/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nversions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -188,7 +188,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/ipv6/README.md\n@@ -19,7 +19,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/ipv6/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = destroy` -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/issues/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/manage-default-vpc/README.md\n@@ -21,7 +21,7 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/network-acls/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/network-acls/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/outpost/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/outpost/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/simple-vpc/README.md\n@@ -25,7 +25,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/simple-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n | <a name=\"requirement_random\"></a> [random](#requirement\\_random) | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nmodules/vpc-endpoints/README.md\n@@ -55,7 +55,7 @@ module \"endpoints\" {\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nmodules/vpc-endpoints/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nversions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -188,7 +188,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/complete-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n 0.12.31 aws = {\n---\nexamples/ipv6/README.md\n@@ -19,7 +19,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/ipv6/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/issues/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/issues/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/manage-default-vpc/README.md\n@@ -21,7 +21,7 @@ Run `terraform destroy` when you don't need these resources.\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/manage-default-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/network-acls/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/network-acls/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/outpost/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/outpost/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/simple-vpc/README.md\n@@ -25,7 +25,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/simple-vpc/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n | <a name=\"requirement_random\"></a> [random](#requirement\\_random) | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nexamples/vpc-separate-private-route-tables/README.md\n@@ -21,7 +21,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nexamples/vpc-separate-private-route-tables/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nmodules/vpc-endpoints/README.md\n@@ -55,7 +55,7 @@ module \"endpoints\" {\n \n | Name | Version |\n |------|---------|\n-| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.26 |\n+| <a name=\"requirement_terraform\"></a> [terraform](#requirement\\_terraform) | >= 0.12.31 |\n | <a name=\"requirement_aws\"></a> [aws](#requirement\\_aws) | >= 3.15 |\n \n ## Providers\n---\nmodules/vpc-endpoints/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\nversions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.26\"\n+ required_version = \">= 0.12.31\"\n \n required_providers {\n aws = {\n---\n\n\n---\n" } ]
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\nUpdating vpc S3 enpoint\r\n\r\n## Motivation and Context\r\nbreaking in s3 service type for name change\r\n\r\n## Breaking Changes\r\ndoes not break changes\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\ncreated new tag and tested in local environment and works\r\nran tf init, plan and tested ok\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", ? \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -1,17 +1,23 @@\n ######################\n # VPC Endpoint for S3\n ######################\n-data \"aws_vpc_endpoint_service\" \"s3\" {\n- count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n-\n- service = \"s3\"\n-}\n+#data \"aws_vpc_endpoint_service\" \"s3\" {\n+# count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n+#\n+# service = \"s3\"\n+# filter {\n+# name = \"tag-type\"\n+# values = [\"gateway\"]\n+# }\n+#}\n+data \"aws_region\" \"current\" {}\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ #service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.s3\"\n tags = local.vpce_tags\n }\n \n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -1,17 +1,23 @@\n ######################\n # VPC Endpoint for S3\n ######################\n-data \"aws_vpc_endpoint_service\" \"s3\" {\n- count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n-\n- service = \"s3\"\n-}\n+#data \"aws_vpc_endpoint_service\" \"s3\" {\n+# count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n+#\n+# service = \"s3\"\n+# filter {\n+# name = \"tag-type\"\n+# values = [\"gateway\"]\n+# }\n+#}\n+data \"aws_region\" \"current\" {}\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ #service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.s3\"\n tags = local.vpce_tags\n }\n \n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets [\"10.10.11.0/24\", [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -1,17 +1,23 @@\n ######################\n # VPC Endpoint for S3\n ######################\n-data \"aws_vpc_endpoint_service\" \"s3\" {\n- count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n-\n- service = \"s3\"\n-}\n+#data \"aws_vpc_endpoint_service\" \"s3\" {\n+# count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n+#\n+# service = \"s3\"\n+# filter {\n+# name = \"tag-type\"\n+# values = [\"gateway\"]\n+# }\n+#}\n+data \"aws_region\" \"current\" {}\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ #service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.s3\"\n tags = local.vpce_tags\n }\n \n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -1,17 +1,23 @@\n ######################\n # VPC Endpoint for S3\n ######################\n-data \"aws_vpc_endpoint_service\" \"s3\" {\n- count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n-\n- service = \"s3\"\n-}\n+#data \"aws_vpc_endpoint_service\" \"s3\" {\n+# count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n+#\n+# service = \"s3\"\n+# filter {\n+# name = \"tag-type\"\n+# values = [\"gateway\"]\n+# }\n+#}\n+data \"aws_region\" \"current\" {}\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ #service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.s3\"\n tags = local.vpce_tags\n \n---\n\n\n---\n" } ]
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- Replace `aws:SourceVpce` conditions\r\n- Remove `aws_vpc_endpoint_service` data objects\r\n\r\n## Description\r\nFix Complete VPC example code by removing several incorrect examples.\r\n\r\n## Motivation and Context\r\n- Firstly, it makes no sense to use `aws:SourceVpce` in a VPC endpoint IAM policy; all traffic that the VPC endpoint will receive will always have its own id here. You can read more about this key [here](https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-ddb.html) under the section titled \"Use IAM policies to control access to DynamoDB\", in which the document states (emphasis mine):\r\n\r\n\"You can create an IAM policy for your **IAM users, groups, or roles** to restrict access to DynamoDB tables from a specific VPC endpoint only. To do this, you can use the aws:sourceVpce condition key for the table resource in your IAM policy.\"\r\n\r\n- Secondly, at some point there was a change from the data `aws_vpc_endpoint` to `aws_vpc_endpoint_service`. It's important to note this because previously the code used `data.aws_vpc_endpoint.dynamodb.id` which does exist and provides an id like `vpce-12345` but was later replaced by `data.aws_vpc_endpoint_service.dynamodb.id`. You can see [here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc_endpoint_service) that `id` is not a valid attribute and the output of this data type was a numerical id like `1234` that seemed to have no bearing to vpc, vpc endpoint or any other active resource.\r\n\r\nThe changes I've made continue to provide a policy for an example case, but the example now provides a somewhat more sensible value. In the new example code, the deny rule is set to reject any users who are outside of the current account.\r\n\r\n## Breaking Changes\r\nThis does not break any module code as it only affects an example\r\n\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\nI had to extensively debug why the example wasn't working and have cited all of my documentation.\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -182,16 +182,8 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n- service = \"dynamodb\"\n-\n- filter {\n- name = \"service-type\"\n- values = [\"Gateway\"]\n- }\n-}\n-\n+data \"aws_caller_identity\" \"current\" {}\n+ \n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -205,9 +197,9 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = [data.aws_vpc_endpoint_service.dynamodb.id]\n+ values = }\n }\n }\n@@ -225,9 +217,9 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = [data.aws_vpc_endpoint_service.dynamodb.id]\n+ values = [data.aws_caller_identity.current.account_id]\n }\n }\n }\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -182,16 +182,8 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n- service = \"dynamodb\"\n-\n- filter {\n- name = \"service-type\"\n- values = [\"Gateway\"]\n- }\n-}\n-\n+data \"aws_caller_identity\" \"current\" {}\n+ \n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -205,9 +197,9 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = [data.aws_vpc_endpoint_service.dynamodb.id]\n+ values = [data.aws_caller_identity.current.account_id]\n }\n }\n }\n@@ -225,9 +217,9 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = [data.aws_vpc_endpoint_service.dynamodb.id]\n+ \"aws_iam_policy_document\" = [data.aws_caller_identity.current.account_id]\n }\n }\n }\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -182,16 +182,8 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n- service = \"dynamodb\"\n-\n- filter {\n- name = \"service-type\"\n- values = [\"Gateway\"]\n- }\n-}\n-\n+data \"aws_caller_identity\" \"current\" {}\n+ \n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -205,9 +197,9 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = [data.aws_vpc_endpoint_service.dynamodb.id]\n+ values = [data.aws_caller_identity.current.account_id]\n }\n }\n }\n@@ -225,9 +217,9 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = [data.aws_vpc_endpoint_service.dynamodb.id]\n+ values = [data.aws_caller_identity.current.account_id]\n }\n }\n }\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -182,16 +182,8 @@ data \"aws_security_group\" \"default\" {\n vpc_id = module.vpc.vpc_id\n }\n \n-# Data source used to avoid race condition\n-data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n- service = \"dynamodb\"\n-\n- filter {\n- name = \"service-type\"\n- values = [\"Gateway\"]\n- }\n-}\n-\n+data \"aws_caller_identity\" \"current\" {}\n+ \n data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n statement {\n effect = \"Deny\"\n@@ -205,9 +197,9 @@ data \"aws_iam_policy_document\" \"dynamodb_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = [data.aws_vpc_endpoint_service.dynamodb.id]\n+ values = [data.aws_caller_identity.current.account_id]\n }\n }\n }\n@@ -225,9 +217,9 @@ data \"aws_iam_policy_document\" \"generic_endpoint_policy\" {\n \n condition {\n test = \"StringNotEquals\"\n- variable = \"aws:sourceVpce\"\n+ variable = \"aws:PrincipalAccount\"\n \n- values = \"aws_security_group\" values = [data.aws_caller_identity.current.account_id]\n }\n }\n }\n---\n\n\n---\n" } ]
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\nMany Cloudrail users are running into this:\r\n```\r\nRule: Ensure IAM policies pass Access Analyzer policy validation without WARNING and SUGGESTION issues\r\n - 1 Resources Exposed:\r\n-----------------------------------------------\r\n - Exposed Resource: [module.vpc.aws_iam_role.vpc_flow_log_cloudwatch[0]] (../../vpc-flow-logs.tf:44)\r\n Violating Resource: [module.vpc.aws_iam_role.vpc_flow_log_cloudwatch[0]] (../../vpc-flow-logs.tf:44)\r\n\r\n Evidence:\r\n Line 5, Col 13:\r\n | Add a value to the empty string in the Sid element\r\n | See https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-reference-policy-checks.html#access-analyzer-reference-policy-checks-suggestion-empty-sid-value\r\n```\r\n\r\nSimply because there's no SID in the assume policy and it violates AWS best practices.\r\n\r\n## Motivation and Context\r\nTo avoid a Cloudrail violation for users of the vpc module.\r\n\r\n## Breaking Changes\r\nThis updates the assume role policy. It doesn't break backwards compatibility but will introduce an update in user environments that have this module deployed.\r\n\r\n```\r\nTerraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:\r\n ~ update in-place\r\n\r\nTerraform will perform the following actions:\r\n\r\n # module.vpc.aws_iam_role.vpc_flow_log_cloudwatch[0] will be updated in-place\r\n ~ resource \"aws_iam_role\" \"vpc_flow_log_cloudwatch\" {\r\n ~ assume_role_policy = jsonencode(\r\n ~ {\r\n ~ Statement = [\r\n ~ {\r\n ~ Sid = \"\" -> \"AWSVPCFlowLogsAssumeRole\"\r\n # (3 unchanged elements hidden)\r\n },\r\n ]\r\n # (1 unchanged element hidden)\r\n }\r\n )\r\n id = \"vpc-flow-log-role-20210729162754416900000002\"\r\n name = \"vpc-flow-log-role-20210729162754416900000002\"\r\n tags = {\r\n \"Environment\" = \"staging\"\r\n \"Name\" = \"complete\"\r\n \"Owner\" = \"user\"\r\n }\r\n # (9 unchanged attributes hidden)\r\n\r\n # (1 unchanged block hidden)\r\n }\r\n\r\nPlan: 0 to add, 1 to change, 0 to destroy.\r\n\r\n```\r\n\r\n## How Has This Been Tested?\r\nI have tested it using the complete-vpc example. Started with planning and applying as the code is today (and checked that Cloudrail triggers the above violation on the plan). Then I fixed the code, planned again, verified with Cloudrail, and applied (to see the change doesn't break existing deployments).\r\n\r\n\n\n---\n\nChoice A:\n\"AWSVPCFlowLogsAssumeRole\"\n+\n -55,6 +55,8 @@ data \"aws_iam_policy_document\" \"flow_log_cloudwatch_assume_role\" {\n count = local.create_flow_log_cloudwatch_iam_role ? 1 : 0\n \n statement {\n+ sid = \"AWSVPCFlowLogsAssumeRole\"\n+\n principals {\n type = \"Service\"\n identifiers = [\"vpc-flow-logs.amazonaws.com\"]\n---\n\n\n---\n\nChoice B:\nvpc-flow-logs.tf\n@@ -55,6 +55,8 @@ data \"aws_iam_policy_document\" \"flow_log_cloudwatch_assume_role\" {\n {\n count = local.create_flow_log_cloudwatch_iam_role ? 1 : 0\n \n statement {\n+ sid = \"AWSVPCFlowLogsAssumeRole\"\n+\n principals {\n type = \"Service\"\n identifiers = [\"vpc-flow-logs.amazonaws.com\"]\n---\n\n\n---\n\nChoice C:\nvpc-flow-logs.tf\n@@ -55,6 +55,8 @@ data \"aws_iam_policy_document\" \"flow_log_cloudwatch_assume_role\" {\n count = local.create_flow_log_cloudwatch_iam_role ? 1 : 0\n \n statement {\n+ sid = \"AWSVPCFlowLogsAssumeRole\"\n+\n principals {\n type = \"Service\"\n identifiers = [\"vpc-flow-logs.amazonaws.com\"]\n---\n\n\n---\n\nChoice D:\nvpc-flow-logs.tf\n@@ local.create_flow_log_cloudwatch_iam_role +55,8 @@ data \"aws_iam_policy_document\" \"flow_log_cloudwatch_assume_role\" {\n count = local.create_flow_log_cloudwatch_iam_role ? 1 : 0\n \n statement {\n+ sid = \"AWSVPCFlowLogsAssumeRole\"\n+\n principals {\n type = \"Service\"\n identifiers = [\"vpc-flow-logs.amazonaws.com\"]\n---\n\n\n---\n" } ]
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 ID of DHCP options to outputs\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\nWe need it to put in IAM policy which allow to maintain objects which created by this module.\r\n\r\n## Breaking Changes\r\n<!-- Does this break backwards compatibility with the current major version? -->\r\n<!-- If so, please provide an explanation why it is necessary. -->\r\nIt has backwards compatibility to all previous versions of module which has DHCP options object.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -481,6 +481,7 @@ No modules.\n | <a name=\"output_default_vpc_id\"></a> [default\\_vpc\\_id](#output\\_default\\_vpc\\_id) | The ID of the Default VPC |\n | <a name=\"output_default_vpc_instance_tenancy\"></a> [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | <a name=\"output_default_vpc_main_route_table_id\"></a> [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n+| <a name=\"output_dhcp_options_id\"></a> [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n | <a name=\"output_egress_only_internet_gateway_id\"></a> [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n | <a name=\"output_elasticache_network_acl_arn\"></a> [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | <a name=\"output_elasticache_network_acl_id\"></a> [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n---\noutputs.tf\n@@ -333,6 +333,11 @@ output \"public_route_table_association_ids\" {\n value = aws_route_table_association.public.*.id\n }\n \n+output \"dhcp_options_id\" {\n+ description = \"The ID of the DHCP options\"\n+ value = concat(aws_vpc_dhcp_options.this.*.id, [\"\"])[0]\n+}\n+\n output \"nat_ids\" {\n description = \"List of allocation ID of Elastic IPs created for AWS NAT Gateway\"\n value = aws_eip.nat.*.id\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -481,6 +481,7 @@ No modules.\n | <a name=\"output_default_vpc_id\"></a> [default\\_vpc\\_id](#output\\_default\\_vpc\\_id) | The ID of the Default VPC |\n | <a name=\"output_default_vpc_instance_tenancy\"></a> [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | <a name=\"output_default_vpc_main_route_table_id\"></a> [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n+| <a name=\"output_dhcp_options_id\"></a> [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n | <a name=\"output_egress_only_internet_gateway_id\"></a> [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n | <a name=\"output_elasticache_network_acl_arn\"></a> [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | <a name=\"output_elasticache_network_acl_id\"></a> [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n---\noutputs.tf\n@@ -333,6 +333,11 @@ | \"public_route_table_association_ids\" {\n value = aws_route_table_association.public.*.id\n }\n \n+output \"dhcp_options_id\" {\n+ description = \"The ID of the DHCP options\"\n+ value = concat(aws_vpc_dhcp_options.this.*.id, [\"\"])[0]\n+}\n+\n output \"nat_ids\" {\n description = \"List of allocation ID of Elastic IPs created for AWS NAT Gateway\"\n value = aws_eip.nat.*.id\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -481,6 +481,7 @@ No modules.\n | <a name=\"output_default_vpc_id\"></a> [default\\_vpc\\_id](#output\\_default\\_vpc\\_id) | The ID of the Default VPC |\n | <a name=\"output_default_vpc_instance_tenancy\"></a> [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | <a name=\"output_default_vpc_main_route_table_id\"></a> [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n+| <a name=\"output_dhcp_options_id\"></a> [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n | <a name=\"output_egress_only_internet_gateway_id\"></a> [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n | <a name=\"output_elasticache_network_acl_arn\"></a> [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | <a name=\"output_elasticache_network_acl_id\"></a> [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n---\noutputs.tf\n@@ -333,6 +333,11 @@ [default\\_vpc\\_id](#output\\_default\\_vpc\\_id) \"public_route_table_association_ids\" {\n value = aws_route_table_association.public.*.id\n }\n \n+output \"dhcp_options_id\" {\n+ description = \"The ID of the DHCP options\"\n+ value = concat(aws_vpc_dhcp_options.this.*.id, [\"\"])[0]\n+}\n+\n output \"nat_ids\" {\n description = \"List of allocation ID of Elastic IPs created for AWS NAT Gateway\"\n value = aws_eip.nat.*.id\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -481,6 +481,7 @@ No modules.\n | <a name=\"output_default_vpc_id\"></a> [default\\_vpc\\_id](#output\\_default\\_vpc\\_id) | The ID of the Default VPC |\n | <a name=\"output_default_vpc_instance_tenancy\"></a> [default\\_vpc\\_instance\\_tenancy](#output\\_default\\_vpc\\_instance\\_tenancy) | Tenancy of instances spin up within Default VPC |\n | <a name=\"output_default_vpc_main_route_table_id\"></a> [default\\_vpc\\_main\\_route\\_table\\_id](#output\\_default\\_vpc\\_main\\_route\\_table\\_id) | The ID of the main route table associated with the Default VPC |\n+| <a name=\"output_dhcp_options_id\"></a> [dhcp\\_options\\_id](#output\\_dhcp\\_options\\_id) | The ID of the DHCP options |\n | <a name=\"output_egress_only_internet_gateway_id\"></a> [egress\\_only\\_internet\\_gateway\\_id](#output\\_egress\\_only\\_internet\\_gateway\\_id) | The ID of the egress only Internet Gateway |\n | <a name=\"output_elasticache_network_acl_arn\"></a> [elasticache\\_network\\_acl\\_arn](#output\\_elasticache\\_network\\_acl\\_arn) | ARN of the elasticache network ACL |\n | <a name=\"output_elasticache_network_acl_id\"></a> [elasticache\\_network\\_acl\\_id](#output\\_elasticache\\_network\\_acl\\_id) | ID of the elasticache network ACL |\n---\noutputs.tf\n@@ -333,6 +333,11 @@ output \"public_route_table_association_ids\" {\n value = aws_route_table_association.public.*.id\n }\n \n+output \"dhcp_options_id\" {\n+ description = \"The ID of the DHCP options\"\n+ of = concat(aws_vpc_dhcp_options.this.*.id, [\"\"])[0]\n+}\n+\n output \"nat_ids\" {\n description = \"List of allocation ID of Elastic IPs created for AWS NAT Gateway\"\n value = aws_eip.nat.*.id\n---\n\n\n---\n" } ]
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\nFix copy/paste mistake of the outputs in VPC with separate private route tables example\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\nThis still working but maybe misleading \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\nI don't think any of these are breaking changes, just fix copy/paste mistake. No existing properties are being changed.\r\n## How Has This Been Tested?\r\n- [x] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nexamples/vpc-separate-private-route-tables/README.md\n@@ -51,6 +51,6 @@ No inputs.\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_private_subnets\"></a> [private\\_subnets](#output\\_private\\_subnets) | List of IDs of private subnets |\n | <a name=\"output_public_subnets\"></a> [public\\_subnets](#output\\_public\\_subnets) | List of IDs of public subnets |\n-| <a name=\"output_redshift_subnets\"></a> [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of elasticache subnets |\n+| <a name=\"output_redshift_subnets\"></a> [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of redshift subnets |\n | \n---\n name=\"output_vpc_id\"></a> [vpc\\_id](#output\\_vpc\\_id) | The ID of the VPC |\n <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->\n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -26,7 +26,7 @@ output \"elasticache_subnets\" {\n }\n \n output \"redshift_subnets\" {\n- description = \"List of IDs of elasticache subnets\"\n+ description = \"List of IDs of redshift subnets\"\n value = module.vpc.redshift_subnets\n }\n \n---\n\n\n---\n\nChoice B:\nexamples/vpc-separate-private-route-tables/README.md\n@@ -51,6 +51,6 @@ No inputs.\n | <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_private_subnets\"></a> [private\\_subnets](#output\\_private\\_subnets) | List of IDs of private subnets |\n | <a name=\"output_public_subnets\"></a> [public\\_subnets](#output\\_public\\_subnets) | List of IDs of public subnets |\n-| <a name=\"output_redshift_subnets\"></a> [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of elasticache subnets |\n+| <a name=\"output_redshift_subnets\"></a> [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of redshift subnets |\n | <a name=\"output_vpc_id\"></a> [vpc\\_id](#output\\_vpc\\_id) | The ID of the VPC |\n <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->\n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -26,7 +26,7 @@ output \"elasticache_subnets\" {\n }\n \n output \"redshift_subnets\" {\n- description = \"List of IDs of elasticache subnets\"\n+ description = \"List of IDs of redshift subnets\"\n value = module.vpc.redshift_subnets\n }\n \n---\n\n\n---\n\nChoice C:\nexamples/vpc-separate-private-route-tables/README.md\n@@ -51,6 +51,6 @@ No inputs.\n | <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 OF <a name=\"output_private_subnets\"></a> [private\\_subnets](#output\\_private\\_subnets) | List of IDs of private subnets |\n | <a name=\"output_public_subnets\"></a> [public\\_subnets](#output\\_public\\_subnets) | List of IDs of public subnets |\n-| <a name=\"output_redshift_subnets\"></a> [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of elasticache subnets |\n+| <a name=\"output_redshift_subnets\"></a> [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of redshift subnets |\n | <a name=\"output_vpc_id\"></a> [vpc\\_id](#output\\_vpc\\_id) | The ID of the VPC |\n <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->\n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -26,7 +26,7 @@ output \"elasticache_subnets\" {\n }\n \n output \"redshift_subnets\" {\n- description = \"List of IDs of elasticache subnets\"\n+ description = \"List of IDs of redshift subnets\"\n value = module.vpc.redshift_subnets\n }\n \n---\n\n\n---\n\nChoice D:\nexamples/vpc-separate-private-route-tables/README.md\n@@ -51,6 +51,6 @@ No inputs.\n | <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_private_subnets\"></a> [private\\_subnets](#output\\_private\\_subnets) | List of IDs of private subnets |\n | <a name=\"output_public_subnets\"></a> [public\\_subnets](#output\\_public\\_subnets) | List of IDs of public subnets |\n-| <a name=\"output_redshift_subnets\"></a> [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of elasticache subnets |\n+| <a name=\"output_redshift_subnets\"></a> [redshift\\_subnets](#output\\_redshift\\_subnets) | List of IDs of redshift subnets |\n | <a name=\"output_vpc_id\"></a> [vpc\\_id](#output\\_vpc\\_id) | The ID of the VPC |\n <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->\n---\nexamples/vpc-separate-private-route-tables/outputs.tf\n@@ -26,7 +26,7 @@ output \"elasticache_subnets\" {\n }\n \n output \"redshift_subnets\" {\n- description = \"List of IDs of elasticache subnets\"\n+ description = \"List of IDs of redshift subnets\"\n value of = module.vpc.redshift_subnets\n }\n \n---\n\n\n---\n" } ]
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<!---Update VPC Endpoint for S3 -->\r\n\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\nError: multiple VPC Endpoint Services matched; use additional constraints to reduce matches to a single VPC Endpoint Service\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\nNo\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 tested and validated these changes using one or more of the provided `examples/*` projects local project\r\n<!--- Please describe in detail how you tested your changes. -->\r\nUpdated VPC S3 endpoint and tested on local env which completed successfully\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\nPlan: 0 to add, 0 to change, 0 to destroy.\r\n<!--- see how your change affects other areas of the code, etc. -->\r\nNo\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -5,6 +5,10 @@ data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -5,6 +5,10 @@ data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n = -5,6 +5,10 @@ data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -5,6 +5,10 data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n" } ]
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 tested and validated these changes using one or more of the provided `examples/*` projects\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -5,6 +5,10 @@ data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets && [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -5,6 +5,10 @@ data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -5,6 +5,10 @@ data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -15,12 +15,12 @@ module \"vpc\" {\n cidr = \"20.10.0.0/16\" # 10.0.0.0/8 is reserved for EC2-Classic\n \n azs = [\"eu-west-1a\", \"eu-west-1b\", \"eu-west-1c\"]\n- private_subnets = [\"20.10.1.0/24\", \"20.10.2.0/24\", \"20.10.3.0/24\"]\n- public_subnets = [\"20.10.11.0/24\", \"20.10.12.0/24\", \"20.10.13.0/24\"]\n- database_subnets = [\"20.10.21.0/24\", \"20.10.22.0/24\", \"20.10.23.0/24\"]\n- elasticache_subnets = [\"20.10.31.0/24\", \"20.10.32.0/24\", \"20.10.33.0/24\"]\n- redshift_subnets = [\"20.10.41.0/24\", \"20.10.42.0/24\", \"20.10.43.0/24\"]\n- intra_subnets = [\"20.10.51.0/24\", \"20.10.52.0/24\", \"20.10.53.0/24\"]\n+ private_subnets = [\"10.10.1.0/24\", \"10.10.2.0/24\", \"10.10.3.0/24\"]\n+ public_subnets = [\"10.10.11.0/24\", \"10.10.12.0/24\", \"10.10.13.0/24\"]\n+ database_subnets = [\"10.10.21.0/24\", \"10.10.22.0/24\", \"10.10.23.0/24\"]\n+ elasticache_subnets = [\"10.10.31.0/24\", \"10.10.32.0/24\", \"10.10.33.0/24\"]\n+ redshift_subnets = [\"10.40.41.0/24\", \"10.40.42.0/24\", \"10.40.43.0/24\"]\n+ intra_subnets = [\"10.10.51.0/24\", \"10.10.52.0/24\", \"10.10.53.0/24\"]\n \n create_database_subnet_group = false\n \n---\nvpc-endpoints.tf\n@@ -5,6 +5,10 @@ data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [\"Gateway\"]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n" } ]
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:\nFixed #654 \n\n---\n\nChoice A:\nREADME.md\n@@ -312,6 +312,7 @@ No modules.\n | <a name=\"input_database_outbound_acl_rules\"></a> [database\\_outbound\\_acl\\_rules](#input\\_database\\_outbound\\_acl\\_rules) | Database subnets outbound network ACL rules | `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_database_route_table_tags\"></a> [database\\_route\\_table\\_tags](#input\\_database\\_route\\_table\\_tags) | Additional tags for the database route tables | `map(string)` | `{}` | no |\n | <a name=\"input_database_subnet_assign_ipv6_address_on_creation\"></a> [database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on database subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| <a name=\"input_database_subnet_group_name\"></a> [database\\_subnet\\_group\\_name](#input\\_database\\_subnet\\_group\\_name) | Name of database subnet group | `string` | `null` | no |\n | <a name=\"input_database_subnet_group_tags\"></a> [database\\_subnet\\_group\\_tags](#input\\_database\\_subnet\\_group\\_tags) | Additional tags for the database subnet group | `map(string)` | `{}` | no |\n | <a name=\"input_database_subnet_ipv6_prefixes\"></a> [database\\_subnet\\_ipv6\\_prefixes](#input\\_database\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 database subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | <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---\nmain.tf\n@@ -481,13 +481,13 @@ resource \"aws_subnet\" \"database\" {\n resource \"aws_db_subnet_group\" \"database\" {\n count = var.create_vpc && length(var.database_subnets) > 0 && var.create_database_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.database_subnet_group_name, var.name))\n description = \"Database subnet group for ${var.name}\"\n subnet_ids = aws_subnet.database.*.id\n \n tags = merge(\n {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_subnet_group_name, var.name)))\n },\n var.tags,\n var.database_subnet_group_tags,\n---\nvariables.tf\n@@ -478,6 +478,12 @@ variable \"intra_route_table_tags\" {\n default = {}\n }\n \n+variable \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -312,6 +312,7 @@ No modules.\n | <a name=\"input_database_outbound_acl_rules\"></a> [database\\_outbound\\_acl\\_rules](#input\\_database\\_outbound\\_acl\\_rules) | Database subnets outbound network ACL rules | `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_database_route_table_tags\"></a> [database\\_route\\_table\\_tags](#input\\_database\\_route\\_table\\_tags) | Additional tags for the database route tables | `map(string)` | `{}` | no |\n | <a name=\"input_database_subnet_assign_ipv6_address_on_creation\"></a> [database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on database subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| <a name=\"input_database_subnet_group_name\"></a> [database\\_subnet\\_group\\_name](#input\\_database\\_subnet\\_group\\_name) | Name of database subnet group | `string` | `null` | no |\n | <a name=\"input_database_subnet_group_tags\"></a> [database\\_subnet\\_group\\_tags](#input\\_database\\_subnet\\_group\\_tags) | Additional tags for the database subnet group | `map(string)` | `{}` | no |\n | <a name=\"input_database_subnet_ipv6_prefixes\"></a> [database\\_subnet\\_ipv6\\_prefixes](#input\\_database\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 database subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | <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---\nmain.tf\n@@ -481,13 +481,13 @@ resource \"aws_subnet\" \"database\" {\n resource \"aws_db_subnet_group\" \"database\" {\n count = var.create_vpc && length(var.database_subnets) > 0 && var.create_database_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.database_subnet_group_name, var.name))\n description = \"Database subnet group for ${var.name}\"\n subnet_ids = aws_subnet.database.*.id\n \n tags = merge(\n var.create_database_subnet_group {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_subnet_group_name, var.name)))\n },\n var.tags,\n var.database_subnet_group_tags,\n---\nvariables.tf\n@@ -478,6 +478,12 @@ variable \"intra_route_table_tags\" {\n default = {}\n }\n \n+variable \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -312,6 +312,7 @@ No modules.\n | <a name=\"input_database_outbound_acl_rules\"></a> [database\\_outbound\\_acl\\_rules](#input\\_database\\_outbound\\_acl\\_rules) | Database subnets outbound network ACL rules | `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_database_route_table_tags\"></a> [database\\_route\\_table\\_tags](#input\\_database\\_route\\_table\\_tags) | Additional tags for the database route tables | `map(string)` | `{}` | no |\n | <a name=\"input_database_subnet_assign_ipv6_address_on_creation\"></a> [database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on database subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| <a name=\"input_database_subnet_group_name\"></a> [database\\_subnet\\_group\\_name](#input\\_database\\_subnet\\_group\\_name) | Name of database subnet group | `string` | `null` | no |\n | <a name=\"input_database_subnet_group_tags\"></a> [database\\_subnet\\_group\\_tags](#input\\_database\\_subnet\\_group\\_tags) | Additional tags for the database subnet group | `map(string)` | `{}` | no |\n | <a name=\"input_database_subnet_ipv6_prefixes\"></a> [database\\_subnet\\_ipv6\\_prefixes](#input\\_database\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 database subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | <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---\nmain.tf\n@@ -481,13 +481,13 @@ resource \"aws_subnet\" \"database\" {\n resource \"aws_db_subnet_group\" \"database\" {\n count = var.create_vpc && length(var.database_subnets) > 0 && var.create_database_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.database_subnet_group_name, var.name))\n description = \"Database subnet group for ${var.name}\"\n subnet_ids = aws_subnet.database.*.id\n \n tags = merge(\n {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_subnet_group_name, var.name)))\n },\n var.tags,\n var.database_subnet_group_tags,\n---\nvariables.tf\n@@ -478,6 +478,12 @@ variable \"intra_route_table_tags\" {\n \n default = {}\n }\n \n+variable \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -312,6 +312,7 @@ No modules.\n | <a name=\"input_database_outbound_acl_rules\"></a> [database\\_outbound\\_acl\\_rules](#input\\_database\\_outbound\\_acl\\_rules) | Database subnets outbound network ACL rules | `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_database_route_table_tags\"></a> [database\\_route\\_table\\_tags](#input\\_database\\_route\\_table\\_tags) | Additional tags for the database route tables | `map(string)` | `{}` | no |\n | <a name=\"input_database_subnet_assign_ipv6_address_on_creation\"></a> [database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation](#input\\_database\\_subnet\\_assign\\_ipv6\\_address\\_on\\_creation) | Assign IPv6 address on database subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map\\_public\\_ip\\_on\\_launch | `bool` | `null` | no |\n+| <a name=\"input_database_subnet_group_name\"></a> [database\\_subnet\\_group\\_name](#input\\_database\\_subnet\\_group\\_name) | Name of database subnet group | `string` | `null` | no |\n | <a name=\"input_database_subnet_group_tags\"></a> [database\\_subnet\\_group\\_tags](#input\\_database\\_subnet\\_group\\_tags) | Additional tags for the database subnet group | `map(string)` | `{}` | no |\n | <a name=\"input_database_subnet_ipv6_prefixes\"></a> [database\\_subnet\\_ipv6\\_prefixes](#input\\_database\\_subnet\\_ipv6\\_prefixes) | Assigns IPv6 database subnet id based on the Amazon provided /56 prefix base 10 integer (0-256). Must be of equal length to the corresponding IPv4 subnet list | `list(string)` | `[]` | no |\n | <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---\nmain.tf\n@@ -481,13 +481,13 @@ resource \"aws_subnet\" \"database\" {\n resource \"aws_db_subnet_group\" \"database\" {\n count = var.create_vpc && length(var.database_subnets) > 0 && var.create_database_subnet_group ? 1 : 0\n \n- name = lower(var.name)\n+ name = lower(coalesce(var.database_subnet_group_name, var.name))\n description = \"Database subnet group for ${var.name}\"\n subnet_ids = aws_subnet.database.*.id\n \n tags = merge(\n {\n- \"Name\" = format(\"%s\", var.name)\n+ \"Name\" = format(\"%s\", lower(coalesce(var.database_subnet_group_name, var.name)))\n },\n var.tags,\n var.database_subnet_group_tags,\n---\nvariables.tf\n@@ -478,6 +478,12 @@ variable \"intra_route_table_tags\" {\n default subnet = {}\n }\n \n+variable \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ type = string\n+ default = null\n+}\n+\n variable \"database_subnet_tags\" {\n description = \"Additional tags for the database subnets\"\n type = map(string)\n---\n\n\n---\n" } ]
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:\nPrivate DNS is not a valid setting for the S3 interface endpoint.\r\n\r\n## Description\r\nUpdating documentation.\r\n\r\n## Motivation and Context\r\nThe documentation for this module is invalid.\r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\nHave tried to run the code as provided in the documentation and it will not work.\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n tags = },\n Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n service tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n" } ]
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:\nBased on the output of:\r\n\r\n```sh\r\n aws ec2 describe-vpc-endpoint-services --region us-east-1\r\n```\r\n\r\nServices names are using different naming convention, they use URL like naming with region included.\r\n\r\nHope that helps! \n\n---\n\nChoice A:\nmodules/vpc-endpoints/README.md\n@@ -7,6 +7,8 @@ Terraform sub-module which creates VPC endpoint resources on AWS.\n See [`examples`](../../examples) directory for working examples to reference:\n \n ```hcl\n+data \"aws_region\" \"current\" {}\n+\n module \"endpoints\" {\n source = \"terraform-aws-modules/vpc/aws//modules/vpc-endpoints\"\n \n@@ -22,17 +24,18 @@ module \"endpoints\" {\n },\n dynamodb = {\n # gateway endpoint\n- service = \"dynamodb\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sns\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n- service = \"sqs\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sqs\"\n private_dns_enabled = true\n security_group_ids = [\"sg-987654321\"]\n subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/README.md\n@@ -7,6 +7,8 @@ Terraform sub-module which creates VPC endpoint resources on AWS.\n See [`examples`](../../examples) directory for working examples to reference:\n \n ```hcl\n+data \"aws_region\" \"current\" {}\n+\n module \"endpoints\" {\n source = \"terraform-aws-modules/vpc/aws//modules/vpc-endpoints\"\n \n@@ -22,17 +24,18 @@ module \"endpoints\" {\n },\n dynamodb = {\n # gateway endpoint\n- service = \"dynamodb\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sns\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n- service = \"sqs\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sqs\"\n private_dns_enabled = true\n security_group_ids = [\"sg-987654321\"]\n subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/README.md\n@@ -7,6 +7,8 @@ Terraform sub-module which creates VPC endpoint resources on AWS.\n See [`examples`](../../examples) directory for working examples to reference:\n \n ```hcl\n+data \"aws_region\" \"current\" {}\n+\n module \"endpoints\" {\n source = \"terraform-aws-modules/vpc/aws//modules/vpc-endpoints\"\n \n@@ -22,17 +24,18 @@ module \"endpoints\" {\n },\n dynamodb = {\n # gateway endpoint\n- service = \"dynamodb\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.dynamodb\"\n+ service_type \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sns\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n- service = \"sqs\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sqs\"\n private_dns_enabled = true\n security_group_ids = [\"sg-987654321\"]\n subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/README.md\n@@ -7,6 +7,8 @@ Terraform sub-module which creates VPC endpoint resources on AWS.\n See [`examples`](../../examples) directory for working examples to reference:\n \n ```hcl\n+data \"aws_region\" \"current\" {}\n+\n module \"endpoints\" {\n source = \"terraform-aws-modules/vpc/aws//modules/vpc-endpoints\"\n \n@@ -22,17 +24,18 @@ module \"endpoints\" {\n },\n dynamodb = {\n # gateway endpoint\n- service = \"dynamodb\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.dynamodb\"\n+ service_type = \"Gateway\"\n route_table_ids = [\"rt-12322456\", \"rt-43433343\", \"rt-11223344\"]\n dynamodb tags = { Name = \"dynamodb-vpc-endpoint\" }\n },\n sns = {\n- service = \"sns\"\n- subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n- tags = { Name = \"sns-vpc-endpoint\" }\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sns\"\n+ subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n+ tags = { Name = \"sns-vpc-endpoint\" }\n },\n sqs = {\n- service = \"sqs\"\n+ service_name = \"com.amazonaws.${data.aws_region.current.name}.sqs\"\n private_dns_enabled = true\n security_group_ids = [\"sg-987654321\"]\n subnet_ids = [\"subnet-12345678\", \"subnet-87654321\"]\n---\n\n\n---\n" } ]
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- update README of sub-module `vpc-endpoints`.\r\n\r\n## Motivation and Context\r\n- `private_dns_enabled` cannot be specified for S3 endpoint.\r\n\r\n## Breaking Changes\r\n- no\r\n\r\n## How Has This Been Tested?\r\n- README change only.\r\n\n\n---\n\nChoice A:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n tags = { = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice B:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice C:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n\nChoice D:\nmodules/vpc-endpoints/README.md\n@@ -17,7 +17,6 @@ module \"endpoints\" {\n s3 = {\n # interface endpoint\n service = \"s3\"\n- private_dns_enabled = true\n tags = { Name = \"s3-vpc-endpoint\" }\n },\n dynamodb = {\n---\n\n\n---\n" } ]
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 output for `dns_entry` of S3 endpoint.\r\n\r\n## Motivation and Context\r\nI was missing the output for my use case.\r\n\r\n## Breaking Changes\r\nI have not found anything broken. It is a simple addition in outputs, it **should** not break anything.\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n- [X] I have tested the change against my own VPC. The output is correctly shown as shown below (details omitted), and I can use it in other resources in my Terragrunt code, as a dependency.\r\n\r\n```\r\nvpc_endpoint_s3_dns_entry = [\r\n {\r\n \"dns_name\" = \"*.vpce-XXX-YYY.s3.eu-west-1.vpce.amazonaws.com\"\r\n \"hosted_zone_id\" = \"ZZZ\"\r\n },\r\n {\r\n \"dns_name\" = \"*.vpce-XXX-YYY-eu-west-1b.s3.eu-west-1.vpce.amazonaws.com\"\r\n \"hosted_zone_id\" = \"ZZZ\"\r\n },\r\n {\r\n \"dns_name\" = \"*.vpce-XXX-YYY-eu-west-1a.s3.eu-west-1.vpce.amazonaws.com\"\r\n \"hosted_zone_id\" = \"ZZZ\"\r\n },\r\n {\r\n \"dns_name\" = \"*.vpce-XXX-YYY-eu-west-1c.s3.eu-west-1.vpce.amazonaws.com\"\r\n \"hosted_zone_id\" = \"ZZZ\"\r\n },\r\n]\r\n```\r\n\r\nThank you.\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -1182,6 +1182,7 @@ No modules.\n | <a name=\"output_vpc_endpoint_rekognition_dns_entry\"></a> [vpc\\_endpoint\\_rekognition\\_dns\\_entry](#output\\_vpc\\_endpoint\\_rekognition\\_dns\\_entry) | The DNS entries for the VPC Endpoint for Rekognition. |\n | <a name=\"output_vpc_endpoint_rekognition_id\"></a> [vpc\\_endpoint\\_rekognition\\_id](#output\\_vpc\\_endpoint\\_rekognition\\_id) | The ID of VPC endpoint for Rekognition |\n | <a name=\"output_vpc_endpoint_rekognition_network_interface_ids\"></a> [vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids](#output\\_vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids) | One or more network interfaces for the VPC Endpoint for Rekognition. |\n+| <a name=\"output_vpc_endpoint_s3_dns_entry\"></a> [vpc\\_endpoint\\_s3\\_dns\\_entry](#output\\_vpc\\_endpoint\\_s3\\_dns\\_entry) | The DNS entries for the VPC endpoint for S3. |\n | <a name=\"output_vpc_endpoint_s3_id\"></a> [vpc\\_endpoint\\_s3\\_id](#output\\_vpc\\_endpoint\\_s3\\_id) | The ID of VPC endpoint for S3 |\n | <a name=\"output_vpc_endpoint_s3_pl_id\"></a> [vpc\\_endpoint\\_s3\\_pl\\_id](#output\\_vpc\\_endpoint\\_s3\\_pl\\_id) | The prefix list for the S3 VPC endpoint. |\n | <a name=\"output_vpc_endpoint_sagemaker_api_dns_entry\"></a> [vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry](#output\\_vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry) | The DNS entries for the VPC Endpoint for SageMaker API. |\n---\noutputs.tf\n@@ -523,6 +523,11 @@ output \"vpc_endpoint_s3_pl_id\" {\n value = concat(aws_vpc_endpoint.s3.*.prefix_list_id, [\"\"])[0]\n }\n \n+output \"vpc_endpoint_s3_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for S3.\"\n+ value = flatten(aws_vpc_endpoint.s3.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_dynamodb_id\" {\n description = \"The ID of VPC endpoint for DynamoDB\"\n for = concat(aws_vpc_endpoint.dynamodb.*.id, [\"\"])[0]\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -1182,6 +1182,7 @@ No modules.\n | <a name=\"output_vpc_endpoint_rekognition_dns_entry\"></a> [vpc\\_endpoint\\_rekognition\\_dns\\_entry](#output\\_vpc\\_endpoint\\_rekognition\\_dns\\_entry) | The DNS entries for the VPC Endpoint for Rekognition. |\n | <a name=\"output_vpc_endpoint_rekognition_id\"></a> [vpc\\_endpoint\\_rekognition\\_id](#output\\_vpc\\_endpoint\\_rekognition\\_id) | The ID of VPC endpoint for Rekognition |\n | <a name=\"output_vpc_endpoint_rekognition_network_interface_ids\"></a> [vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids](#output\\_vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids) | One or more network interfaces for the VPC Endpoint for Rekognition. |\n+| <a name=\"output_vpc_endpoint_s3_dns_entry\"></a> [vpc\\_endpoint\\_s3\\_dns\\_entry](#output\\_vpc\\_endpoint\\_s3\\_dns\\_entry) | The DNS entries for the VPC endpoint for S3. |\n | <a name=\"output_vpc_endpoint_s3_id\"></a> [vpc\\_endpoint\\_s3\\_id](#output\\_vpc\\_endpoint\\_s3\\_id) | The ID of VPC endpoint for S3 |\n | <a name=\"output_vpc_endpoint_s3_pl_id\"></a> [vpc\\_endpoint\\_s3\\_pl\\_id](#output\\_vpc\\_endpoint\\_s3\\_pl\\_id) | The prefix list for the S3 VPC endpoint. |\n | <a name=\"output_vpc_endpoint_sagemaker_api_dns_entry\"></a> [vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry](#output\\_vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry) | The DNS entries for the VPC Endpoint for SageMaker API. |\n---\noutputs.tf\n@@ -523,6 +523,11 @@ output \"vpc_endpoint_s3_pl_id\" {\n value = concat(aws_vpc_endpoint.s3.*.prefix_list_id, [\"\"])[0]\n }\n \n+output \"vpc_endpoint_s3_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for S3.\"\n+ value description = flatten(aws_vpc_endpoint.s3.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_dynamodb_id\" {\n description = \"The ID of VPC endpoint for DynamoDB\"\n value = concat(aws_vpc_endpoint.dynamodb.*.id, [\"\"])[0]\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -1182,6 +1182,7 @@ No modules.\n | <a name=\"output_vpc_endpoint_rekognition_dns_entry\"></a> [vpc\\_endpoint\\_rekognition\\_dns\\_entry](#output\\_vpc\\_endpoint\\_rekognition\\_dns\\_entry) | The DNS entries for the VPC Endpoint for Rekognition. |\n | <a name=\"output_vpc_endpoint_rekognition_id\"></a> [vpc\\_endpoint\\_rekognition\\_id](#output\\_vpc\\_endpoint\\_rekognition\\_id) | The ID of VPC endpoint for Rekognition |\n | <a name=\"output_vpc_endpoint_rekognition_network_interface_ids\"></a> [vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids](#output\\_vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids) | One or more network interfaces for the VPC Endpoint for Rekognition. |\n+| <a name=\"output_vpc_endpoint_s3_dns_entry\"></a> [vpc\\_endpoint\\_s3\\_dns\\_entry](#output\\_vpc\\_endpoint\\_s3\\_dns\\_entry) | The DNS entries for the VPC endpoint for S3. |\n | <a name=\"output_vpc_endpoint_s3_id\"></a> [vpc\\_endpoint\\_s3\\_id](#output\\_vpc\\_endpoint\\_s3\\_id) | The ID of VPC endpoint for S3 |\n | <a name=\"output_vpc_endpoint_s3_pl_id\"></a> [vpc\\_endpoint\\_s3\\_pl\\_id](#output\\_vpc\\_endpoint\\_s3\\_pl\\_id) | The prefix list for the S3 VPC endpoint. |\n | <a name=\"output_vpc_endpoint_sagemaker_api_dns_entry\"></a> [vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry](#output\\_vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry) | The DNS entries for the VPC Endpoint for SageMaker API. |\n---\noutputs.tf\n@@ -523,6 +523,11 @@ output \"vpc_endpoint_s3_pl_id\" {\n value = concat(aws_vpc_endpoint.s3.*.prefix_list_id, [\"\"])[0]\n }\n \n+output \"vpc_endpoint_s3_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for S3.\"\n+ value = flatten(aws_vpc_endpoint.s3.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_dynamodb_id\" {\n description = \"The ID of VPC endpoint for DynamoDB\"\n value = concat(aws_vpc_endpoint.dynamodb.*.id, [\"\"])[0]\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -1182,6 +1182,7 @@ No modules.\n | <a name=\"output_vpc_endpoint_rekognition_dns_entry\"></a> [vpc\\_endpoint\\_rekognition\\_dns\\_entry](#output\\_vpc\\_endpoint\\_rekognition\\_dns\\_entry) | The DNS entries for the VPC Endpoint for Rekognition. |\n | <a name=\"output_vpc_endpoint_rekognition_id\"></a> [vpc\\_endpoint\\_rekognition\\_id](#output\\_vpc\\_endpoint\\_rekognition\\_id) | The ID of VPC endpoint for Rekognition |\n | <a name=\"output_vpc_endpoint_rekognition_network_interface_ids\"></a> [vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids](#output\\_vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids) | One or more network interfaces for the VPC Endpoint for Rekognition. |\n+| <a name=\"output_vpc_endpoint_s3_dns_entry\"></a> [vpc\\_endpoint\\_s3\\_dns\\_entry](#output\\_vpc\\_endpoint\\_s3\\_dns\\_entry) | The DNS entries for the VPC endpoint for S3. |\n | <a name=\"output_vpc_endpoint_s3_id\"></a> [vpc\\_endpoint\\_s3\\_id](#output\\_vpc\\_endpoint\\_s3\\_id) | The ID of VPC endpoint for S3 |\n | <a name=\"output_vpc_endpoint_s3_pl_id\"></a> [vpc\\_endpoint\\_s3\\_pl\\_id](#output\\_vpc\\_endpoint\\_s3\\_pl\\_id) | The prefix list for the S3 VPC endpoint. |\n | <a name=\"output_vpc_endpoint_sagemaker_api_dns_entry\"></a> [vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry](#output\\_vpc\\_endpoint\\_sagemaker\\_api\\_dns\\_entry) | The DNS entries for the VPC Endpoint for SageMaker API. |\n---\noutputs.tf\n@@ -523,6 +523,11 @@ output \"vpc_endpoint_s3_pl_id\" {\n value = concat(aws_vpc_endpoint.s3.*.prefix_list_id, [\"\"])[0]\n }\n \n+output \"vpc_endpoint_s3_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint [vpc\\_endpoint\\_s3\\_pl\\_id](#output\\_vpc\\_endpoint\\_s3\\_pl\\_id) S3.\"\n+ value = flatten(aws_vpc_endpoint.s3.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_dynamodb_id\" {\n description = \"The ID of VPC endpoint for DynamoDB\"\n value = concat(aws_vpc_endpoint.dynamodb.*.id, [\"\"])[0]\n---\n\n\n---\n" } ]
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 the availability of the rds-data api endpoint inside vpc\r\n\r\n## Motivation and Context\r\nI really need rds-data api in my projects\r\n\r\n## Breaking Changes\r\nNo breaking changes\r\n\r\n## How Has This Been Tested?\r\nTested locally\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -363,6 +363,7 @@ No modules.\n | [aws_vpc_endpoint.monitoring](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.qldb_session](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rds](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_vpc_endpoint.rds_data](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rekognition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.s3](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.sagemaker_api](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n@@ -719,6 +720,7 @@ No modules.\n | <a name=\"input_enable_public_s3_endpoint\"></a> [enable\\_public\\_s3\\_endpoint](#input\\_enable\\_public\\_s3\\_endpoint) | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | <a name=\"input_enable_qldb_session_endpoint\"></a> [enable\\_qldb\\_session\\_endpoint](#input\\_enable\\_qldb\\_session\\_endpoint) | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_rds_endpoint\"></a> [enable\\_rds\\_endpoint](#input\\_enable\\_rds\\_endpoint) | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| <a name=\"input_enable_rds_data_endpoint\"></a> [enable\\_rds\\_data\\_endpoint](#input\\_enable\\_rds\\_data\\_endpoint) | Should be true if you want to provision an RDS-DATA endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_rekognition_endpoint\"></a> [enable\\_rekognition\\_endpoint](#input\\_enable\\_rekognition\\_endpoint) | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_s3_endpoint\"></a> [enable\\_s3\\_endpoint](#input\\_enable\\_s3\\_endpoint) | Should be true if you want to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_sagemaker_api_endpoint\"></a> [enable\\_sagemaker\\_api\\_endpoint](#input\\_enable\\_sagemaker\\_api\\_endpoint) | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -845,6 +847,9 @@ No modules.\n | <a name=\"input_rds_endpoint_private_dns_enabled\"></a> [rds\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | <a name=\"input_rds_endpoint_security_group_ids\"></a> [rds\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | <a name=\"input_rds_endpoint_subnet_ids\"></a> [rds\\_endpoint\\_subnet\\_ids](#input\\_rds\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| <a name=\"input_rds_data_endpoint_private_dns_enabled\"></a> [rds\\_data\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_data\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint | `bool` | `false` | no |\n+| <a name=\"input_rds_data_endpoint_security_group_ids\"></a> [rds\\_data\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_data\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint | `list(string)` | `[]` | no |\n+| <a name=\"input_rds_data_endpoint_subnet_ids\"></a> [rds\\_data\\_endpoint\\_subnet\\_ids](#input\\_rds\\_data\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | <a name=\"input_redshift_acl_tags\"></a> [redshift\\_acl\\_tags](#input\\_redshift\\_acl\\_tags) | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` omitted, no |\n | <a name=\"input_redshift_dedicated_network_acl\"></a> [redshift\\_dedicated\\_network\\_acl](#input\\_redshift\\_dedicated\\_network\\_acl) | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | <a name=\"input_redshift_inbound_acl_rules\"></a> [redshift\\_inbound\\_acl\\_rules](#input\\_redshift\\_inbound\\_acl\\_rules) | Redshift subnets inbound network ACL rules | `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---\nvariables.tf\n@@ -2081,6 +2081,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1456,6 +1456,28 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+###########################\n+# VPC Endpoint for RDS-DATA\n+###########################\n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -363,6 +363,7 @@ No modules.\n | [aws_vpc_endpoint.monitoring](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.qldb_session](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rds](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_vpc_endpoint.rds_data](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rekognition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.s3](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.sagemaker_api](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n@@ -719,6 +720,7 @@ No modules.\n | <a name=\"input_enable_public_s3_endpoint\"></a> [enable\\_public\\_s3\\_endpoint](#input\\_enable\\_public\\_s3\\_endpoint) | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | <a name=\"input_enable_qldb_session_endpoint\"></a> [enable\\_qldb\\_session\\_endpoint](#input\\_enable\\_qldb\\_session\\_endpoint) | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_rds_endpoint\"></a> [enable\\_rds\\_endpoint](#input\\_enable\\_rds\\_endpoint) | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| <a name=\"input_enable_rds_data_endpoint\"></a> [enable\\_rds\\_data\\_endpoint](#input\\_enable\\_rds\\_data\\_endpoint) | Should be true if you want to provision an RDS-DATA endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_rekognition_endpoint\"></a> [enable\\_rekognition\\_endpoint](#input\\_enable\\_rekognition\\_endpoint) | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_s3_endpoint\"></a> [enable\\_s3\\_endpoint](#input\\_enable\\_s3\\_endpoint) | Should be true if you in to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_sagemaker_api_endpoint\"></a> [enable\\_sagemaker\\_api\\_endpoint](#input\\_enable\\_sagemaker\\_api\\_endpoint) | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -845,6 +847,9 @@ No modules.\n | <a name=\"input_rds_endpoint_private_dns_enabled\"></a> [rds\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | <a name=\"input_rds_endpoint_security_group_ids\"></a> [rds\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | <a name=\"input_rds_endpoint_subnet_ids\"></a> [rds\\_endpoint\\_subnet\\_ids](#input\\_rds\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| <a name=\"input_rds_data_endpoint_private_dns_enabled\"></a> [rds\\_data\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_data\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint | `bool` | `false` | no |\n+| <a name=\"input_rds_data_endpoint_security_group_ids\"></a> [rds\\_data\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_data\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint | `list(string)` | `[]` | no |\n+| <a name=\"input_rds_data_endpoint_subnet_ids\"></a> [rds\\_data\\_endpoint\\_subnet\\_ids](#input\\_rds\\_data\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | <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 | <a name=\"input_redshift_dedicated_network_acl\"></a> [redshift\\_dedicated\\_network\\_acl](#input\\_redshift\\_dedicated\\_network\\_acl) | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | <a name=\"input_redshift_inbound_acl_rules\"></a> [redshift\\_inbound\\_acl\\_rules](#input\\_redshift\\_inbound\\_acl\\_rules) | Redshift subnets inbound network ACL rules | `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---\nvariables.tf\n@@ -2081,6 +2081,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1456,6 +1456,28 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+###########################\n+# VPC Endpoint for RDS-DATA\n+###########################\n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -363,6 +363,7 @@ No modules.\n | [aws_vpc_endpoint.monitoring](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.qldb_session](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rds](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_vpc_endpoint.rds_data](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rekognition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.s3](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.sagemaker_api](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n@@ -719,6 +720,7 @@ No modules.\n | <a name=\"input_enable_public_s3_endpoint\"></a> [enable\\_public\\_s3\\_endpoint](#input\\_enable\\_public\\_s3\\_endpoint) | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | <a name=\"input_enable_qldb_session_endpoint\"></a> [enable\\_qldb\\_session\\_endpoint](#input\\_enable\\_qldb\\_session\\_endpoint) | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_rds_endpoint\"></a> [enable\\_rds\\_endpoint](#input\\_enable\\_rds\\_endpoint) | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| <a name=\"input_enable_rds_data_endpoint\"></a> [enable\\_rds\\_data\\_endpoint](#input\\_enable\\_rds\\_data\\_endpoint) | Should be true if more want to provision an RDS-DATA endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_rekognition_endpoint\"></a> [enable\\_rekognition\\_endpoint](#input\\_enable\\_rekognition\\_endpoint) | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_s3_endpoint\"></a> [enable\\_s3\\_endpoint](#input\\_enable\\_s3\\_endpoint) | Should be true if you want to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_sagemaker_api_endpoint\"></a> [enable\\_sagemaker\\_api\\_endpoint](#input\\_enable\\_sagemaker\\_api\\_endpoint) | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -845,6 +847,9 @@ No modules.\n | <a name=\"input_rds_endpoint_private_dns_enabled\"></a> [rds\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | <a name=\"input_rds_endpoint_security_group_ids\"></a> [rds\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | <a name=\"input_rds_endpoint_subnet_ids\"></a> [rds\\_endpoint\\_subnet\\_ids](#input\\_rds\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| <a name=\"input_rds_data_endpoint_private_dns_enabled\"></a> [rds\\_data\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_data\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint | `bool` | `false` | no |\n+| <a name=\"input_rds_data_endpoint_security_group_ids\"></a> [rds\\_data\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_data\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint | `list(string)` | `[]` | no |\n+| <a name=\"input_rds_data_endpoint_subnet_ids\"></a> [rds\\_data\\_endpoint\\_subnet\\_ids](#input\\_rds\\_data\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | <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 | <a name=\"input_redshift_dedicated_network_acl\"></a> [redshift\\_dedicated\\_network\\_acl](#input\\_redshift\\_dedicated\\_network\\_acl) | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | <a name=\"input_redshift_inbound_acl_rules\"></a> [redshift\\_inbound\\_acl\\_rules](#input\\_redshift\\_inbound\\_acl\\_rules) | Redshift subnets inbound network ACL rules | `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---\nvariables.tf\n@@ -2081,6 +2081,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1456,6 +1456,28 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+###########################\n+# VPC Endpoint for RDS-DATA\n+###########################\n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -363,6 +363,7 @@ No modules.\n | [aws_vpc_endpoint.monitoring](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.qldb_session](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rds](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n+| [aws_vpc_endpoint.rds_data](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.rekognition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.s3](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n | [aws_vpc_endpoint.sagemaker_api](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |\n@@ -719,6 +720,7 @@ No modules.\n | <a name=\"input_enable_public_s3_endpoint\"></a> [enable\\_public\\_s3\\_endpoint](#input\\_enable\\_public\\_s3\\_endpoint) | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | <a name=\"input_enable_qldb_session_endpoint\"></a> [enable\\_qldb\\_session\\_endpoint](#input\\_enable\\_qldb\\_session\\_endpoint) | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_rds_endpoint\"></a> [enable\\_rds\\_endpoint](#input\\_enable\\_rds\\_endpoint) | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| <a name=\"input_enable_rds_data_endpoint\"></a> [enable\\_rds\\_data\\_endpoint](#input\\_enable\\_rds\\_data\\_endpoint) | Should be true if you want to provision an RDS-DATA endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_rekognition_endpoint\"></a> [enable\\_rekognition\\_endpoint](#input\\_enable\\_rekognition\\_endpoint) | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_s3_endpoint\"></a> [enable\\_s3\\_endpoint](#input\\_enable\\_s3\\_endpoint) | Should be true if you want to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | <a name=\"input_enable_sagemaker_api_endpoint\"></a> [enable\\_sagemaker\\_api\\_endpoint](#input\\_enable\\_sagemaker\\_api\\_endpoint) | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -845,6 +847,9 @@ No modules.\n | <a name=\"input_rds_endpoint_private_dns_enabled\"></a> [rds\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | <a name=\"input_rds_endpoint_security_group_ids\"></a> [rds\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | <a name=\"input_rds_endpoint_subnet_ids\"></a> [rds\\_endpoint\\_subnet\\_ids](#input\\_rds\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| <a name=\"input_rds_data_endpoint_private_dns_enabled\"></a> [rds\\_data\\_endpoint\\_private\\_dns\\_enabled](#input\\_rds\\_data\\_endpoint\\_private\\_dns\\_enabled) | Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint | `bool` | `false` | no |\n+| <a name=\"input_rds_data_endpoint_security_group_ids\"></a> [rds\\_data\\_endpoint\\_security\\_group\\_ids](#input\\_rds\\_data\\_endpoint\\_security\\_group\\_ids) | The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint | `list(string)` | `[]` | no |\n+| <a name=\"input_rds_data_endpoint_subnet_ids\"></a> [rds\\_data\\_endpoint\\_subnet\\_ids](#input\\_rds\\_data\\_endpoint\\_subnet\\_ids) | The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | <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 | <a name=\"input_redshift_dedicated_network_acl\"></a> [redshift\\_dedicated\\_network\\_acl](#input\\_redshift\\_dedicated\\_network\\_acl) | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | <a name=\"input_redshift_inbound_acl_rules\"></a> [redshift\\_inbound\\_acl\\_rules](#input\\_redshift\\_inbound\\_acl\\_rules) | Redshift subnets inbound network ACL rules | `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---\nvariables.tf\n@@ -2081,6 +2081,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1456,6 +1456,28 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+###########################\n+# VPC Endpoint for RDS-DATA\n+###########################\n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n" } ]
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\nWhen the change of endpoint type was added to s3 and ddb - the routing was configured for most other subnet types but not database.\r\n\r\n## Motivation and Context\r\nAllows database instances to access S3 directly w/o going over egress paths \r\n\r\n## Breaking Changes\r\nNone\r\n\r\n## How Has This Been Tested?\r\nWe have tested this in a 500+ account deployment\r\n\r\n\n\n---\n\nChoice A:\nvpc-endpoints.tf\n@@ -35,6 +35,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n route_table_id = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_s3\" {\n count = var.create_vpc && var.enable_s3_endpoint && length(var.intra_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? 1 : 0\n \n@@ -86,6 +93,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n route_table_id = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_dynamodb\" {\n+ count = var.create_vpc && var.enable_dynamodb_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? && || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.dynamodb[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint && length(var.intra_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? 1 : 0\n \n---\n\n\n---\n\nChoice B:\nvpc-endpoints.tf\n@@ -35,6 +35,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n route_table_id = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_s3\" {\n count = var.create_vpc && var.enable_s3_endpoint && length(var.intra_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? 1 : 0\n \n@@ -86,6 +93,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n route_table_id = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_dynamodb\" {\n+ count = var.create_vpc && var.enable_dynamodb_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.dynamodb[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint && length(var.intra_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? 1 : 0\n \n---\n\n\n---\n\nChoice C:\nvpc-endpoints.tf\n@@ -35,6 +35,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_s3\" {\n count = var.create_vpc && var.enable_s3_endpoint && length(var.intra_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? 1 : 0\n \n@@ -86,6 +93,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n route_table_id = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_dynamodb\" {\n+ count = var.create_vpc && var.enable_dynamodb_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.dynamodb[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint && length(var.intra_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? 1 : 0\n \n---\n\n\n---\n\nChoice D:\nvpc-endpoints.tf\n@@ -35,6 0\n+\n+ @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n route_table_id = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_s3\" {\n count = var.create_vpc && var.enable_s3_endpoint && length(var.intra_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? 1 : 0\n \n@@ -86,6 +93,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n route_table_id = element(aws_route_table.private.*.id, count.index)\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_dynamodb\" {\n+ count = var.create_vpc && var.enable_dynamodb_endpoint && var.create_database_subnet_route_table && length(var.database_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? var.single_nat_gateway || var.create_database_internet_gateway_route ? 1 : length(var.database_subnets) : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.dynamodb[0].id\n+ route_table_id = element(aws_route_table.database.*.id, 0)\n+}\n+\n resource \"aws_vpc_endpoint_route_table_association\" \"intra_dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint && length(var.intra_subnets) > 0 && var.dynamodb_endpoint_type == \"Gateway\" ? 1 : 0\n \n---\n\n\n---\n" } ]
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\nAdding feature for configuring SSM VPC Endpoint policy.\r\n\r\n## Motivation and Context\r\nNeeded to manage SSM VPC Endpoint policy.\r\n\r\n## Breaking Changes\r\nNone.\r\n\r\n## How Has This Been Tested?\r\nTested locally.\n\n---\n\nChoice A:\nREADME.md\n@@ -705,6 +705,7 @@ No Modules.\n | sqs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SQS endpoint | `bool` | `false` | no |\n | sqs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SQS endpoint | `list(string)` | `[]` | no |\n | sqs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SQS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| ssm\\_endpoint\\_policy | A policy to attach to the endpoint that controls access to the service. Defaults to full access | `string` | `null` | no |\n | ssm\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint | `bool` | `false` | no |\n | ssm\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SSM endpoint | `list(string)` | `[]` | no |\n | ssm\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SSM endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nvariables.tf\n@@ -610,6 +610,12 @@ variable \"ssm_endpoint_subnet_ids\" {\n default = []\n }\n \n+variable \"ssm_endpoint_policy\" {\n+ description = \"A policy to attach to the endpoint that controls access to the service. Defaults to full access\"\n+ type = string\n+ default = null\n+}\n+\n variable \"ssm_endpoint_private_dns_enabled\" {\n description = \"Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -276,6 +276,7 @@ resource \"aws_vpc_endpoint\" \"ssm\" {\n \n security_group_ids = var.ssm_endpoint_security_group_ids\n subnet_ids = coalescelist(var.ssm_endpoint_subnet_ids, that policy = var.ssm_endpoint_policy\n private_dns_enabled = var.ssm_endpoint_private_dns_enabled\n tags = local.vpce_tags\n }\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -705,6 +705,7 @@ No Modules.\n | sqs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SQS endpoint | `bool` | `false` | no |\n | sqs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SQS endpoint | `list(string)` | `[]` | no |\n | sqs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SQS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| ssm\\_endpoint\\_policy | A policy to attach to the endpoint that controls access to the service. Defaults to full access | `string` | `null` | no |\n | ssm\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified for SSM endpoint | `bool` | `false` | no |\n | ssm\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SSM endpoint | `list(string)` | `[]` | no |\n | ssm\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SSM endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nvariables.tf\n@@ -610,6 +610,12 @@ variable \"ssm_endpoint_subnet_ids\" {\n default = []\n }\n \n+variable \"ssm_endpoint_policy\" {\n+ description = \"A policy to attach to the endpoint that controls access to the service. Defaults to full access\"\n+ type = string\n+ default = null\n+}\n+\n variable \"ssm_endpoint_private_dns_enabled\" {\n description = \"Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -276,6 +276,7 @@ resource \"aws_vpc_endpoint\" \"ssm\" {\n \n security_group_ids = var.ssm_endpoint_security_group_ids\n subnet_ids = coalescelist(var.ssm_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ policy = var.ssm_endpoint_policy\n private_dns_enabled = var.ssm_endpoint_private_dns_enabled\n tags = local.vpce_tags\n }\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -705,6 +705,7 @@ No Modules.\n | sqs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SQS endpoint | `bool` | `false` | no |\n | sqs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SQS endpoint | `list(string)` | `[]` | no |\n | sqs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SQS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| ssm\\_endpoint\\_policy | A policy to attach to the endpoint that controls access to the service. Defaults to full access | `string` | `null` | no |\n | ssm\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint | `bool` | `false` | no |\n | ssm\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SSM endpoint | `list(string)` | `[]` | no |\n | ssm\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SSM endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nvariables.tf\n@@ -610,6 +610,12 @@ variable \"ssm_endpoint_subnet_ids\" {\n default = []\n }\n \n+variable \"ssm_endpoint_policy\" {\n+ description = \"A policy to attach to the endpoint that controls access to the service. Defaults to full access\"\n+ type = string\n+ default = null\n+}\n+\n variable \"ssm_endpoint_private_dns_enabled\" {\n description = \"Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -276,6 +276,7 @@ resource | \"ssm\" {\n \n security_group_ids = var.ssm_endpoint_security_group_ids\n subnet_ids = coalescelist(var.ssm_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ policy = var.ssm_endpoint_policy\n private_dns_enabled = var.ssm_endpoint_private_dns_enabled\n tags = local.vpce_tags\n }\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -705,6 +705,7 @@ No Modules.\n | sqs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SQS endpoint | `bool` | `false` | no |\n | sqs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SQS endpoint | `list(string)` | `[]` | no |\n | sqs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SQS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| ssm\\_endpoint\\_policy | A policy to attach to the endpoint that controls access to the service. Defaults to full access | `string` | `null` | no |\n | ssm\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint | `bool` | `false` | no |\n | ssm\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SSM endpoint | `list(string)` | `[]` | no |\n | ssm\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SSM endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nvariables.tf\n@@ -610,6 +610,12 @@ variable \"ssm_endpoint_subnet_ids\" {\n default = []\n }\n \n+variable \"ssm_endpoint_policy\" {\n+ description = \"A policy to attach to the endpoint that controls access to the service. Defaults to full access\"\n+ type = string\n+ default = null\n+}\n+\n variable \"ssm_endpoint_private_dns_enabled\" {\n description = \"Whether or not to associate a private hosted zone with the specified VPC for SSM endpoint\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -276,6 +276,7 @@ resource \"aws_vpc_endpoint\" \"ssm\" {\n \n security_group_ids = var.ssm_endpoint_security_group_ids\n subnet_ids = coalescelist(var.ssm_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ policy = var.ssm_endpoint_policy\n private_dns_enabled = var.ssm_endpoint_private_dns_enabled\n tags = local.vpce_tags\n }\n---\n\n\n---\n" } ]
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\nThis PR adds optional S3 endpoint association with DB subnets route table.\r\n\r\n## Motivation and Context\r\nThis would help to enable communication from RDS placed in database subnets to S3 via S3 endpoint.\r\n\r\n## Breaking Changes\r\nN/A\r\n\r\n## How Has This Been Tested?\r\n- [ ] I have tested and validated these changes using one or more of the provided `examples/*` projects\r\n\r\nTested by creating VPC and validating changes. \r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -496,6 +496,7 @@ No Modules.\n | enable\\_codedeploy\\_endpoint | Should be true if you want to provision an CodeDeploy endpoint to the VPC | `bool` | `false` | no |\n | enable\\_codepipeline\\_endpoint | Should be true if you want to provision a CodePipeline endpoint to the VPC | `bool` | `false` | no |\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_database\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for database subnets | `bool` | `false` | to |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n | enable\\_dms\\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n---\nvariables.tf\n@@ -310,6 +310,12 @@ variable \"enable_public_s3_endpoint\" {\n type = bool\n }\n \n+variable \"enable_database_s3_endpoint\" {\n+ description = \"Whether to enable S3 VPC Endpoint for database subnets\"\n+ default = false\n+ type = bool\n+}\n+\n variable \"enable_dynamodb_endpoint\" {\n description = \"Should be true if you want to provision a DynamoDB endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -49,6 +49,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n route_table_id = aws_route_table.public[0].id\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.enable_database_s3_endpoint && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? local.nat_gateway_count : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, count.index)\n+}\n+\n ############################\n # VPC Endpoint for DynamoDB\n ############################\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -496,6 +496,7 @@ No Modules.\n | enable\\_codedeploy\\_endpoint | Should be true if you want to provision an CodeDeploy endpoint to the VPC | `bool` | `false` | no |\n | enable\\_codepipeline\\_endpoint | Should be true if you want to provision a CodePipeline endpoint to the VPC | `bool` | `false` | no |\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_database\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for database subnets | `bool` | `false` | no |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n | enable\\_dms\\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n---\nvariables.tf\n@@ -310,6 +310,12 @@ variable \"enable_public_s3_endpoint\" {\n type = bool\n }\n \n+variable \"enable_database_s3_endpoint\" {\n+ description = \"Whether to enable S3 VPC Endpoint for database subnets\"\n+ default = false\n+ type = bool\n+}\n+\n variable \"enable_dynamodb_endpoint\" {\n description = \"Should be true if you want to provision a DynamoDB endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -49,6 +49,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n route_table_id = aws_route_table.public[0].id\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.enable_database_s3_endpoint && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? local.nat_gateway_count : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, count.index)\n+}\n+\n ############################\n # VPC Endpoint for DynamoDB\n ############################\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -496,6 +496,7 @@ No Modules.\n | enable\\_codedeploy\\_endpoint | Should be true if you want to provision an CodeDeploy endpoint to the VPC | `bool` | `false` | no |\n | enable\\_codepipeline\\_endpoint | Should be true if you want to provision a CodePipeline endpoint to the VPC | `bool` | `false` | no |\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_database\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for database subnets | `bool` | `false` | no |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n | enable\\_dms\\_endpoint | Should be to if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n---\nvariables.tf\n@@ -310,6 +310,12 @@ variable \"enable_public_s3_endpoint\" {\n type = bool\n }\n \n+variable \"enable_database_s3_endpoint\" {\n+ description = \"Whether to enable S3 VPC Endpoint for database subnets\"\n+ default = false\n+ type = bool\n+}\n+\n variable \"enable_dynamodb_endpoint\" {\n description = \"Should be true if you want to provision a DynamoDB endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -49,6 +49,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n route_table_id = aws_route_table.public[0].id\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.enable_database_s3_endpoint && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? local.nat_gateway_count : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, count.index)\n+}\n+\n ############################\n # VPC Endpoint for DynamoDB\n ############################\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -496,6 +496,7 @@ No Modules.\n | enable\\_codedeploy\\_endpoint | Should be true if you want to provision an CodeDeploy endpoint to the VPC | `bool` | `false` | no |\n | enable\\_codepipeline\\_endpoint | Should be true if you want to provision a CodePipeline endpoint to the VPC | `bool` | `false` | no |\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_database\\_s3\\_endpoint | Whether var.enable_s3_endpoint enable S3 VPC Endpoint for database subnets | `bool` | `false` | no |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n | enable\\_dms\\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n---\nvariables.tf\n@@ -310,6 +310,12 @@ variable \"enable_public_s3_endpoint\" {\n type = bool\n }\n \n+variable \"enable_database_s3_endpoint\" {\n+ description = \"Whether to enable S3 VPC Endpoint for database subnets\"\n+ default = false\n+ type = bool\n+}\n+\n variable \"enable_dynamodb_endpoint\" {\n description = \"Should be true if you want to provision a DynamoDB endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -49,6 +49,13 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n route_table_id = aws_route_table.public[0].id\n }\n \n+resource \"aws_vpc_endpoint_route_table_association\" \"database_s3\" {\n+ count = var.create_vpc && var.enable_s3_endpoint && var.enable_database_s3_endpoint && length(var.database_subnets) > 0 && var.s3_endpoint_type == \"Gateway\" ? local.nat_gateway_count : 0\n+\n+ vpc_endpoint_id = aws_vpc_endpoint.s3[0].id\n+ route_table_id = element(aws_route_table.database.*.id, count.index)\n+}\n+\n ############################\n # VPC Endpoint for DynamoDB\n ############################\n---\n\n\n---\n" } ]
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- align ci-cd static checks to use individual minimum Terraform versions\r\n\r\n## Motivation and Context\r\n- ensure that the modules are all following a similar workflow and the static checks that performed\r\n\r\n## Breaking Changes\r\n- No\r\n\r\n## How Has This Been Tested?\r\n- ci-cd static checks\n\n---\n\nChoice A:\n.github/workflows/pre-commit.yml\n@@ -7,55 +7,95 @@ on:\n - master\n \n jobs:\n- getBaseVersion:\n- name: Get min/max versions\n- runs-on: ubuntu-latest\n+# Min Terraform version(s)\n+ getDirectories:\n+ name: Get root directories\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Build matrix\n+ id: matrix\n+ run: |\n+ DIRS=$(python -c \"import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))\")\n+ echo \"::set-output name=directories::$DIRS\"\n+ outputs:\n+ directories: ${{ steps.matrix.outputs.directories }}\n \n+ preCommitMinVersions:\n+ name: Min TF validate\n+ needs: getDirectories\n+ runs-on: ubuntu-latest\n+ strategy:\n+ matrix:\n+ directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/[email protected]\n+ with:\n+ directory: ${{ matrix.directory }}\n+ - name: Install Terraform v${{ steps.minMax.outputs.minVersion }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ steps.minMax.outputs.minVersion }}\n+ - name: Install pre-commit dependencies\n+ run: pip install pre-commit\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory != '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory == '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)\n+\n \n+# Max Terraform version\n+ getBaseVersion:\n+ name: Module max TF version\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/[email protected]\n outputs:\n minVersion: ${{ steps.minMax.outputs.minVersion }}\n maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n \n- preCommit:\n- name: Pre-commit check\n+ preCommitMaxVersion:\n+ name: Max TF pre-commit\n runs-on: ubuntu-latest\n needs: getBaseVersion\n strategy:\n fail-fast: false\n matrix:\n version:\n- - ${{ needs.getBaseVersion.outputs.minVersion }}\n - ${{ needs.getBaseVersion.outputs.maxVersion }}\n-\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n-\n - name: Install Python\n uses: actions/setup-python@v2\n-\n - name: Install Terraform v${{ matrix.version }}\n uses: hashicorp/setup-terraform@v1\n with:\n terraform_version: ${{ matrix.version }}\n-\n - name: Install pre-commit dependencies\n run: |\n pip install pre-commit\n curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n-\n- - name: Execute pre-commit\n- # Run only validate pre-commit check on min version supported\n- if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n- run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n-\n - name: Execute pre-commit\n # Run all pre-commit checks on max version supported\n if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: git://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.46.0\n+ rev: v1.47.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.21 |\n+| terraform | >= 0.12.26 |\n | aws | >= 2.70 |\n | random | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.21\"\n+ required_version = \">= 0.12.26\"\n \n required_providers {\n aws = {\n---\n\n\n---\n\nChoice B:\n.github/workflows/pre-commit.yml\n@@ -7,55 +7,95 @@ on:\n - master\n \n jobs:\n- getBaseVersion:\n- name: Get min/max versions\n- runs-on: ubuntu-latest\n+# Min Terraform version(s)\n+ getDirectories:\n+ name: Get root directories\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Build matrix\n+ id: matrix\n+ run: |\n+ DIRS=$(python -c \"import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))\")\n+ echo \"::set-output name=directories::$DIRS\"\n+ outputs:\n+ directories: ${{ steps.matrix.outputs.directories }}\n \n+ preCommitMinVersions:\n+ name: Min TF validate\n+ needs: getDirectories\n+ runs-on: ubuntu-latest\n+ strategy:\n+ matrix:\n+ directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/[email protected]\n+ with:\n+ directory: ${{ matrix.directory }}\n+ - name: Install Terraform v${{ steps.minMax.outputs.minVersion }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ steps.minMax.outputs.minVersion }}\n+ - name: Install pre-commit dependencies\n+ run: pip install pre-commit\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory != '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory == '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)\n+\n \n+# Max Terraform version\n+ getBaseVersion:\n+ name: Module max TF version\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/[email protected]\n outputs:\n minVersion: ${{ steps.minMax.outputs.minVersion }}\n maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n \n- preCommit:\n- name: Pre-commit check\n+ preCommitMaxVersion:\n+ name: Max TF pre-commit\n runs-on: ubuntu-latest\n needs: getBaseVersion\n strategy:\n fail-fast: false\n matrix:\n version:\n- - ${{ needs.getBaseVersion.outputs.minVersion }}\n - ${{ needs.getBaseVersion.outputs.maxVersion }}\n-\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n-\n - name: Install Python\n uses: actions/setup-python@v2\n-\n - name: Install Terraform v${{ matrix.version }}\n uses: hashicorp/setup-terraform@v1\n with:\n terraform_version: ${{ matrix.version }}\n-\n - name: Install pre-commit dependencies\n run: |\n pip install pre-commit\n curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n-\n- - name: Execute pre-commit\n- # Run only validate pre-commit check on min version supported\n- if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n- run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n-\n - name: Execute pre-commit\n # Run all pre-commit checks on max version supported\n if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: git://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.46.0\n+ rev: v1.47.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.21 |\n+| terraform | >= 0.12.26 |\n | aws | >= 2.70 |\n | random | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.21\"\n+ required_version = \">= 0.12.26\"\n \n required_providers {\n aws = {\n---\n\n\n---\n\nChoice C:\n.github/workflows/pre-commit.yml\n@@ -7,55 +7,95 @@ on:\n - master\n \n jobs:\n- getBaseVersion:\n- name: Get min/max versions\n- runs-on: ubuntu-latest\n+# Min Terraform version(s)\n+ getDirectories:\n+ name: Get root directories\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Build matrix\n+ id: matrix\n+ run: |\n+ DIRS=$(python -c \"import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))\")\n+ echo \"::set-output name=directories::$DIRS\"\n+ outputs:\n+ directories: ${{ steps.matrix.outputs.directories }}\n \n+ preCommitMinVersions:\n+ name: Min TF validate\n+ needs: getDirectories\n+ runs-on: ubuntu-latest\n+ strategy:\n+ matrix:\n+ directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/[email protected]\n+ with:\n+ directory: ${{ matrix.directory }}\n+ - name: Install Terraform v${{ steps.minMax.outputs.minVersion }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ steps.minMax.outputs.minVersion }}\n+ - name: Install pre-commit dependencies\n+ run: pip install pre-commit\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory != '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory == '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)\n+\n \n+# Max Terraform version\n+ getBaseVersion:\n+ name: Module max TF version\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/[email protected]\n outputs:\n minVersion: ${{ steps.minMax.outputs.minVersion }}\n maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n \n- preCommit:\n- name: Pre-commit check\n+ preCommitMaxVersion:\n+ name: Max TF pre-commit\n runs-on: ubuntu-latest\n needs: getBaseVersion\n strategy:\n fail-fast: false\n matrix:\n version:\n- - ${{ needs.getBaseVersion.outputs.minVersion }}\n - ${{ needs.getBaseVersion.outputs.maxVersion }}\n-\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n-\n - name: Install Python\n uses: actions/setup-python@v2\n-\n - name: Install Terraform v${{ matrix.version }}\n uses: hashicorp/setup-terraform@v1\n with:\n terraform_version: ${{ matrix.version }}\n-\n - name: Install pre-commit dependencies\n run: |\n pip install pre-commit\n curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n-\n- - name: Execute pre-commit\n- # Run only validate pre-commit check on min version supported\n- if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n- run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n-\n - name: Execute pre-commit\n # Run all pre-commit checks on max version supported\n if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: git://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.46.0\n+ rev: v1.47.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.21 |\n+| terraform | >= 0.12.26 |\n | aws | >= 2.70 |\n | random | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.21\"\n+ required_version = \">= 0.12.26\"\n \n required_providers {\n aws = {\n---\n\n\n---\n\nChoice D:\n.github/workflows/pre-commit.yml\n@@ -7,55 +7,95 @@ on:\n - master\n \n jobs:\n- getBaseVersion:\n- name: Get min/max versions\n- runs-on: ubuntu-latest\n+# Min Terraform version(s)\n+ getDirectories:\n+ name: Get root directories\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Build matrix\n+ id: matrix\n+ run: |\n+ DIRS=$(python -c \"import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))\")\n+ echo \"::set-output name=directories::$DIRS\"\n+ outputs:\n+ directories: ${{ steps.matrix.outputs.directories }}\n \n+ preCommitMinVersions:\n+ name: Min TF validate\n+ needs: getDirectories\n+ runs-on: ubuntu-latest\n+ strategy:\n+ matrix:\n+ directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/[email protected]\n+ with:\n+ directory: ${{ matrix.directory }}\n+ - name: Install Terraform v${{ steps.minMax.outputs.minVersion }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ steps.minMax.outputs.minVersion }}\n+ - name: Install pre-commit dependencies\n+ run: pip install pre-commit\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory != '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*\n+ json; - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.directory == '.' }}\n+ run:\n+ pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)\n+\n \n+# Max Terraform version\n+ getBaseVersion:\n+ name: Module max TF version\n+ runs-on: ubuntu-latest\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n - name: Terraform min/max versions\n id: minMax\n uses: clowdhaus/[email protected]\n outputs:\n minVersion: ${{ steps.minMax.outputs.minVersion }}\n maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n \n- preCommit:\n- name: Pre-commit check\n+ preCommitMaxVersion:\n+ name: Max TF pre-commit\n runs-on: ubuntu-latest\n needs: getBaseVersion\n strategy:\n fail-fast: false\n matrix:\n version:\n- - ${{ needs.getBaseVersion.outputs.minVersion }}\n - ${{ needs.getBaseVersion.outputs.maxVersion }}\n-\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n-\n - name: Install Python\n uses: actions/setup-python@v2\n-\n - name: Install Terraform v${{ matrix.version }}\n uses: hashicorp/setup-terraform@v1\n with:\n terraform_version: ${{ matrix.version }}\n-\n - name: Install pre-commit dependencies\n run: |\n pip install pre-commit\n curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n-\n- - name: Execute pre-commit\n- # Run only validate pre-commit check on min version supported\n- if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n- run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n-\n - name: Execute pre-commit\n # Run all pre-commit checks on max version supported\n if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n---\n.pre-commit-config.yaml\n@@ -1,6 +1,6 @@\n repos:\n - repo: git://github.com/antonbabenko/pre-commit-terraform\n- rev: v1.46.0\n+ rev: v1.47.0\n hooks:\n - id: terraform_fmt\n - id: terraform_validate\n---\nexamples/vpc-flow-logs/README.md\n@@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n \n | Name | Version |\n |------|---------|\n-| terraform | >= 0.12.21 |\n+| terraform | >= 0.12.26 |\n | aws | >= 2.70 |\n | random | >= 2 |\n \n---\nexamples/vpc-flow-logs/versions.tf\n@@ -1,5 +1,5 @@\n terraform {\n- required_version = \">= 0.12.21\"\n+ required_version = \">= 0.12.26\"\n \n required_providers {\n aws = {\n---\n\n\n---\n" } ]
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- add default route table resource to manage default route table, its tags, routes, etc.\r\n- update complete vpc example to show/validate changes here for managing the default route table \r\n- `vpc_endpoint_id` was left out of the `route` config block because it was only recently added in v3.15.0 of the AWS provider and it will throw errors if the min version is not set to that. we can re-enable this later on when the min version bump is justified\r\n\r\n## Motivation and Context\r\n- adds the ability to tag and manage the default (`main`) route table of the VPC created\r\n\r\nThese changes supersedes the following PRs:\r\nCloses #545 \r\nCloses #147\r\n\r\n## Breaking Changes\r\n- No\r\n\r\n## How Has This Been Tested?\r\n- Checkout `master` locally and ensure its up to date/current\r\n- `cd examples/complete-vpc && terraform init && terraform apply` -> sets baseline\r\n- Checkout these changes locally\r\n- `terraform apply` -> manages default route table and sets the tags, etc.\r\n\r\nNote - I also tested going from `master` to this change set without any changes added to the example project and the plan came back clean meaning backwards compatibility is preserved\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -249,6 +249,7 @@ No Modules.\n | [aws_customer_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/customer_gateway) |\n | [aws_db_subnet_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_subnet_group) |\n | [aws_default_network_acl](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_network_acl) |\n+| [aws_default_route_table](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table) |\n | [aws_default_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group) |\n | [aws_default_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) |\n | [aws_egress_only_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/egress_only_internet_gateway) |\n@@ -385,6 +386,9 @@ No Modules.\n | default\\_network\\_acl\\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` | <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 | default\\_network\\_acl\\_name | Name to be used on the Default Network ACL | `string` | `\"\"` | no |\n | default\\_network\\_acl\\_tags | Additional tags for the Default Network ACL | `map(string)` | `{}` | no |\n+| default\\_route\\_table\\_propagating\\_vgws | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n+| default\\_route\\_table\\_routes | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| default\\_route\\_table\\_tags | Additional tags for the default route table | `map(string)` | `{}` | no |\n | default\\_security\\_group\\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_name | Name to be used on the default security group | `string` | `\"default\"` | no |\n@@ -603,6 +607,7 @@ No Modules.\n | logs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for CloudWatch Logs endpoint | `list(string)` | `[]` | no |\n | logs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for CloudWatch Logs endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | manage\\_default\\_network\\_acl | Should be true to adopt and manage Default Network ACL | `bool` | `false` | no |\n+| manage\\_default\\_route\\_table | Should be true to manage default route table | `bool` | `false` | no |\n | manage\\_default\\_security\\_group | Should be true to adopt and manage default security group | `bool` | `false` | no |\n | manage\\_default\\_vpc | Should be true to adopt and manage Default VPC | `bool` | `false` | no |\n | map\\_public\\_ip\\_on\\_launch | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -24,6 +24,9 @@ module \"vpc\" {\n \n create_database_subnet_group = false\n \n+ manage_default_route_table = true\n+ default_route_table_tags = { DefaultRouteTable = true }\n+\n enable_dns_hostnames = true\n enable_dns_support = true\n \n---\nmain.tf\n@@ -160,6 +160,43 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n )\n }\n \n+###############\n+# Default route\n+###############\n+\n+resource \"aws_default_route_table\" \"default\" {\n+ count = var.create_vpc && var.manage_default_route_table ? 1 : 0\n+\n+ default_route_table_id = aws_vpc.this[0].default_route_table_id\n+ propagating_vgws = var.default_route_table_propagating_vgws\n+\n+ dynamic \"route\" {\n+ for_each = var.default_route_table_routes\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id `list(map(string))` = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ # `vpc_endpoint_id` was recently added in v3.15.0\n+ # vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n+ tags = merge(\n+ { \"Name\" = var.name },\n+ var.tags,\n+ var.default_route_table_tags,\n+ )\n+}\n+\n ################\n # Publiс routes\n ################\n---\nvariables.tf\n@@ -2213,6 +2213,30 @@ variable \"propagate_public_route_tables_vgw\" {\n default = false\n }\n \n+variable \"manage_default_route_table\" {\n+ description = \"Should be true to manage default route table\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"default_route_table_propagating_vgws\" {\n+ description = \"List of virtual gateways for propagation\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"default_route_table_routes\" {\n+ description = \"Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"default_route_table_tags\" {\n+ description = \"Additional tags for the default route table\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add to all resources\"\n type = map(string)\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -249,6 +249,7 @@ No Modules.\n | [aws_customer_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/customer_gateway) |\n | [aws_db_subnet_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_subnet_group) |\n | [aws_default_network_acl](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_network_acl) |\n+| [aws_default_route_table](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table) |\n | [aws_default_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group) |\n | [aws_default_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) |\n | [aws_egress_only_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/egress_only_internet_gateway) |\n@@ -385,6 +386,9 @@ No Modules.\n | default\\_network\\_acl\\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` | <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 | default\\_network\\_acl\\_name | Name to be used on the Default Network ACL | `string` | `\"\"` | no |\n | default\\_network\\_acl\\_tags | Additional tags for the Default Network ACL | `map(string)` | `{}` | no |\n+| default\\_route\\_table\\_propagating\\_vgws | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n+| default\\_route\\_table\\_routes | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| default\\_route\\_table\\_tags | Additional tags for the default route table | `map(string)` | `{}` | no |\n | default\\_security\\_group\\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_name | Name to be used on the default security group | `string` | `\"default\"` | no |\n@@ -603,6 +607,7 @@ No Modules.\n | logs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for CloudWatch Logs endpoint | `list(string)` | `[]` | no |\n | logs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for CloudWatch Logs endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | manage\\_default\\_network\\_acl | Should be true to adopt and manage Default Network ACL | `bool` | `false` | no |\n+| manage\\_default\\_route\\_table | Should be true to manage default route table | `bool` | `false` | no |\n | manage\\_default\\_security\\_group | Should be true to adopt and manage default security group | `bool` | `false` | no |\n | manage\\_default\\_vpc | Should be true to adopt and manage Default VPC | `bool` | `false` | no |\n | map\\_public\\_ip\\_on\\_launch | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -24,6 +24,9 @@ module \"vpc\" {\n \n create_database_subnet_group = false\n \n+ manage_default_route_table = true\n+ default_route_table_tags = { DefaultRouteTable = true }\n+\n enable_dns_hostnames = true\n enable_dns_support = true\n \n---\nmain.tf\n@@ -160,6 +160,43 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n )\n }\n \n+###############\n+# Default route\n+###############\n+\n+resource \"aws_default_route_table\" \"default\" {\n+ count = var.create_vpc && var.manage_default_route_table ? 1 : 0\n+\n+ default_route_table_id = aws_vpc.this[0].default_route_table_id\n+ propagating_vgws = var.default_route_table_propagating_vgws\n+\n+ dynamic \"route\" {\n+ for_each = var.default_route_table_routes\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ # `vpc_endpoint_id` was recently added in v3.15.0\n+ # vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n+ tags = merge(\n+ { \"Name\" = var.name },\n+ var.tags,\n+ var.default_route_table_tags,\n+ )\n+}\n+\n ################\n # Publiс routes\n ################\n---\nvariables.tf\n@@ -2213,6 +2213,30 @@ variable \"propagate_public_route_tables_vgw\" {\n default = false\n }\n \n+variable \"manage_default_route_table\" {\n+ description = \"Should be true to manage default route table\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"default_route_table_propagating_vgws\" {\n+ description = \"List of virtual gateways for propagation\"\n+ the type = list(string)\n+ default = []\n+}\n+\n+variable \"default_route_table_routes\" {\n+ description = \"Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"default_route_table_tags\" {\n+ description = \"Additional tags for the default route table\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add to all resources\"\n type = map(string)\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -249,6 +249,7 @@ No Modules.\n | [aws_customer_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/customer_gateway) |\n | [aws_db_subnet_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_subnet_group) |\n | [aws_default_network_acl](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_network_acl) |\n+| [aws_default_route_table](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table) |\n | [aws_default_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group) |\n | [aws_default_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) |\n | [aws_egress_only_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/egress_only_internet_gateway) |\n@@ -385,6 +386,9 @@ No Modules.\n | default\\_network\\_acl\\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` | <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 | default\\_network\\_acl\\_name | Name to be used on the Default Network ACL | `string` | `\"\"` | no |\n | default\\_network\\_acl\\_tags | Additional tags for the Default Network ACL | `map(string)` | `{}` | no |\n+| default\\_route\\_table\\_propagating\\_vgws | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n+| default\\_route\\_table\\_routes | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| default\\_route\\_table\\_tags | Additional tags for the default route table | `map(string)` | `{}` | no |\n | default\\_security\\_group\\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_name | Name to be used on the default security group | `string` | `\"default\"` | no |\n@@ -603,6 +607,7 @@ No Modules.\n | logs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for CloudWatch Logs endpoint | `list(string)` | `[]` | no |\n | logs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for CloudWatch Logs endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | manage\\_default\\_network\\_acl | Should be true to adopt and manage Default Network ACL | `bool` | `false` | no |\n+| manage\\_default\\_route\\_table | Should be true to manage default route table | `bool` | `false` | no |\n | manage\\_default\\_security\\_group | Should be true to adopt and manage default security group | `bool` | `false` | no |\n | manage\\_default\\_vpc | Should be true to adopt and manage Default VPC | `bool` | `false` | no |\n | map\\_public\\_ip\\_on\\_launch | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -24,6 +24,9 @@ module \"vpc\" {\n \n create_database_subnet_group = false\n \n+ manage_default_route_table = true\n+ default_route_table_tags = { DefaultRouteTable = true }\n+\n enable_dns_hostnames = true\n enable_dns_support = true\n \n---\nmain.tf\n@@ -160,6 +160,43 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n )\n }\n \n+###############\n+# Default route\n+###############\n+\n+resource \"aws_default_route_table\" \"default\" {\n+ count = var.create_vpc && var.manage_default_route_table ? 1 : 0\n+\n+ default_route_table_id = aws_vpc.this[0].default_route_table_id\n+ propagating_vgws = var.default_route_table_propagating_vgws\n+\n+ dynamic \"route\" {\n+ for_each = var.default_route_table_routes\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ # `vpc_endpoint_id` was recently added in v3.15.0\n+ # vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n+ tags = merge(\n+ { \"Name\" = var.name },\n+ var.tags,\n+ var.default_route_table_tags,\n+ )\n+}\n+\n ################\n # Publiс routes\n ################\n---\nvariables.tf\n@@ -2213,6 +2213,30 @@ variable \"propagate_public_route_tables_vgw\" {\n default = false\n }\n \n+variable \"manage_default_route_table\" {\n+ description = \"Should be true to manage default route table\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"default_route_table_propagating_vgws\" {\n+ description = \"List of virtual gateways for propagation\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"default_route_table_routes\" {\n+ description = \"Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"default_route_table_tags\" {\n+ description = \"Additional tags for the default route table\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add to all resources\"\n type = map(string)\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -249,6 +249,7 @@ No Modules.\n | [aws_customer_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/customer_gateway) |\n | [aws_db_subnet_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_subnet_group) |\n | [aws_default_network_acl](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_network_acl) |\n+| [aws_default_route_table](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table) |\n | [aws_default_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group) |\n | [aws_default_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_vpc) |\n | [aws_egress_only_internet_gateway](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/egress_only_internet_gateway) |\n@@ -385,6 +386,9 @@ No Modules.\n | default\\_network\\_acl\\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` | <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 | default\\_network\\_acl\\_name | Name to be used on the Default Network ACL | `string` | `\"\"` | no |\n | default\\_network\\_acl\\_tags | Additional tags for the Default Network ACL {}\n+}\n+\n `map(string)` | `{}` | no |\n+| default\\_route\\_table\\_propagating\\_vgws | List of virtual gateways for propagation | `list(string)` | `[]` | no |\n+| default\\_route\\_table\\_routes | Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route | `list(map(string))` | `[]` | no |\n+| default\\_route\\_table\\_tags | Additional tags for the default route table | `map(string)` | `{}` | no |\n | default\\_security\\_group\\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |\n | default\\_security\\_group\\_name | Name to be used on the default security group | `string` | `\"default\"` | no |\n@@ -603,6 +607,7 @@ No Modules.\n | logs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for CloudWatch Logs endpoint | `list(string)` | `[]` | no |\n | logs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for CloudWatch Logs endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | manage\\_default\\_network\\_acl | Should be true to adopt and manage Default Network ACL | `bool` | `false` | no |\n+| manage\\_default\\_route\\_table | Should be true to manage default route table | `bool` | `false` | no |\n | manage\\_default\\_security\\_group | Should be true to adopt and manage default security group | `bool` | `false` | no |\n | manage\\_default\\_vpc | Should be true to adopt and manage Default VPC | `bool` | `false` | no |\n | map\\_public\\_ip\\_on\\_launch | Should be false if you do not want to auto-assign public IP on launch | `bool` | `true` | no |\n---\nexamples/complete-vpc/main.tf\n@@ -24,6 +24,9 @@ module \"vpc\" {\n \n create_database_subnet_group = false\n \n+ manage_default_route_table = true\n+ default_route_table_tags = { DefaultRouteTable = true }\n+\n enable_dns_hostnames = true\n enable_dns_support = true\n \n---\nmain.tf\n@@ -160,6 +160,43 @@ resource \"aws_egress_only_internet_gateway\" \"this\" {\n )\n }\n \n+###############\n+# Default route\n+###############\n+\n+resource \"aws_default_route_table\" \"default\" {\n+ count = var.create_vpc && var.manage_default_route_table ? 1 : 0\n+\n+ default_route_table_id = aws_vpc.this[0].default_route_table_id\n+ propagating_vgws = var.default_route_table_propagating_vgws\n+\n+ dynamic \"route\" {\n+ for_each = var.default_route_table_routes\n+ content {\n+ # One of the following destinations must be provided\n+ cidr_block = route.value.cidr_block\n+ ipv6_cidr_block = lookup(route.value, \"ipv6_cidr_block\", null)\n+\n+ # One of the following targets must be provided\n+ egress_only_gateway_id = lookup(route.value, \"egress_only_gateway_id\", null)\n+ gateway_id = lookup(route.value, \"gateway_id\", null)\n+ instance_id = lookup(route.value, \"instance_id\", null)\n+ nat_gateway_id = lookup(route.value, \"nat_gateway_id\", null)\n+ network_interface_id = lookup(route.value, \"network_interface_id\", null)\n+ transit_gateway_id = lookup(route.value, \"transit_gateway_id\", null)\n+ # `vpc_endpoint_id` was recently added in v3.15.0\n+ # vpc_endpoint_id = lookup(route.value, \"vpc_endpoint_id\", null)\n+ vpc_peering_connection_id = lookup(route.value, \"vpc_peering_connection_id\", null)\n+ }\n+ }\n+\n+ tags = merge(\n+ { \"Name\" = var.name },\n+ var.tags,\n+ var.default_route_table_tags,\n+ )\n+}\n+\n ################\n # Publiс routes\n ################\n---\nvariables.tf\n@@ -2213,6 +2213,30 @@ variable \"propagate_public_route_tables_vgw\" {\n default = false\n }\n \n+variable \"manage_default_route_table\" {\n+ description = \"Should be true to manage default route table\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"default_route_table_propagating_vgws\" {\n+ description = \"List of virtual gateways for propagation\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"default_route_table_routes\" {\n+ description = \"Configuration block of routes. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table#route\"\n+ type = list(map(string))\n+ default = []\n+}\n+\n+variable \"default_route_table_tags\" {\n+ description = \"Additional tags for the default route table\"\n+ type = map(string)\n+ default = {}\n+}\n+\n variable \"tags\" {\n description = \"A map of tags to add to all resources\"\n type = map(string)\n---\n\n\n---\n" } ]
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 ci-cd workflow for pre-commit checks; replacing ci-cd configuration files for CircleCI \r\n\r\n## Motivation and Context\r\n- provide static checks for pull requests\r\n\r\n## Breaking Changes\r\n- no\r\n\r\n## How Has This Been Tested?\r\n- copy of what is implemented in SQS module repository\r\n\n\n---\n\nChoice A:\n.circleci/config.yml\n@@ -1,44 +0,0 @@\n-version: 2\n-\n-terraform: &terraform\n- docker:\n- - image: hashicorp/terraform:0.12.21\n- working_directory: /tmp/workspace/terraform\n-\n-jobs:\n- validate:\n- <<: *terraform\n- steps:\n- - checkout\n-# - run:\n-# name: Add github.com to ~/.ssh/known_hosts\n-# command: mkdir ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts\n- - run:\n- name: terraform init\n- command: find . -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform init -input=false -backend=false) || exit 1; done\n- - run:\n- name: Validate Terraform configurations\n- command: find . -name \".terraform\" -prune -o -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform validate && echo \"√ $m\") || exit 1 ; done\n- environment:\n- AWS_DEFAULT_REGION: us-east-1\n- - run:\n- name: Check if Terraform configurations are properly formatted\n- command: if [[ -n \"$(terraform fmt -write=false)\" ]]; then echo \"Some terraform files need be formatted, run 'terraform fmt' to fix\"; exit 1; fi\n- - run:\n- name: Install tflint\n- command: wget -O /tmp/tflint.zip https://github.com/wata727/tflint/releases/download/v0.20.2/tflint_linux_amd64.zip && unzip /tmp/tflint.zip -d /usr/local/bin\n- - run:\n- name: Check Terraform configurations with tflint\n- command: tflint\n- - persist_to_workspace:\n- root: .\n- paths: .\n-\n-workflows:\n- version: 2\n- build:\n- jobs:\n- - validate\n-# - plan_examples\n-# - approve\n-# - release\n---\n.github/workflows/pre-commit.yml\n@@ -0,0 +1,62 @@\n+name: Pre-Commit\n+\n+on:\n+ terraform pull_request:\n+ push:\n+ branches:\n+ - master\n+\n+jobs:\n+ getBaseVersion:\n+ name: Get min/max versions\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/[email protected]\n+ outputs:\n+ minVersion: ${{ steps.minMax.outputs.minVersion }}\n+ maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n+\n+ preCommit:\n+ name: Pre-commit check\n+ runs-on: ubuntu-latest\n+ needs: getBaseVersion\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ version:\n+ - ${{ needs.getBaseVersion.outputs.minVersion }}\n+ - ${{ needs.getBaseVersion.outputs.maxVersion }}\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+\n+ - name: Install Terraform v${{ matrix.version }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ matrix.version }}\n+\n+ - name: Install pre-commit dependencies\n+ run: |\n+ pip install pre-commit\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n+\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n+\n+ - name: Execute pre-commit\n+ # Run all pre-commit checks on max version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files\n---\n\n\n---\n\nChoice B:\n.circleci/config.yml\n@@ -1,44 +0,0 @@\n-version: 2\n-\n-terraform: &terraform\n- docker:\n- - image: hashicorp/terraform:0.12.21\n- working_directory: /tmp/workspace/terraform\n-\n-jobs:\n- validate:\n- <<: *terraform\n- steps:\n- - checkout\n-# - run:\n-# name: Add github.com to ~/.ssh/known_hosts\n-# command: mkdir ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts\n- - run:\n- name: terraform init\n- command: find . -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform init -input=false -backend=false) || exit 1; done\n- - run:\n- name: Validate Terraform configurations\n- command: find . -name \".terraform\" -prune -o -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform validate && echo \"√ $m\") || exit 1 ; done\n- environment:\n- AWS_DEFAULT_REGION: us-east-1\n- - run:\n- name: Check if Terraform configurations are properly formatted\n- command: if [[ -n \"$(terraform fmt -write=false)\" ]]; then echo \"Some terraform files need be formatted, run 'terraform fmt' to fix\"; exit 1; fi\n- - run:\n- name: Install tflint\n- command: wget -O /tmp/tflint.zip https://github.com/wata727/tflint/releases/download/v0.20.2/tflint_linux_amd64.zip && unzip /tmp/tflint.zip -d /usr/local/bin\n- - run:\n- name: Check Terraform configurations with tflint\n- command: tflint\n- - persist_to_workspace:\n- root: .\n- paths: .\n-\n-workflows:\n- version: 2\n- build:\n- jobs:\n- - validate\n-# - plan_examples\n-# - approve\n-# - release\n---\n.github/workflows/pre-commit.yml\n@@ -0,0 +1,62 @@\n+name: Pre-Commit\n+\n+on:\n+ pull_request:\n+ push:\n+ branches:\n+ - master\n+\n+jobs:\n+ getBaseVersion:\n+ name: Get min/max versions\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/[email protected]\n+ outputs:\n+ minVersion: ${{ steps.minMax.outputs.minVersion }}\n+ maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n+\n+ preCommit:\n+ name: Pre-commit check\n+ runs-on: ubuntu-latest\n+ needs: getBaseVersion\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ version:\n+ - ${{ needs.getBaseVersion.outputs.minVersion }}\n+ - ${{ needs.getBaseVersion.outputs.maxVersion }}\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+\n+ - name: Install Terraform v${{ matrix.version }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ matrix.version }}\n+\n+ - name: Install pre-commit dependencies\n+ run: |\n+ pip install pre-commit\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n+\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n+\n+ - name: Execute pre-commit\n+ # Run all pre-commit checks on max version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files\n---\n\n\n---\n\nChoice C:\n.circleci/config.yml\n@@ -1,44 +0,0 @@\n-version: 2\n-\n-terraform: &terraform\n- docker:\n- - image: hashicorp/terraform:0.12.21\n- working_directory: /tmp/workspace/terraform\n-\n-jobs:\n- validate:\n- <<: *terraform\n- steps:\n- - checkout\n-# - run:\n-# name: Add github.com to ~/.ssh/known_hosts\n-# command: mkdir ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts\n- - run:\n- name: terraform init\n- command: find . -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform init -input=false -backend=false) || exit 1; done\n- - run:\n- name: Validate Terraform configurations\n- command: find . -name \".terraform\" -prune -o -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform validate && echo \"√ $m\") || exit 1 ; done\n- environment:\n- AWS_DEFAULT_REGION: us-east-1\n- - run:\n- name: Check if Terraform configurations are properly formatted\n- command: if [[ -n \"$(terraform fmt -write=false)\" ]]; then echo \"Some terraform files need be formatted, run 'terraform fmt' to fix\"; exit 1; fi\n- - run:\n- name: Install tflint\n- command: wget -O /tmp/tflint.zip https://github.com/wata727/tflint/releases/download/v0.20.2/tflint_linux_amd64.zip && unzip /tmp/tflint.zip -d /usr/local/bin\n- - run:\n- name: Check Terraform configurations with tflint\n- command: tflint\n- - persist_to_workspace:\n- root: .\n- paths: .\n-\n-workflows:\n- version: 2\n- build:\n- jobs:\n- - validate\n-# - plan_examples\n-# - approve\n-# - release\n---\n.github/workflows/pre-commit.yml\n@@ -0,0 +1,62 @@\n+name: Pre-Commit\n+\n+on:\n+ pull_request:\n+ push:\n+ branches:\n+ - master\n+\n+jobs:\n+ getBaseVersion:\n+ name: Get min/max versions\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/[email protected]\n+ outputs:\n+ minVersion: ${{ steps.minMax.outputs.minVersion }}\n+ maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n+\n+ preCommit:\n+ name: Pre-commit check\n+ runs-on: ubuntu-latest\n+ needs: getBaseVersion\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ version:\n+ - ${{ needs.getBaseVersion.outputs.minVersion }}\n+ - ${{ needs.getBaseVersion.outputs.maxVersion }}\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+\n+ - name: Install Terraform v${{ matrix.version }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ matrix.version }}\n+\n+ - name: Install pre-commit dependencies\n+ run: |\n+ pip install pre-commit\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n+\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n+\n+ - name: Execute pre-commit\n+ # Run all pre-commit checks on max version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files\n---\n\n\n---\n\nChoice D:\n.circleci/config.yml\n@@ -1,44 +0,0 @@\n-version: 2\n-\n-terraform: &terraform\n- docker:\n- - image: hashicorp/terraform:0.12.21\n- working_directory: /tmp/workspace/terraform\n-\n-jobs:\n- validate:\n- <<: *terraform\n- steps:\n- - checkout\n-# - run:\n-# name: Add github.com to ~/.ssh/known_hosts\n-# command: mkdir ~/.ssh && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts\n- - run:\n- name: terraform init\n- command: find . -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform init -input=false -backend=false) || exit 1; done\n- - run:\n- name: Validate Terraform configurations\n- command: find . -name \".terraform\" -prune -o -type f -name \"*.tf\" -exec dirname {} \\;|sort -u | while read m; do (cd \"$m\" && terraform validate && echo \"√ $m\") || exit 1 ; done\n- environment:\n- AWS_DEFAULT_REGION: us-east-1\n- - run:\n- name: Check if Terraform configurations are properly formatted\n- command: if [[ -n \"$(terraform fmt -write=false)\" ]]; then echo \"Some terraform files need be formatted, run 'terraform fmt' to fix\"; exit 1; fi\n- - run:\n- name: Install tflint\n- command: wget -O /tmp/tflint.zip https://github.com/wata727/tflint/releases/download/v0.20.2/tflint_linux_amd64.zip && unzip /tmp/tflint.zip -d /usr/local/bin\n- - run:\n- name: Check Terraform configurations with tflint\n- command: tflint\n- - persist_to_workspace:\n- root: .\n- paths: .\n-\n-workflows:\n- version: 2\n- -d build:\n- jobs:\n- - validate\n-# - plan_examples\n-# - approve\n-# - release\n---\n.github/workflows/pre-commit.yml\n@@ -0,0 +1,62 @@\n+name: Pre-Commit\n+\n+on:\n+ pull_request:\n+ push:\n+ branches:\n+ - master\n+\n+jobs:\n+ getBaseVersion:\n+ name: Get min/max versions\n+ runs-on: ubuntu-latest\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Terraform min/max versions\n+ id: minMax\n+ uses: clowdhaus/[email protected]\n+ outputs:\n+ minVersion: ${{ steps.minMax.outputs.minVersion }}\n+ maxVersion: ${{ steps.minMax.outputs.maxVersion }}\n+\n+ preCommit:\n+ name: Pre-commit check\n+ runs-on: ubuntu-latest\n+ needs: getBaseVersion\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ version:\n+ - ${{ needs.getBaseVersion.outputs.minVersion }}\n+ - ${{ needs.getBaseVersion.outputs.maxVersion }}\n+\n+ steps:\n+ - name: Checkout\n+ uses: actions/checkout@v2\n+\n+ - name: Install Python\n+ uses: actions/setup-python@v2\n+\n+ - name: Install Terraform v${{ matrix.version }}\n+ uses: hashicorp/setup-terraform@v1\n+ with:\n+ terraform_version: ${{ matrix.version }}\n+\n+ - name: Install pre-commit dependencies\n+ run: |\n+ pip install pre-commit\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E \"https://.+?-linux-amd64\" | head -n1)\" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/\n+ curl -L \"$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E \"https://.+?_linux_amd64.zip\")\" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/\n+\n+ - name: Execute pre-commit\n+ # Run only validate pre-commit check on min version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.minVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files terraform_validate\n+\n+ - name: Execute pre-commit\n+ # Run all pre-commit checks on max version supported\n+ if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}\n+ run: pre-commit run --color=always --show-diff-on-failure --all-files\n---\n\n\n---\n" } ]
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 adds an output variable which points to the name of the database subnet group name\r\n\r\n## Motivation and Context\r\nWe need to access this variable since the [terraform-aws-modules/rds/aws](https://registry.terraform.io/modules/terraform-aws-modules/rds/aws/latest) modules needs the name of the database subnet group when it already exists (and not its ID). Although I would prefer that this module use the ID as input, it's much more simpler to add an output to the VPC module.\r\n\r\nAt the moment, we can't just assume the database subnet group name with the `name` input parameter since a `lower()` function is applied, and may change it the future.\r\n\r\n## Breaking Changes\r\nNo breaking changes\r\n\r\n## How Has This Been Tested?\r\n<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -715,6 +715,7 @@ No Modules.\n | database\\_route\\_table\\_ids | List of IDs of database route tables |\n | database\\_subnet\\_arns | List of ARNs of database subnets |\n | database\\_subnet\\_group | ID of database subnet group |\n+| database\\_subnet\\_group\\_name | Name of database subnet group |\n | database\\_subnets | List of IDs of database subnets |\n | database\\_subnets\\_cidr\\_blocks | List of cidr\\_blocks of database subnets |\n | database\\_subnets\\_ipv6\\_cidr\\_blocks | List of IPv6 cidr\\_blocks of database subnets in an IPv6 enabled VPC |\n---\noutputs.tf\n@@ -133,6 +133,11 @@ output \"database_subnet_group\" {\n value = concat(aws_db_subnet_group.database.*.id, [\"\"])[0]\n }\n \n+output \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ value = concat(aws_db_subnet_group.database.*.name, [\"\"])[0]\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value = aws_subnet.redshift.*.id\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -715,6 +715,7 @@ No Modules.\n | database\\_route\\_table\\_ids | List of IDs of database route tables |\n | database\\_subnet\\_arns | List of ARNs of database subnets |\n | database\\_subnet\\_group | ID of database subnet group |\n+| database\\_subnet\\_group\\_name | Name of database subnet group |\n | database\\_subnets | List of IDs of database subnets |\n of database\\_subnets\\_cidr\\_blocks | List of cidr\\_blocks of database subnets |\n | database\\_subnets\\_ipv6\\_cidr\\_blocks | List of IPv6 cidr\\_blocks of database subnets in an IPv6 enabled VPC |\n---\noutputs.tf\n@@ -133,6 +133,11 @@ output \"database_subnet_group\" {\n value = concat(aws_db_subnet_group.database.*.id, [\"\"])[0]\n }\n \n+output \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ value = concat(aws_db_subnet_group.database.*.name, [\"\"])[0]\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value = aws_subnet.redshift.*.id\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -715,6 +715,7 @@ No Modules.\n | database\\_route\\_table\\_ids | List of IDs of database route tables |\n | database\\_subnet\\_arns | List of ARNs of database subnets |\n | database\\_subnet\\_group | ID of database subnet group |\n+| database\\_subnet\\_group\\_name | Name of database subnet group |\n | database\\_subnets | List of IDs of database subnets |\n | database\\_subnets\\_cidr\\_blocks | List of cidr\\_blocks of database subnets |\n | database\\_subnets\\_ipv6\\_cidr\\_blocks | List of IPv6 cidr\\_blocks of database subnets in an IPv6 enabled VPC |\n---\noutputs.tf\n@@ -133,6 +133,11 @@ output \"database_subnet_group\" {\n value = concat(aws_db_subnet_group.database.*.id, [\"\"])[0]\n }\n \n+output \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ value = concat(aws_db_subnet_group.database.*.name, [\"\"])[0]\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value of = aws_subnet.redshift.*.id\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -715,6 +715,7 @@ No Modules.\n | database\\_route\\_table\\_ids | List of IDs of database route tables |\n | database\\_subnet\\_arns | List of ARNs of database subnets |\n | database\\_subnet\\_group | ID of database subnet group |\n+| database\\_subnet\\_group\\_name | Name of database subnet group |\n | database\\_subnets | List of IDs of database subnets |\n | database\\_subnets\\_cidr\\_blocks | List of cidr\\_blocks of database subnets |\n | database\\_subnets\\_ipv6\\_cidr\\_blocks | List of IPv6 cidr\\_blocks of of subnets in an IPv6 enabled VPC |\n---\noutputs.tf\n@@ -133,6 +133,11 @@ output \"database_subnet_group\" {\n value = concat(aws_db_subnet_group.database.*.id, [\"\"])[0]\n }\n \n+output \"database_subnet_group_name\" {\n+ description = \"Name of database subnet group\"\n+ value = concat(aws_db_subnet_group.database.*.name, [\"\"])[0]\n+}\n+\n output \"redshift_subnets\" {\n description = \"List of IDs of redshift subnets\"\n value = aws_subnet.redshift.*.id\n---\n\n\n---\n" } ]
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:\nThe example uses `[{}]` for the `default_security_group_ingress` and `default_security_group_egress` which causes the issue described in #477. The solution described there has worked for me and several others so this pull request fixes the example so others don't waste time having to figure this out. \r\n\r\n\n\n---\n\nChoice A:\nexamples/complete-vpc/main.tf\n@@ -118,8 +118,8 @@ \"vpc\" {\n \n # Default security group - ingress/egress rules cleared to deny all\n manage_default_security_group = true\n- default_security_group_ingress = [{}]\n- default_security_group_egress = [{}]\n+ default_security_group_ingress = []\n+ default_security_group_egress = []\n \n # VPC Flow Logs (Cloudwatch log group and IAM role will be created)\n enable_flow_log = true\n---\n\n\n---\n\nChoice B:\nexamples/complete-vpc/main.tf\n@@ -118,8 +118,8 @@ module \"vpc\" {\n \n # Default security group - ingress/egress rules cleared to deny all\n manage_default_security_group = true\n- default_security_group_ingress = [{}]\n- default_security_group_egress = [{}]\n+ default_security_group_ingress = []\n+ default_security_group_egress = []\n \n # VPC Flow Logs (Cloudwatch log group and IAM role will be created)\n enable_flow_log = true\n---\n\n\n---\n\nChoice C:\nexamples/complete-vpc/main.tf\n@@ -118,8 +118,8 @@ module \"vpc\" {\n \n # Default security group - ingress/egress rules cleared to deny all\n manage_default_security_group = true\n- default_security_group_ingress = [{}]\n- default_security_group_egress = [{}]\n+ default_security_group_ingress = []\n+ default_security_group_egress = []\n \n # VPC Flow Logs (Cloudwatch log group and IAM role will be created)\n enable_flow_log [{}]\n+ = true\n---\n\n\n---\n\nChoice D:\nexamples/complete-vpc/main.tf\n@@ -118,8 +118,8 @@ module \"vpc\" {\n \n # Default group - ingress/egress rules cleared to deny all\n manage_default_security_group = true\n- default_security_group_ingress = [{}]\n- default_security_group_egress = [{}]\n+ default_security_group_ingress = []\n+ default_security_group_egress = []\n \n # VPC Flow Logs (Cloudwatch log group and IAM role will be created)\n enable_flow_log = true\n---\n\n\n---\n" } ]
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\n- Remove s3/dynamodb service endpoint data sources due to incompatible `service_type` parameter.\r\n- Replace dynamic service name from data sources with template strings\r\n\r\n## Motivation and Context\r\n\r\nAfter this week's release of privatelink for s3, the fixes implemented in v2.69.0 and v2.70.0 don't mitigate errors when using the AWS Terraform provider `v2.X.X`\r\n\r\nAddresses:\r\n\r\n- #582\r\n- #585 \r\n\r\n## Breaking Changes\r\n\r\nThis is a proposed patch release for `v2.69.` which did not resolve the original issue.\r\n\r\n## How Has This Been Tested?\r\n\r\nThis was tested by creating vpc endpoint services with AWS Terraform Provider `2.70.0` and that no error occurred.\r\n\r\n/cc @tbugfinder \r\n\n\n---\n\nChoice A:\nvpc-endpoints.tf\n@@ -1,11 +1,15 @@\n ######################\n # VPC Endpoint for S3\n ######################\n+\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service_type = var.s3_endpoint_type\n- service = \"s3\"\n+ service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [var.s3_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n@@ -45,8 +49,11 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service_type = var.dynamodb_endpoint_type\n- service = \"dynamodb\"\n+ service = \"dynamodb\"\n+ filter {\n+ name = \"service-type\"\n+ values = [var.dynamodb_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n---\n\n\n---\n\nChoice B:\nvpc-endpoints.tf\n@@ -1,11 +1,15 @@\n ######################\n # VPC Endpoint for S3\n ######################\n+\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service_type = var.s3_endpoint_type\n- service = \"s3\"\n+ service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ values = [var.s3_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n@@ -45,8 +49,11 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service_type = var.dynamodb_endpoint_type\n- service = \"dynamodb\"\n+ service = \"dynamodb\"\n+ filter {\n+ = \"service-type\"\n+ values = [var.dynamodb_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n---\n\n\n---\n\nChoice C:\nvpc-endpoints.tf\n@@ -1,11 +1,15 @@\n ######################\n # VPC Endpoint for S3\n ######################\n+\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service_type = var.s3_endpoint_type\n- service = \"s3\"\n+ service = \"s3\"\n+ filter {\n+ name = \"service-type\"\n+ \"aws_vpc_endpoint\" = [var.s3_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n@@ -45,8 +49,11 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service_type = var.dynamodb_endpoint_type\n- service = \"dynamodb\"\n+ service = \"dynamodb\"\n+ filter {\n+ name = \"service-type\"\n+ values = [var.dynamodb_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n---\n\n\n---\n\nChoice D:\nvpc-endpoints.tf\n@@ -1,11 +1,15 @@\n ######################\n # VPC Endpoint for S3\n ######################\n+\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service_type = var.s3_endpoint_type\n- service = \"s3\"\n+ service = \"s3\"\n+ filter {\n+ name = values = [var.s3_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n@@ -45,8 +49,11 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service_type = var.dynamodb_endpoint_type\n- service = \"dynamodb\"\n+ service = \"dynamodb\"\n+ filter {\n+ name = \"service-type\"\n+ values = [var.dynamodb_endpoint_type]\n+ }\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n---\n\n\n---\n" } ]
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…hat modules support the 'count' argument (as of Terraform 0.13).\r\n\r\n## Description\r\nUpdated the 'Conditional Creation' section of the documentation to reflect the fact that Terraform 0.13+ supports the count argument in module blocks (https://www.terraform.io/docs/language/meta-arguments/count.html).\r\n\r\n## Motivation and Context\r\nThe documentation was outdated and didn't fully apply to newer versions of Terraform.\r\n\r\n## Breaking Changes\r\nNo breaking changes.\r\n\r\n## How Has This Been Tested?\r\nI read it, and my IDE has a spellchecker?\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -167,7 +167,7 @@ If your organization requires a permissions boundary to be attached to the VPC F\n \n ## Conditional creation\n \n-Sometimes you need to have a way to create VPC resources conditionally but Terraform does not allow to use `count` inside wish block, so the solution is to specify argument `create_vpc`.\n+Prior to Terraform 0.13, you were unable to specify `count` in a module block. If you wish to toggle the creation of the module's resources in an older (pre 0.13) version of Terraform, you can use the `create_vpc` argument.\n \n ```hcl\n # This VPC will not be created\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -167,7 +167,7 @@ If your organization requires a permissions boundary to be attached to the VPC F\n \n ## Conditional creation\n \n-Sometimes you need to have a way to create VPC resources conditionally but Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_vpc`.\n+Prior to Terraform 0.13, you were unable to specify `count` in a module block. If you wish to toggle the creation of the module's resources in an older (pre 0.13) version of Terraform, you can use the `create_vpc` argument.\n will ```hcl\n # This VPC will not be created\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -167,7 +167,7 @@ If your organization requires a permissions boundary to be attached to the VPC F\n \n ## Conditional creation\n \n-Sometimes you need to have a way to create VPC resources conditionally you Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_vpc`.\n+Prior to Terraform 0.13, you were unable to specify `count` in a module block. If you wish to toggle the creation of the module's resources in an older (pre 0.13) version of Terraform, you can use the `create_vpc` argument.\n \n ```hcl\n # This VPC will not be created\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -167,7 +167,7 @@ If your organization requires a permissions boundary to be attached to the VPC F\n \n ## Conditional creation\n \n-Sometimes you need to have a way to create VPC resources conditionally but Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_vpc`.\n+Prior to Terraform 0.13, you were unable to specify `count` in a module block. If you wish to toggle the creation of the module's resources in an older (pre 0.13) version of Terraform, you can use the `create_vpc` argument.\n \n ```hcl\n # This VPC will not be created\n---\n\n\n---\n" } ]
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\nEnable RDS-DATA endpoint for rds calls via http api \r\n\r\n## Motivation and Context\r\nBecause i needed it\r\n\r\n## Breaking Changes\r\nNo breaking\r\n\r\n## How Has This Been Tested?\r\nYes on my own project\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -467,6 +467,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_public\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | enable\\_qldb\\_session\\_endpoint | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rds\\_endpoint | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_rds\\_data\\_endpoint | Should be true if you want to provision an RDS-Data endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rekognition\\_endpoint | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | enable\\_s3\\_endpoint | Should be true if you want to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | enable\\_sagemaker\\_api\\_endpoint | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -575,6 +576,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rds\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | rds\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | rds\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for RDS-Data endpoint | `bool` | `false` | no |\n+| rds\\_data\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for RDS-Data endpoint | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS-Data endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | redshift\\_acl\\_tags | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n | redshift\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | redshift\\_inbound\\_acl\\_rules | Redshift subnets inbound network ACL rules | `list(map(string))` | <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---\nvariables.tf\n@@ -1829,6 +1829,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1421,6 +1421,26 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -467,6 +467,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_public\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | enable\\_qldb\\_session\\_endpoint | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rds\\_endpoint | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_rds\\_data\\_endpoint | Should be true if you want to provision an RDS-Data endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rekognition\\_endpoint | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | enable\\_s3\\_endpoint | Should be true if you want to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | enable\\_sagemaker\\_api\\_endpoint | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -575,6 +576,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rds\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | rds\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | rds\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for RDS-Data endpoint | `bool` | `false` | no |\n+| rds\\_data\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for RDS-Data endpoint | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS-Data endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | redshift\\_acl\\_tags | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n | redshift\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | redshift\\_inbound\\_acl\\_rules | Redshift subnets inbound network ACL rules | `list(map(string))` | <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---\nvariables.tf\n@@ -1829,6 +1829,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1421,6 +1421,26 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids |\n+| = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -467,6 +467,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_public\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | enable\\_qldb\\_session\\_endpoint | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rds\\_endpoint | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_rds\\_data\\_endpoint | Should be true if you want to provision an RDS-Data endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rekognition\\_endpoint | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | enable\\_s3\\_endpoint | Should be true if you want to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | enable\\_sagemaker\\_api\\_endpoint | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -575,6 +576,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rds\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | rds\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | rds\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for RDS-Data endpoint | `bool` | `false` | no |\n+| rds\\_data\\_endpoint\\_security\\_group\\_ids | an ID of one or more security groups to associate with the network interface for RDS-Data endpoint | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS-Data endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | redshift\\_acl\\_tags | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n | redshift\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | redshift\\_inbound\\_acl\\_rules | Redshift subnets inbound network ACL rules | `list(map(string))` | <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---\nvariables.tf\n@@ -1829,6 +1829,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1421,6 +1421,26 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -467,6 +467,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_public\\_s3\\_endpoint | Whether to enable S3 VPC Endpoint for public subnets | `bool` | `true` | no |\n | enable\\_qldb\\_session\\_endpoint | Should be true if you want to provision an QLDB Session endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rds\\_endpoint | Should be true if you want to provision an RDS endpoint to the VPC | `bool` | `false` | no |\n+| enable\\_rds\\_data\\_endpoint | Should be true if you want to provision an RDS-Data endpoint to the VPC | `bool` | `false` | no |\n | enable\\_rekognition\\_endpoint | Should be true if you want to provision a Rekognition endpoint to the VPC | `bool` | `false` | no |\n | enable\\_s3\\_endpoint | Should be true if you want to provision an S3 endpoint to the VPC | `bool` | `false` | no |\n | enable\\_sagemaker\\_api\\_endpoint | Should be true if you want to provision a SageMaker API endpoint to the VPC | `bool` | `false` | no |\n@@ -575,6 +576,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rds\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for RDS endpoint | `bool` | `false` | no |\n | rds\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for RDS endpoint | `list(string)` | `[]` | no |\n | rds\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC false\n RDS-Data endpoint | `bool` | `false` | no |\n+| rds\\_data\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for RDS-Data endpoint | `list(string)` | `[]` | no |\n+| rds\\_data\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for RDS-Data endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | redshift\\_acl\\_tags | Additional tags for the redshift subnets network ACL | `map(string)` | `{}` | no |\n | redshift\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for redshift subnets | `bool` | `false` | no |\n | redshift\\_inbound\\_acl\\_rules | Redshift subnets inbound network ACL rules | `list(map(string))` | <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---\nvariables.tf\n@@ -1829,6 +1829,30 @@ variable \"rds_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_rds_data_endpoint\" {\n+ description = \"Should be true if you want to provision an RDS-DATA endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"rds_data_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for RDS-DATA endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for RDS-DATA endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"rds_data_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for RDS-DATA endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"enable_codedeploy_endpoint\" {\n description = \"Should be true if you want to provision an CodeDeploy endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1421,6 +1421,26 @@ resource \"aws_vpc_endpoint\" \"rds\" {\n tags = local.vpce_tags\n }\n \n+data \"aws_vpc_endpoint_service\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ service = \"rds-data\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"rds_data\" {\n+ count = var.create_vpc && var.enable_rds_data_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.rds_data[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.rds_data_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.rds_data_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.rds_data_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n+\n #############################\n # VPC Endpoint for CodeDeploy\n #############################\n---\n\n\n---\n" } ]
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:\nRelated to #573 since VPC endpoint service_type became available in AWS provider version 3.10.\n\n---\n\nChoice A:\nREADME.md\n@@ -229,13 +229,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/README.md\n@@ -22,13 +22,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= that }\n }\n }\n---\nexamples/ipv6/README.md\n@@ -20,13 +20,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/ipv6/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-44-asymmetric-private-subnets/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/manage-default-vpc/README.md\n@@ -22,7 +22,7 @@ Run `terraform destroy` when you don't need these resources.\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/manage-default-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/network-acls/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/network-acls/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/simple-vpc/README.md\n@@ -26,7 +26,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/simple-vpc/main.tf\n@@ -15,7 +15,7 @@ module \"vpc\" {\n \n enable_ipv6 = true\n \n- enable_nat_gateway = true\n+ enable_nat_gateway = false\n single_nat_gateway = true\n \n # s3_endpoint_type = \"Interface\"\n---\nexamples/simple-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,14 +24,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Inputs\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -2,7 +2,14 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n- random = \">= 2\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n+\n+ random = {\n+ source = \"hashicorp/random\"\n+ version = \">= 2\"\n+ }\n }\n }\n---\nversions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -229,13 +229,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/README.md\n@@ -22,13 +22,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/ipv6/README.md\n@@ -20,13 +20,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/ipv6/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ \"hashicorp/aws\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-44-asymmetric-private-subnets/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/manage-default-vpc/README.md\n@@ -22,7 +22,7 @@ Run `terraform destroy` when you don't need these resources.\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/manage-default-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/network-acls/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/network-acls/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/simple-vpc/README.md\n@@ -26,7 +26,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/simple-vpc/main.tf\n@@ -15,7 +15,7 @@ module \"vpc\" {\n \n enable_ipv6 = true\n \n- enable_nat_gateway = true\n+ enable_nat_gateway = false\n single_nat_gateway = true\n \n # s3_endpoint_type = \"Interface\"\n---\nexamples/simple-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,14 +24,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Inputs\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -2,7 +2,14 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n- random = \">= 2\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n+\n+ random = {\n+ source = \"hashicorp/random\"\n+ version = \">= 2\"\n+ }\n }\n }\n---\nversions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -229,13 +229,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/README.md\n@@ -22,13 +22,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/ipv6/README.md\n@@ -20,13 +20,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/ipv6/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n >= -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/manage-default-vpc/README.md\n@@ -22,7 +22,7 @@ Run `terraform destroy` when you don't need these resources.\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/manage-default-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/network-acls/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/network-acls/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/simple-vpc/README.md\n@@ -26,7 +26,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/simple-vpc/main.tf\n@@ -15,7 +15,7 @@ module \"vpc\" {\n \n enable_ipv6 = true\n \n- enable_nat_gateway = true\n+ enable_nat_gateway = false\n single_nat_gateway = true\n \n # s3_endpoint_type = \"Interface\"\n---\nexamples/simple-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,14 +24,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Inputs\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -2,7 +2,14 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n- random = \">= 2\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n+\n+ random = {\n+ source = \"hashicorp/random\"\n+ version = \">= 2\"\n+ }\n }\n }\n---\nversions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -229,13 +229,13 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/README.md\n@@ -22,13 +22,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/complete-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/ipv6/README.md\n@@ -20,13 +20,13 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Inputs\n \n---\nexamples/ipv6/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-108-route-already-exists/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-108-route-already-exists/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-44-asymmetric-private-subnets/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-44-asymmetric-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/issue-46-no-private-subnets/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/issue-46-no-private-subnets/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/manage-default-vpc/README.md\n@@ -22,7 +22,7 @@ Run `terraform destroy` when you don't need these resources.\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/manage-default-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/network-acls/README.md\n@@ -24,7 +24,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/network-acls/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/secondary-cidr-blocks/README.md\n@@ -22,7 +22,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/secondary-cidr-blocks/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/simple-vpc/README.md\n@@ -26,7 +26,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n \n ## Providers\n \n---\nexamples/simple-vpc/main.tf\n@@ -15,7 +15,7 @@ module \"vpc\" {\n \n enable_ipv6 = true\n \n- enable_nat_gateway = true\n+ enable_nat_gateway = false\n single_nat_gateway = true\n \n # s3_endpoint_type = \"Interface\"\n---\nexamples/simple-vpc/versions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\nexamples/vpc-flow-logs/README.md\n@@ -24,14 +24,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP\n | Name | Version |\n |------|---------|\n | terraform | >= 0.12.21 |\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Providers\n \n | Name | Version |\n |------|---------|\n-| aws | >= 2.68 |\n+| aws | >= 3.10 |\n | random | >= 2 |\n \n ## Inputs\n---\nexamples/vpc-flow-logs/versions.tf\n@@ -2,7 +2,14 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n- random = \">= 2\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n+\n+ random = {\n+ source = \"hashicorp/random\"\n+ version = \">= 2\"\n+ }\n }\n }\n---\nversions.tf\n@@ -2,6 +2,9 @@ terraform {\n required_version = \">= 0.12.21\"\n \n required_providers {\n- aws = \">= 2.68\"\n+ aws = {\n+ source = \"hashicorp/aws\"\n+ version = \">= 3.10\"\n+ }\n }\n }\n---\n\n\n---\n" } ]
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## Description\r\n<!--- Describe your changes in detail -->\r\nCorrectly filter S3 endpoint based on the type of endpoint.\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\nThis is now required because AWS seems to have added a new endpoint Interface for S3. If you don't filter the datasource for S3 endpoint on type, Terraform will fail because it will return multiple VPC endpoints\r\n`Error: multiple VPC Endpoint Services matched; use additional constraints to reduce matches to a single VPC Endpoint Service`\r\n\r\nFix https://github.com/terraform-aws-modules/terraform-aws-vpc/issues/571\r\n\r\n## Breaking Changes\r\n<!-- 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<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -19,7 +19,7 @@ These types of resources are supported:\n * [VPC Flow Log](https://www.terraform.io/docs/providers/aws/r/flow_log.html)\n * [VPC Endpoint](https://www.terraform.io/docs/providers/aws/r/vpc_endpoint.html):\n * Gateway: S3, DynamoDB\n- * Interface: EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n+ * Interface: S3, EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n ECS, ECS Agent, ECS Telemetry, SES, SNS, STS, Glue, CloudWatch(Monitoring, Logs, Events),\n Elastic Load Balancing, CloudTrail, Secrets Manager, Config, Codeartifact(API, Repositories), CodeBuild, CodeCommit,\n Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, SageMaker(Notebook, Runtime, API),\n@@ -353,6 +353,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n | dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n | dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| dynamodb\\_endpoint\\_type | DynamoDB VPC endpoint type | `string` | `\"Gateway\"` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -589,6 +590,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rekognition\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for Rekognition endpoint | `list(string)` | `[]` | no |\n | rekognition\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for Rekognition endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | reuse\\_nat\\_ips | Should be true if you don't want EIPs to be created for your NAT Gateways and will instead pass them in via the 'external\\_nat\\_ip\\_ids' variable | `bool` | `false` | no |\n+| s3\\_endpoint\\_type | S3 VPC endpoint type | `string` | `\"Gateway\"` | no |\n | sagemaker\\_api\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SageMaker API endpoint | `bool` | `false` | no |\n | sagemaker\\_api\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SageMaker API endpoint | `list(string)` | `[]` | no |\n | sagemaker\\_api\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SageMaker API endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nexamples/simple-vpc/main.tf\n@@ -18,6 +18,11 @@ module \"vpc\" {\n enable_nat_gateway = true\n single_nat_gateway = true\n \n+ # s3_endpoint_type = \"Interface\"\n+\n+ enable_s3_endpoint = true\n+ enable_dynamodb_endpoint = true\n+\n public_subnet_tags = {\n Name = \"overridden-name-public\"\n }\n---\nvariables.tf\n@@ -316,12 +316,24 @@ variable \"enable_dynamodb_endpoint\" {\n default = false\n }\n \n+variable \"dynamodb_endpoint_type\" {\n+ description = \"DynamoDB VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_s3_endpoint\" {\n description = \"Should be true if you want to provision an S3 endpoint to the VPC\"\n type = bool\n default = false\n }\n \n+variable \"s3_endpoint_type\" {\n+ description = \"S3 VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_codeartifact_api_endpoint\" {\n description = \"Should be true if you want to provision an Codeartifact API endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -4,15 +4,18 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service = \"s3\"\n+ service_type = var.s3_endpoint_type\n+ service = \"s3\"\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n- tags = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ vpc_endpoint_type = var.s3_endpoint_type\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n@@ -42,15 +45,18 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service = \"dynamodb\"\n+ service_type = var.dynamodb_endpoint_type\n+ service = \"dynamodb\"\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n- tags = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ vpc_endpoint_type = var.dynamodb_endpoint_type\n+ service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -19,7 +19,7 @@ These types of resources are supported:\n * [VPC Flow Log](https://www.terraform.io/docs/providers/aws/r/flow_log.html)\n * [VPC Endpoint](https://www.terraform.io/docs/providers/aws/r/vpc_endpoint.html):\n * Gateway: S3, DynamoDB\n- * Interface: EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n+ * Interface: S3, EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n ECS, ECS Agent, ECS Telemetry, SES, SNS, STS, Glue, CloudWatch(Monitoring, Logs, Events),\n Elastic Load Balancing, CloudTrail, Secrets Manager, Config, Codeartifact(API, Repositories), CodeBuild, CodeCommit,\n Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, SageMaker(Notebook, Runtime, API),\n@@ -353,6 +353,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n | dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n | dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| dynamodb\\_endpoint\\_type | DynamoDB VPC endpoint type | `string` | `\"Gateway\"` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -589,6 +590,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rekognition\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for Rekognition endpoint | `list(string)` | `[]` | no |\n | rekognition\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for Rekognition endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | reuse\\_nat\\_ips | Should be true if you don't want EIPs to be for your NAT Gateways and will instead pass them in via the 'external\\_nat\\_ip\\_ids' variable | `bool` | `false` | no |\n+| s3\\_endpoint\\_type | S3 VPC endpoint type | `string` | `\"Gateway\"` | no |\n | sagemaker\\_api\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SageMaker API endpoint | `bool` | `false` | no |\n | sagemaker\\_api\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SageMaker API endpoint | `list(string)` | `[]` | no |\n | sagemaker\\_api\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SageMaker API endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nexamples/simple-vpc/main.tf\n@@ -18,6 +18,11 @@ module \"vpc\" {\n enable_nat_gateway = true\n single_nat_gateway = true\n \n+ # s3_endpoint_type = \"Interface\"\n+\n+ enable_s3_endpoint = true\n+ enable_dynamodb_endpoint = true\n+\n public_subnet_tags = {\n Name = \"overridden-name-public\"\n }\n---\nvariables.tf\n@@ -316,12 +316,24 @@ variable \"enable_dynamodb_endpoint\" {\n default = false\n }\n \n+variable \"dynamodb_endpoint_type\" {\n+ description = \"DynamoDB VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_s3_endpoint\" {\n description = \"Should be true if you want to provision an S3 endpoint to the VPC\"\n type = bool\n default = false\n }\n \n+variable \"s3_endpoint_type\" {\n+ description = \"S3 VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_codeartifact_api_endpoint\" {\n description = \"Should be true if you want to provision an Codeartifact API endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -4,15 +4,18 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service = \"s3\"\n+ service_type = var.s3_endpoint_type\n+ service = \"s3\"\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n- tags = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ vpc_endpoint_type = var.s3_endpoint_type\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n@@ -42,15 +45,18 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service = \"dynamodb\"\n+ service_type = var.dynamodb_endpoint_type\n+ service = \"dynamodb\"\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n- tags = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ vpc_endpoint_type = var.dynamodb_endpoint_type\n+ service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -19,7 endpoint @@ These types of resources are supported:\n * [VPC Flow Log](https://www.terraform.io/docs/providers/aws/r/flow_log.html)\n * [VPC Endpoint](https://www.terraform.io/docs/providers/aws/r/vpc_endpoint.html):\n * Gateway: S3, DynamoDB\n- * Interface: EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n+ * Interface: S3, EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n ECS, ECS Agent, ECS Telemetry, SES, SNS, STS, Glue, CloudWatch(Monitoring, Logs, Events),\n Elastic Load Balancing, CloudTrail, Secrets Manager, Config, Codeartifact(API, Repositories), CodeBuild, CodeCommit,\n Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, SageMaker(Notebook, Runtime, API),\n@@ -353,6 +353,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n | dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n | dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| dynamodb\\_endpoint\\_type | DynamoDB VPC endpoint type | `string` | `\"Gateway\"` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -589,6 +590,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rekognition\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for Rekognition endpoint | `list(string)` | `[]` | no |\n | rekognition\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for Rekognition endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | reuse\\_nat\\_ips | Should be true if you don't want EIPs to be created for your NAT Gateways and will instead pass them in via the 'external\\_nat\\_ip\\_ids' variable | `bool` | `false` | no |\n+| s3\\_endpoint\\_type | S3 VPC endpoint type | `string` | `\"Gateway\"` | no |\n | sagemaker\\_api\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SageMaker API endpoint | `bool` | `false` | no |\n | sagemaker\\_api\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SageMaker API endpoint | `list(string)` | `[]` | no |\n | sagemaker\\_api\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SageMaker API endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nexamples/simple-vpc/main.tf\n@@ -18,6 +18,11 @@ module \"vpc\" {\n enable_nat_gateway = true\n single_nat_gateway = true\n \n+ # s3_endpoint_type = \"Interface\"\n+\n+ enable_s3_endpoint = true\n+ enable_dynamodb_endpoint = true\n+\n public_subnet_tags = {\n Name = \"overridden-name-public\"\n }\n---\nvariables.tf\n@@ -316,12 +316,24 @@ variable \"enable_dynamodb_endpoint\" {\n default = false\n }\n \n+variable \"dynamodb_endpoint_type\" {\n+ description = \"DynamoDB VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_s3_endpoint\" {\n description = \"Should be true if you want to provision an S3 endpoint to the VPC\"\n type = bool\n default = false\n }\n \n+variable \"s3_endpoint_type\" {\n+ description = \"S3 VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_codeartifact_api_endpoint\" {\n description = \"Should be true if you want to provision an Codeartifact API endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -4,15 +4,18 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service = \"s3\"\n+ service_type = var.s3_endpoint_type\n+ service = \"s3\"\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n- tags = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ vpc_endpoint_type = var.s3_endpoint_type\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n@@ -42,15 +45,18 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service = \"dynamodb\"\n+ service_type = var.dynamodb_endpoint_type\n+ service = \"dynamodb\"\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n- tags = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ vpc_endpoint_type = var.dynamodb_endpoint_type\n+ service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -19,7 +19,7 @@ These types of resources are supported:\n * [VPC Flow Log](https://www.terraform.io/docs/providers/aws/r/flow_log.html)\n * [VPC Endpoint](https://www.terraform.io/docs/providers/aws/r/vpc_endpoint.html):\n * Gateway: S3, DynamoDB\n- * Interface: EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n+ * Interface: S3, EC2, SSM, EC2 Messages, SSM Messages, SQS, ECR API, ECR DKR, API Gateway, KMS,\n ECS, ECS Agent, ECS Telemetry, SES, SNS, STS, Glue, CloudWatch(Monitoring, Logs, Events),\n Elastic Load Balancing, CloudTrail, Secrets Manager, Config, Codeartifact(API, Repositories), CodeBuild, CodeCommit,\n Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, SageMaker(Notebook, Runtime, API),\n@@ -353,6 +353,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n | dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n | dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n+| dynamodb\\_endpoint\\_type | DynamoDB VPC endpoint type | `string` | `\"Gateway\"` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -589,6 +590,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | rekognition\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for Rekognition endpoint | `list(string)` | `[]` | no |\n | rekognition\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for Rekognition endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | reuse\\_nat\\_ips | Should be true if you don't want EIPs to be created for your NAT Gateways and will instead pass them in via the 'external\\_nat\\_ip\\_ids' variable | `bool` | `false` | no |\n+| s3\\_endpoint\\_type | S3 VPC endpoint type | `string` | `\"Gateway\"` | no |\n | sagemaker\\_api\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for SageMaker API endpoint | `bool` | `false` | no |\n | sagemaker\\_api\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for SageMaker API endpoint | `list(string)` | `[]` | no |\n | sagemaker\\_api\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for SageMaker API endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n---\nexamples/simple-vpc/main.tf\n@@ -18,6 +18,11 @@ module \"vpc\" {\n enable_nat_gateway = true\n single_nat_gateway = true\n \n+ # s3_endpoint_type = \"Interface\"\n+\n+ enable_s3_endpoint = true\n+ enable_dynamodb_endpoint = true\n+\n public_subnet_tags = {\n Name = \"overridden-name-public\"\n }\n---\nvariables.tf\n@@ -316,12 +316,24 @@ variable \"enable_dynamodb_endpoint\" {\n default = false\n }\n \n+variable \"dynamodb_endpoint_type\" {\n+ description = \"DynamoDB VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_s3_endpoint\" {\n description = \"Should be true if you want to provision an S3 endpoint to the VPC\"\n type = bool\n default = false\n }\n \n+variable \"s3_endpoint_type\" {\n+ description = \"S3 VPC endpoint type\"\n+ type = string\n+ default = \"Gateway\"\n+}\n+\n variable \"enable_codeartifact_api_endpoint\" {\n description = \"Should be true if you want to provision an Codeartifact API endpoint to the VPC\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -4,15 +4,18 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service = \"s3\"\n+ service_type = var.s3_endpoint_type\n+ service = \"s3\"\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n- tags = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.s3[0].service_name\n+ vpc_endpoint_type = var.s3_endpoint_type\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_s3\" {\n@@ -42,15 +45,18 @@ resource \"aws_vpc_endpoint_route_table_association\" \"public_s3\" {\n data \"aws_vpc_endpoint_service\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- service = \"dynamodb\"\n+ service_type = var.dynamodb_endpoint_type\n+ service = \"dynamodb\"\n }\n \n resource \"aws_vpc_endpoint\" \"dynamodb\" {\n count = var.create_vpc && var.enable_dynamodb_endpoint ? 1 : 0\n \n- vpc_id = local.vpc_id\n- service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n- tags a = local.vpce_tags\n+ vpc_id = local.vpc_id\n+ vpc_endpoint_type = var.dynamodb_endpoint_type\n+ service_name = data.aws_vpc_endpoint_service.dynamodb[0].service_name\n+\n+ tags = local.vpce_tags\n }\n \n resource \"aws_vpc_endpoint_route_table_association\" \"private_dynamodb\" {\n---\n\n\n---\n" } ]
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\nAWS has some kind of bug on vpc endpoint service S3. S3 should be a \"gateway\" service however \"gateway\" and \"interface\" services shows up. This cause terraform to fail with the following error:\r\n\r\n`Error: multiple VPC Endpoint Services matched; use additional constraints to reduce matches to a single VPC Endpoint Service`\r\n\r\nMultiple S3 endpoint service (tested region: eu-central-1, eu-west-1)\r\n<img width=\"760\" alt=\"Screenshot 2021-02-02 at 19 35 45\" src=\"https://user-images.githubusercontent.com/51825189/106648303-63438f00-6590-11eb-9f94-4de9bfeea9a5.png\">\r\n\r\n## Motivation and Context\r\nI made this PR to able to deploy this able to deploy terraform code.\r\n\n\n---\n\nChoice A:\nvpc-endpoints.tf\n@@ -4,7 +4,9 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service = \"s3\"\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+\n }\n \n resource \"aws_vpc_endpoint\" {\n---\n\n\n---\n\nChoice B:\nvpc-endpoints.tf\n@@ -4,7 +4,9 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- = \"s3\"\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice C:\nvpc-endpoints.tf\n@@ -4,7 +4,9 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service = \"s3\"\n+ service service = \"s3\"\n+ service_type = \"Gateway\"\n+\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n\nChoice D:\nvpc-endpoints.tf\n@@ -4,7 +4,9 @@\n data \"aws_vpc_endpoint_service\" \"s3\" {\n count = var.create_vpc && var.enable_s3_endpoint ? 1 : 0\n \n- service = \"s3\"\n+ service = \"s3\"\n+ service_type = \"Gateway\"\n+\n }\n \n resource \"aws_vpc_endpoint\" \"s3\" {\n---\n\n\n---\n" } ]
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<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice B:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && -1535,7 ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice C:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 {\n- resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice D:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n" } ]
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\nSorry Anton,\r\nThere was a bug in the dms endpoint code\n\n---\n\nChoice A:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration \"codeartifact_repositories\" #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice B:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice C:\nvar.enable_dms_endpoint -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice D:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n = \"dms\"\n }\n---\n\n\n---\n" } ]
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:\nFixed #565\n\n---\n\nChoice A:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && data ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice B:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n }\n---\n VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n\nChoice C:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n && = \"dms\"\n }\n---\n\n\n---\n\nChoice D:\nvpc-endpoints.tf\n@@ -1535,7 +1535,7 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n # VPC Endpoint for Database Migration Service\n #############################################\n data \"aws_vpc_endpoint_service\" \"dms\" {\n- count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n \n service = \"dms\"\n }\n---\n\n\n---\n" } ]
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\nAdding missing DMS endpoint\r\n\r\n## Motivation and Context\r\nDMS endpoint is missing\n\n---\n\nChoice A:\nREADME.md\n@@ -26,7 +26,7 @@ Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, Sa\n CloudFormation, CodePipeline, Storage Gateway, AppMesh, Transfer, Service Catalog, AppStream API, AppStream Streaming,\n Athena, Rekognition, Elastic File System (EFS), Cloud Directory, Elastic Beanstalk (+ Health), Elastic Map Reduce(EMR),\n DataSync, EBS, SMS, Elastic Inference Runtime, QLDB Session, Step Functions, Access Analyzer, Auto Scaling Plans,\n-Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure\n+Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure, DMS\n \n * [RDS DB Subnet Group](https://www.terraform.io/docs/providers/aws/r/db_subnet_group.html)\n * [ElastiCache Subnet Group](https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html)\n@@ -350,6 +350,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dhcp\\_options\\_netbios\\_node\\_type | Specify netbios node\\_type for DHCP options set (requires enable\\_dhcp\\_options set to true) | `string` | `\"\"` | no |\n | dhcp\\_options\\_ntp\\_servers | Specify a list of NTP servers for DHCP options set (requires enable\\_dhcp\\_options set to true) | `list(string)` | `[]` | no |\n | dhcp\\_options\\_tags | Additional tags for the DHCP option set (requires enable\\_dhcp\\_options set to true) | `map(string)` | `{}` | no |\n+| dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n+| dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n+| dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -428,6 +431,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n+| enable\\_dms\\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dns\\_hostnames | Should be true to enable DNS hostnames in the VPC | `bool` | `false` | no |\n | enable\\_dns\\_support | Should be true to enable DNS support in the VPC | `bool` | `true` | no |\n | enable\\_dynamodb\\_endpoint | Should be true if you want to provision a DynamoDB endpoint to the VPC | `bool` | `false` | no |\n@@ -799,6 +803,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_datasync\\_dns\\_entry | The DNS entries for the VPC Endpoint for DataSync. |\n | vpc\\_endpoint\\_datasync\\_id | The ID of VPC endpoint for DataSync |\n | vpc\\_endpoint\\_datasync\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DataSync. |\n+| vpc\\_endpoint\\_dms\\_dns\\_entry | The DNS entries for the VPC Endpoint for DMS. |\n+| vpc\\_endpoint\\_dms\\_id | The ID of VPC endpoint for DMS |\n+| vpc\\_endpoint\\_dms\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DMS. |\n | vpc\\_endpoint\\_dynamodb\\_id | The ID of VPC endpoint for DynamoDB |\n | vpc\\_endpoint\\_dynamodb\\_pl\\_id | The prefix list for the DynamoDB VPC endpoint. |\n | vpc\\_endpoint\\_ebs\\_dns\\_entry | The DNS entries for the VPC Endpoint for EBS. |\n---\noutputs.tf\n@@ -1407,6 +1407,21 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_dms_id\" {\n+ description = \"The ID of VPC endpoint for DMS\"\n+ value = concat(aws_vpc_endpoint.sns.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_dms_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_dms_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_rds_id\" {\n description = \"The ID of VPC endpoint for RDS\"\n value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n@@ -1422,7 +1437,6 @@ output \"vpc_endpoint_rds_dns_entry\" {\n value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n }\n \n-\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\nvariables.tf\n@@ -1883,6 +1883,30 @@ variable \"acm_pca_endpoint_private_dns_enabled\" {\n default = false\n }\n = \"enable_dms_endpoint\" {\n+ description = \"Should be true if you want to provision a DMS endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"dms_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for DMS endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"map_public_ip_on_launch\" {\n description = \"Should be false if you do not want to auto-assign public IP on launch\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1529,3 +1529,27 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n \n tags = local.vpce_tags\n }\n+\n+\n+#############################################\n+# VPC Endpoint for Database Migration Service\n+#############################################\n+data \"aws_vpc_endpoint_service\" \"dms\" {\n+ count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+\n+ service = \"dms\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"dms\" {\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.dms[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.dms_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.dms_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.dms_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -26,7 +26,7 @@ Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, Sa\n CloudFormation, CodePipeline, Storage Gateway, AppMesh, Transfer, Service Catalog, AppStream API, AppStream Streaming,\n Athena, Rekognition, Elastic File System (EFS), Cloud Directory, Elastic Beanstalk (+ Health), Elastic Map Reduce(EMR),\n DataSync, EBS, SMS, Elastic Inference Runtime, QLDB Session, Step Functions, Access Analyzer, Auto Scaling Plans,\n-Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure\n+Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure, DMS\n \n * [RDS DB Subnet Group](https://www.terraform.io/docs/providers/aws/r/db_subnet_group.html)\n * [ElastiCache Subnet Group](https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html)\n@@ -350,6 +350,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dhcp\\_options\\_netbios\\_node\\_type | Specify netbios node\\_type for DHCP options set (requires enable\\_dhcp\\_options set to true) | `string` | `\"\"` | no |\n | dhcp\\_options\\_ntp\\_servers | Specify a list of NTP servers for DHCP options set (requires enable\\_dhcp\\_options set to true) | `list(string)` | `[]` | no |\n | dhcp\\_options\\_tags | Additional tags for the DHCP set (requires enable\\_dhcp\\_options set to true) | `map(string)` | `{}` | no |\n+| dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n+| dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n+| dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -428,6 +431,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n+| enable\\_dms\\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dns\\_hostnames | Should be true to enable DNS hostnames in the VPC | `bool` | `false` | no |\n | enable\\_dns\\_support | Should be true to enable DNS support in the VPC | `bool` | `true` | no |\n | enable\\_dynamodb\\_endpoint | Should be true if you want to provision a DynamoDB endpoint to the VPC | `bool` | `false` | no |\n@@ -799,6 +803,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_datasync\\_dns\\_entry | The DNS entries for the VPC Endpoint for DataSync. |\n | vpc\\_endpoint\\_datasync\\_id | The ID of VPC endpoint for DataSync |\n | vpc\\_endpoint\\_datasync\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DataSync. |\n+| vpc\\_endpoint\\_dms\\_dns\\_entry | The DNS entries for the VPC Endpoint for DMS. |\n+| vpc\\_endpoint\\_dms\\_id | The ID of VPC endpoint for DMS |\n+| vpc\\_endpoint\\_dms\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DMS. |\n | vpc\\_endpoint\\_dynamodb\\_id | The ID of VPC endpoint for DynamoDB |\n | vpc\\_endpoint\\_dynamodb\\_pl\\_id | The prefix list for the DynamoDB VPC endpoint. |\n | vpc\\_endpoint\\_ebs\\_dns\\_entry | The DNS entries for the VPC Endpoint for EBS. |\n---\noutputs.tf\n@@ -1407,6 +1407,21 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_dms_id\" {\n+ description = \"The ID of VPC endpoint for DMS\"\n+ value = concat(aws_vpc_endpoint.sns.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_dms_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_dms_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_rds_id\" {\n description = \"The ID of VPC endpoint for RDS\"\n value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n@@ -1422,7 +1437,6 @@ output \"vpc_endpoint_rds_dns_entry\" {\n value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n }\n \n-\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\nvariables.tf\n@@ -1883,6 +1883,30 @@ variable \"acm_pca_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_dms_endpoint\" {\n+ description = \"Should be true if you want to provision a DMS endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"dms_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for DMS endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"map_public_ip_on_launch\" {\n description = \"Should be false if you do not want to auto-assign public IP on launch\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1529,3 +1529,27 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n \n tags = local.vpce_tags\n }\n+\n+\n+#############################################\n+# VPC Endpoint for Database Migration Service\n+#############################################\n+data \"aws_vpc_endpoint_service\" \"dms\" {\n+ count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+\n+ service = \"dms\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"dms\" {\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.dms[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.dms_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.dms_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.dms_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -26,7 +26,7 @@ Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, Sa\n CloudFormation, CodePipeline, Storage Gateway, AppMesh, Transfer, Service Catalog, AppStream API, AppStream Streaming,\n Athena, Rekognition, Elastic File System (EFS), Cloud Directory, Elastic Beanstalk (+ Health), Elastic Map Reduce(EMR),\n DataSync, EBS, SMS, Elastic Inference Runtime, QLDB Session, Step Functions, Access Analyzer, Auto Scaling Plans,\n-Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure\n+Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure, DMS\n \n * [RDS DB Subnet Group](https://www.terraform.io/docs/providers/aws/r/db_subnet_group.html)\n * [ElastiCache Subnet Group](https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html)\n@@ -350,6 +350,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dhcp\\_options\\_netbios\\_node\\_type | Specify netbios node\\_type for DHCP options set (requires enable\\_dhcp\\_options set to true) | `string` | `\"\"` | no |\n | dhcp\\_options\\_ntp\\_servers | Specify a list of NTP servers for DHCP options set (requires enable\\_dhcp\\_options set to true) | `list(string)` | `[]` | no |\n | dhcp\\_options\\_tags | Additional tags for the DHCP option set (requires enable\\_dhcp\\_options set to true) | `map(string)` | `{}` | no |\n+| dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n+| dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n+| dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -428,6 +431,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n+| enable\\_dms\\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dns\\_hostnames | Should be true to enable DNS hostnames in the VPC | `bool` | `false` | no |\n | enable\\_dns\\_support | Should be true to enable DNS support in the VPC | `bool` | `true` | no |\n | enable\\_dynamodb\\_endpoint | Should be true if you want to provision a DynamoDB endpoint to the VPC | `bool` | `false` | no |\n@@ -799,6 +803,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_datasync\\_dns\\_entry | The DNS entries for the VPC Endpoint for DataSync. |\n | vpc\\_endpoint\\_datasync\\_id | The ID of VPC endpoint for DataSync |\n | vpc\\_endpoint\\_datasync\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DataSync. |\n+| vpc\\_endpoint\\_dms\\_dns\\_entry | The DNS entries for the VPC Endpoint for DMS. |\n+| vpc\\_endpoint\\_dms\\_id | The ID of VPC endpoint for DMS |\n+| vpc\\_endpoint\\_dms\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DMS. |\n | vpc\\_endpoint\\_dynamodb\\_id | The ID of VPC endpoint for DynamoDB |\n | vpc\\_endpoint\\_dynamodb\\_pl\\_id | The prefix list for the DynamoDB VPC endpoint. |\n | vpc\\_endpoint\\_ebs\\_dns\\_entry | The DNS entries for the VPC Endpoint for EBS. |\n---\noutputs.tf\n@@ -1407,6 +1407,21 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_dms_id\" {\n+ description = \"The ID of VPC endpoint for DMS\"\n+ value = concat(aws_vpc_endpoint.sns.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_dms_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_dms_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_rds_id\" {\n description = \"The ID of VPC endpoint for RDS\"\n value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n@@ -1422,7 +1437,6 @@ output \"vpc_endpoint_rds_dns_entry\" {\n value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n }\n \n-\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\nvariables.tf\n@@ -1883,6 +1883,30 @@ variable \"acm_pca_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_dms_endpoint\" {\n+ description = \"Should be true if you want to provision a DMS endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"dms_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for DMS endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"map_public_ip_on_launch\" {\n description = \"Should be false if you do not want to auto-assign public IP on launch\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1529,3 +1529,27 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n \n tags = local.vpce_tags\n }\n+\n+\n+#############################################\n+# VPC Endpoint for Database Migration Service\n+#############################################\n+data \"aws_vpc_endpoint_service\" \"dms\" {\n+ count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+\n+ service = \"dms\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"dms\" {\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.dms[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.dms_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.dms_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.dms_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -26,7 +26,7 @@ Git-Codecommit, Textract, Transfer Server, Kinesis Streams, Kinesis Firehose, Sa\n CloudFormation, CodePipeline, Storage Gateway, AppMesh, Transfer, Service Catalog, AppStream API, AppStream Streaming,\n Athena, Rekognition, Elastic File System (EFS), Cloud Directory, Elastic Beanstalk (+ Health), Elastic Map Reduce(EMR),\n DataSync, EBS, SMS, Elastic Inference Runtime, QLDB Session, Step Functions, Access Analyzer, Auto Scaling Plans,\n-Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure\n+Application Auto Scaling, Workspaces, ACM PCA, RDS, CodeDeploy, CodeDeploy Commands Secure, DMS\n \n * [RDS DB Subnet Group](https://www.terraform.io/docs/providers/aws/r/db_subnet_group.html)\n * [ElastiCache Subnet Group](https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html)\n@@ -350,6 +350,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | dhcp\\_options\\_netbios\\_node\\_type | Specify netbios node\\_type for DHCP options set (requires enable\\_dhcp\\_options set to true) | `string` | `\"\"` | no |\n | dhcp\\_options\\_ntp\\_servers | Specify a list of NTP servers for DHCP options set (requires enable\\_dhcp\\_options set to true) | `list(string)` | `[]` | no |\n | dhcp\\_options\\_tags | Additional tags for the DHCP option set (requires enable\\_dhcp\\_options set to true) | `map(string)` | `{}` | no |\n+| dms\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint | `bool` | `false` | no |\n+| dms\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for DMS endpoint | `list(string)` | `[]` | no |\n+| dms\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an | is supported. If omitted, private subnets will be used. | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_private\\_dns\\_enabled | Whether or not to associate a private hosted zone with the specified VPC for EBS endpoint | `bool` | `false` | no |\n | ebs\\_endpoint\\_security\\_group\\_ids | The ID of one or more security groups to associate with the network interface for EBS endpoint | `list(string)` | `[]` | no |\n | ebs\\_endpoint\\_subnet\\_ids | The ID of one or more subnets in which to create a network interface for EBS endpoint. Only a single subnet within an AZ is supported. Ifomitted, private subnets will be used. | `list(string)` | `[]` | no |\n@@ -428,6 +431,7 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | enable\\_config\\_endpoint | Should be true if you want to provision an config endpoint to the VPC | `bool` | `false` | no |\n | enable\\_datasync\\_endpoint | Should be true if you want to provision an Data Sync endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dhcp\\_options | Should be true if you want to specify a DHCP options set with a custom domain name, DNS servers, NTP servers, netbios servers, and/or netbios server type | `bool` | `false` | no |\n+| enable\\_dms\\_endpoint | Should be true if you want to provision a DMS endpoint to the VPC | `bool` | `false` | no |\n | enable\\_dns\\_hostnames | Should be true to enable DNS hostnames in the VPC | `bool` | `false` | no |\n | enable\\_dns\\_support | Should be true to enable DNS support in the VPC | `bool` | `true` | no |\n | enable\\_dynamodb\\_endpoint | Should be true if you want to provision a DynamoDB endpoint to the VPC | `bool` | `false` | no |\n@@ -799,6 +803,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_datasync\\_dns\\_entry | The DNS entries for the VPC Endpoint for DataSync. |\n | vpc\\_endpoint\\_datasync\\_id | The ID of VPC endpoint for DataSync |\n | vpc\\_endpoint\\_datasync\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DataSync. |\n+| vpc\\_endpoint\\_dms\\_dns\\_entry | The DNS entries for the VPC Endpoint for DMS. |\n+| vpc\\_endpoint\\_dms\\_id | The ID of VPC endpoint for DMS |\n+| vpc\\_endpoint\\_dms\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for DMS. |\n | vpc\\_endpoint\\_dynamodb\\_id | The ID of VPC endpoint for DynamoDB |\n | vpc\\_endpoint\\_dynamodb\\_pl\\_id | The prefix list for the DynamoDB VPC endpoint. |\n | vpc\\_endpoint\\_ebs\\_dns\\_entry | The DNS entries for the VPC Endpoint for EBS. |\n---\noutputs.tf\n@@ -1407,6 +1407,21 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_dms_id\" {\n+ description = \"The ID of VPC endpoint for DMS\"\n+ value = concat(aws_vpc_endpoint.sns.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_dms_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_dms_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for DMS.\"\n+ value = flatten(aws_vpc_endpoint.sns.*.dns_entry)\n+}\n+\n output \"vpc_endpoint_rds_id\" {\n description = \"The ID of VPC endpoint for RDS\"\n value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n@@ -1422,7 +1437,6 @@ output \"vpc_endpoint_rds_dns_entry\" {\n value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n }\n \n-\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\nvariables.tf\n@@ -1883,6 +1883,30 @@ variable \"acm_pca_endpoint_private_dns_enabled\" {\n default = false\n }\n \n+variable \"enable_dms_endpoint\" {\n+ description = \"Should be true if you want to provision a DMS endpoint to the VPC\"\n+ type = bool\n+ default = false\n+}\n+\n+variable \"dms_endpoint_security_group_ids\" {\n+ description = \"The ID of one or more security groups to associate with the network interface for DMS endpoint\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_subnet_ids\" {\n+ description = \"The ID of one or more subnets in which to create a network interface for DMS endpoint. Only a single subnet within an AZ is supported. If omitted, private subnets will be used.\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"dms_endpoint_private_dns_enabled\" {\n+ description = \"Whether or not to associate a private hosted zone with the specified VPC for DMS endpoint\"\n+ type = bool\n+ default = false\n+}\n+\n variable \"map_public_ip_on_launch\" {\n description = \"Should be false if you do not want to auto-assign public IP on launch\"\n type = bool\n---\nvpc-endpoints.tf\n@@ -1529,3 +1529,27 @@ resource \"aws_vpc_endpoint\" \"codeartifact_repositories\" {\n \n tags = local.vpce_tags\n }\n+\n+\n+#############################################\n+# VPC Endpoint for Database Migration Service\n+#############################################\n+data \"aws_vpc_endpoint_service\" \"dms\" {\n+ count = var.create_vpc && var.dms_endpoint_subnet_ids ? 1 : 0\n+\n+ service = \"dms\"\n+}\n+\n+resource \"aws_vpc_endpoint\" \"dms\" {\n+ count = var.create_vpc && var.enable_dms_endpoint ? 1 : 0\n+\n+ vpc_id = local.vpc_id\n+ service_name = data.aws_vpc_endpoint_service.dms[0].service_name\n+ vpc_endpoint_type = \"Interface\"\n+\n+ security_group_ids = var.dms_endpoint_security_group_ids\n+ subnet_ids = coalescelist(var.dms_endpoint_subnet_ids, aws_subnet.private.*.id)\n+ private_dns_enabled = var.dms_endpoint_private_dns_enabled\n+\n+ tags = local.vpce_tags\n+}\n---\n\n\n---\n" } ]
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\nRDS endpoint is missing from the outputs.\r\n\r\n## Motivation and Context\r\nRDS endpoint is missing from the outputs.\r\n\n\n---\n\nChoice A:\nREADME.md\n@@ -876,6 +876,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_qldb\\_session\\_dns\\_entry | The DNS entries for the VPC Endpoint for QLDB Session. |\n | vpc\\_endpoint\\_qldb\\_session\\_id | The ID of VPC endpoint for QLDB Session |\n | vpc\\_endpoint\\_qldb\\_session\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for QLDB Session. |\n+| vpc\\_endpoint\\_rds\\_dns\\_entry | The DNS entries for the VPC Endpoint for RDS. |\n+| vpc\\_endpoint\\_rds\\_id | The ID of VPC endpoint for RDS |\n+| vpc\\_endpoint\\_rds\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for RDS. |\n | vpc\\_endpoint\\_rekognition\\_dns\\_entry | The DNS entries for the VPC Endpoint for Rekognition. |\n | vpc\\_endpoint\\_rekognition\\_id | The ID of VPC endpoint for Rekognition |\n | vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for Rekognition. |\n---\noutputs.tf\n@@ -1407,6 +1407,22 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_rds_id\" {\n+ description = \"The ID of VPC endpoint for RDS\"\n+ value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_rds_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for RDS.\"\n+ value = flatten(aws_vpc_endpoint.rds.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_rds_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for RDS.\"\n+ value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n+}\n+\n+\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -876,6 +876,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_qldb\\_session\\_dns\\_entry | The DNS entries for the VPC Endpoint for QLDB Session. |\n | vpc\\_endpoint\\_qldb\\_session\\_id | The ID of VPC endpoint for QLDB Session |\n | vpc\\_endpoint\\_qldb\\_session\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for QLDB Session. |\n+| vpc\\_endpoint\\_rds\\_dns\\_entry | The DNS entries for the VPC Endpoint for RDS. |\n+| vpc\\_endpoint\\_rds\\_id | The ID of VPC endpoint for RDS |\n+| vpc\\_endpoint\\_rds\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for RDS. |\n | vpc\\_endpoint\\_rekognition\\_dns\\_entry | The DNS entries for the VPC Endpoint for Rekognition. |\n | vpc\\_endpoint\\_rekognition\\_id | The ID of VPC endpoint for Rekognition VPC | vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for Rekognition. |\n---\noutputs.tf\n@@ -1407,6 +1407,22 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_rds_id\" {\n+ description = \"The ID of VPC endpoint for RDS\"\n+ value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_rds_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for RDS.\"\n+ value = flatten(aws_vpc_endpoint.rds.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_rds_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for RDS.\"\n+ value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n+}\n+\n+\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -876,6 +876,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_qldb\\_session\\_dns\\_entry | The DNS entries for the VPC Endpoint for QLDB Session. |\n | vpc\\_endpoint\\_qldb\\_session\\_id | The ID of VPC endpoint for QLDB Session |\n | vpc\\_endpoint\\_qldb\\_session\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for QLDB Session. |\n+| vpc\\_endpoint\\_rds\\_dns\\_entry | The DNS entries for the VPC Endpoint for RDS. |\n+| vpc\\_endpoint\\_rds\\_id | The ID of VPC endpoint for RDS |\n+| vpc\\_endpoint\\_rds\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for RDS. |\n | vpc\\_endpoint\\_rekognition\\_dns\\_entry | The DNS entries for the VPC Endpoint for Rekognition. |\n | vpc\\_endpoint\\_rekognition\\_id | The ID of VPC endpoint for Rekognition |\n | vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for Rekognition. |\n---\noutputs.tf\n@@ -1407,6 +1407,22 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_rds_id\" {\n+ description = \"The ID of VPC endpoint for RDS\"\n+ value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_rds_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for RDS.\"\n+ QLDB = flatten(aws_vpc_endpoint.rds.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_rds_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for RDS.\"\n+ value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n+}\n+\n+\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -876,6 +876,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | vpc\\_endpoint\\_qldb\\_session\\_dns\\_entry | The DNS entries for the VPC Endpoint for QLDB Session. |\n | DNS | The ID of VPC endpoint for QLDB Session |\n | vpc\\_endpoint\\_qldb\\_session\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for QLDB Session. |\n+| vpc\\_endpoint\\_rds\\_dns\\_entry | The DNS entries for the VPC Endpoint for RDS. |\n+| vpc\\_endpoint\\_rds\\_id | The ID of VPC endpoint for RDS |\n+| vpc\\_endpoint\\_rds\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for RDS. |\n | vpc\\_endpoint\\_rekognition\\_dns\\_entry | The DNS entries for the VPC Endpoint for Rekognition. |\n | vpc\\_endpoint\\_rekognition\\_id | The ID of VPC endpoint for Rekognition |\n | vpc\\_endpoint\\_rekognition\\_network\\_interface\\_ids | One or more network interfaces for the VPC Endpoint for Rekognition. |\n---\noutputs.tf\n@@ -1407,6 +1407,22 @@ output \"vpc_endpoint_codeartifact_repositories_dns_entry\" {\n value = flatten(aws_vpc_endpoint.codeartifact_repositories.*.dns_entry)\n }\n \n+output \"vpc_endpoint_rds_id\" {\n+ description = \"The ID of VPC endpoint for RDS\"\n+ value = concat(aws_vpc_endpoint.rds.*.id, [\"\"])[0]\n+}\n+\n+output \"vpc_endpoint_rds_network_interface_ids\" {\n+ description = \"One or more network interfaces for the VPC Endpoint for RDS.\"\n+ value = flatten(aws_vpc_endpoint.rds.*.network_interface_ids)\n+}\n+\n+output \"vpc_endpoint_rds_dns_entry\" {\n+ description = \"The DNS entries for the VPC Endpoint for RDS.\"\n+ value = flatten(aws_vpc_endpoint.rds.*.dns_entry)\n+}\n+\n+\n # VPC flow log\n output \"vpc_flow_log_id\" {\n description = \"The ID of the Flow Log resource\"\n---\n\n\n---\n" } ]
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 the ability to define a name prefix for the NAT Gateway and the EIP's that are created for the NAT Gateway.\r\n\r\n## Motivation and Context\r\nCurrently based on the name tag alone for the NAT Gateway and NAT Gateway's EIP's it is hard to know that the NAT Gateway is a NAT Gateway and that the EIP's that are created belong to the NAT Gateway. I wanted a way to make this more clear for reporting purposes. While I could have overridden the name using the `nat_gateway_tags` and `nat_eip_tags` options respectively it would have removed the subnet part of the name which would have left me with several NAT Gateways and EIPs with matching names in VPC's that have more than one. Adding a prefix option seemed like a sensible compromise.\r\n\r\n## Breaking Changes\r\nNo breaking changes, if the new option is not used the previous naming scheme is used.\r\n\r\n## How Has This Been Tested?\r\nI ran `terraform plan` on the `examples/simple-vpc` and verified the names matched what was previously there. Then I modified `examples/simple-vpc/main.tf` adding: \r\n```\r\n nat_gateway_name_prefix = \"my-overridden-nat-name\"\r\n nat_gateway_eips_name_prefix = \"my-overridden-eips-name\"\r\n``` \r\nthe new plan had:\r\n```\r\n # module.vpc.aws_eip.nat[0] will be created\r\n + resource \"aws_eip\" \"nat\" {\r\n + allocation_id = (known after apply)\r\n + association_id = (known after apply)\r\n + carrier_ip = (known after apply)\r\n + customer_owned_ip = (known after apply)\r\n + domain = (known after apply)\r\n + id = (known after apply)\r\n + instance = (known after apply)\r\n + network_border_group = (known after apply)\r\n + network_interface = (known after apply)\r\n + private_dns = (known after apply)\r\n + private_ip = (known after apply)\r\n + public_dns = (known after apply)\r\n + public_ip = (known after apply)\r\n + public_ipv4_pool = (known after apply)\r\n + tags = {\r\n + \"Environment\" = \"dev\"\r\n + \"Name\" = \"my-overridden-eips-name-eu-west-1a\"\r\n + \"Owner\" = \"user\"\r\n }\r\n + vpc = true\r\n }\r\n\r\n # module.vpc.aws_nat_gateway.this[0] will be created\r\n + resource \"aws_nat_gateway\" \"this\" {\r\n + allocation_id = (known after apply)\r\n + id = (known after apply)\r\n + network_interface_id = (known after apply)\r\n + private_ip = (known after apply)\r\n + public_ip = (known after apply)\r\n + subnet_id = (known after apply)\r\n + tags = {\r\n + \"Environment\" = \"dev\"\r\n + \"Name\" = \"my-overridden-nat-name-eu-west-1a\"\r\n + \"Owner\" = \"user\"\r\n }\r\n }\r\n``` \n\n---\n\nChoice A:\nREADME.md\n@@ -544,6 +544,8 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | name | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\n | nat\\_eip\\_tags | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | nat\\_gateway\\_tags | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| nat\\_gateway\\_name\\_prefix | Specify the prefix name for the nat gateway | `string` | `\"\"` | no |\n+| nat\\_gateway\\_eips\\_name\\_prefix | Specify the prefix name for the nat gateway's EIP's | `string` | `\"\"` | no |\n | one\\_nat\\_gateway\\_per\\_az | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs`. | `bool` | `false` | no |\n | private\\_acl\\_tags | Additional tags for the private subnets network ACL | `map(string)` | `{}` | no |\n | private\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for private subnets | `bool` | `false` | no |\n---\nmain.tf\n@@ -932,7 +932,7 @@ resource \"aws_eip\" \"nat\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_eips_name_prefix != \"\" ? var.nat_gateway_eips_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n@@ -957,7 +957,7 @@ resource \"aws_nat_gateway\" \"this\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_name_prefix != \"\" ? var.nat_gateway_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n---\nvariables.tf\n@@ -274,6 +274,12 @@ variable \"enable_nat_gateway\" {\n default |\n+| = false\n }\n \n+variable \"nat_gateway_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n@@ -304,6 +310,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"nat_gateway_eips_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways's eips, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"enable_public_s3_endpoint\" {\n description = \"Whether to enable S3 VPC Endpoint for public subnets\"\n default = true\n---\n\n\n---\n\nChoice B:\nREADME.md\n@@ -544,6 +544,8 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | name | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\n | nat\\_eip\\_tags | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | nat\\_gateway\\_tags | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| nat\\_gateway\\_name\\_prefix | Specify the prefix name for the nat gateway | `string` | `\"\"` | no |\n+| nat\\_gateway\\_eips\\_name\\_prefix | Specify the prefix name for the nat gateway's EIP's | `string` | `\"\"` | no |\n | one\\_nat\\_gateway\\_per\\_az | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs`. | `bool` | `false` | no |\n | private\\_acl\\_tags | Additional tags for the private subnets network ACL | `map(string)` | `{}` | no |\n | private\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for private subnets | `bool` | `false` | no |\n---\nmain.tf\n@@ -932,7 +932,7 @@ resource \"aws_eip\" \"nat\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_eips_name_prefix != \"\" ? var.nat_gateway_eips_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n@@ -957,7 +957,7 @@ resource \"aws_nat_gateway\" \"this\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_name_prefix != \"\" ? var.nat_gateway_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n---\nvariables.tf\n@@ -274,6 +274,12 @@ variable \"enable_nat_gateway\" {\n default = false\n }\n \n+variable \"nat_gateway_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n@@ -304,6 +310,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"nat_gateway_eips_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways's eips, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"enable_public_s3_endpoint\" {\n description = \"Whether to enable S3 VPC Endpoint for public subnets\"\n default = true\n---\n\n\n---\n\nChoice C:\nREADME.md\n@@ -544,6 +544,8 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway\n | name | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\n | nat\\_eip\\_tags | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | nat\\_gateway\\_tags | Additional | for the NAT gateways | `map(string)` | `{}` | no |\n+| nat\\_gateway\\_name\\_prefix | Specify the prefix name for the nat gateway | `string` | `\"\"` | no |\n+| nat\\_gateway\\_eips\\_name\\_prefix | Specify the prefix name for the nat gateway's EIP's | `string` | `\"\"` | no |\n | one\\_nat\\_gateway\\_per\\_az | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs`. | `bool` | `false` | no |\n | private\\_acl\\_tags | Additional tags for the private subnets network ACL | `map(string)` | `{}` | no |\n | private\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for private subnets | `bool` | `false` | no |\n---\nmain.tf\n@@ -932,7 +932,7 @@ resource \"aws_eip\" \"nat\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_eips_name_prefix != \"\" ? var.nat_gateway_eips_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n@@ -957,7 +957,7 @@ resource \"aws_nat_gateway\" \"this\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_name_prefix != \"\" ? var.nat_gateway_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n---\nvariables.tf\n@@ -274,6 +274,12 @@ variable \"enable_nat_gateway\" {\n default = false\n }\n \n+variable \"nat_gateway_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n@@ -304,6 +310,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"nat_gateway_eips_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways's eips, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"enable_public_s3_endpoint\" {\n description = \"Whether to enable S3 VPC Endpoint for public subnets\"\n default = true\n---\n\n\n---\n\nChoice D:\nREADME.md\n@@ -544,6 +544,8 @@ It is possible to for this VPC module with [terraform-aws-transit-gateway\n | name | Name to be used on all the resources as identifier | `string` | `\"\"` | no |\n | nat\\_eip\\_tags | Additional tags for the NAT EIP | `map(string)` | `{}` | no |\n | nat\\_gateway\\_tags | Additional tags for the NAT gateways | `map(string)` | `{}` | no |\n+| nat\\_gateway\\_name\\_prefix | Specify the prefix name for the nat gateway | `string` | `\"\"` | no |\n+| nat\\_gateway\\_eips\\_name\\_prefix | Specify the prefix name for the nat gateway's EIP's | `string` | `\"\"` | no |\n | one\\_nat\\_gateway\\_per\\_az | Should be true if you want only one NAT Gateway per availability zone. Requires `var.azs` to be set, and the number of `public_subnets` created to be greater than or equal to the number of availability zones specified in `var.azs`. | `bool` | `false` | no |\n | private\\_acl\\_tags | Additional tags for the private subnets network ACL | `map(string)` | `{}` | no |\n | private\\_dedicated\\_network\\_acl | Whether to use dedicated network ACL (not default) and custom rules for private subnets | `bool` | `false` | no |\n---\nmain.tf\n@@ -932,7 +932,7 @@ resource \"aws_eip\" \"nat\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_eips_name_prefix != \"\" ? var.nat_gateway_eips_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n@@ -957,7 +957,7 @@ resource \"aws_nat_gateway\" \"this\" {\n {\n \"Name\" = format(\n \"%s-%s\",\n- var.name,\n+ var.nat_gateway_name_prefix != \"\" ? var.nat_gateway_name_prefix : var.name,\n element(var.azs, var.single_nat_gateway ? 0 : count.index),\n )\n },\n---\nvariables.tf\n@@ -274,6 +274,12 @@ variable \"enable_nat_gateway\" {\n default = false\n }\n \n+variable \"nat_gateway_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"single_nat_gateway\" {\n description = \"Should be true if you want to provision a single shared NAT Gateway across all of your private networks\"\n type = bool\n@@ -304,6 +310,12 @@ variable \"external_nat_ips\" {\n default = []\n }\n \n+variable \"nat_gateway_eips_name_prefix\" {\n+ description = \"Optionally specify a name for your nat gateways's eips, if not var.name will be used\"\n+ type = string\n+ default = \"\"\n+}\n+\n variable \"enable_public_s3_endpoint\" {\n description = \"Whether to enable S3 VPC Endpoint for public subnets\"\n default = true\n---\n\n\n---\n" } ]
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<!--- Please describe in detail how you tested your changes. -->\r\n<!--- Include details of your testing environment, and the tests you ran to -->\r\n<!--- see how your change affects other areas of the code, etc. -->\r\n\n\n---\n\nChoice A:\nmain.tf\n@@ -324,13 +324,13 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n ################\n-# Public subnet\n+# Public-App subnet\n ################\n-resource \"aws_subnet\" \"public\" {\n- count = var.create_vpc && length(var.public_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public_subnets) >= length(var.azs)) ? length(var.public_subnets) : 0\n+resource \"aws_subnet\" \"public-app\" {\n+ count = var.create_vpc && length(var.public-app_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-app_subnets) >= length(var.azs)) ? length(var.public-app_subnets) : 0\n \n vpc_id = local.vpc_id\n- cidr_block = element(concat(var.public_subnets, [\"\"]), count.index)\n+ cidr_block = element(concat(var.public-app_subnets, [\"\"]), count.index)\n availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n map_public_ip_on_launch = var.map_public_ip_on_launch\n@@ -341,13 +341,41 @@ resource \"aws_subnet\" \"public\" {\n tags = merge(\n {\n \"Name\" = format(\n- \"%s-${var.public_subnet_suffix}-%s\",\n+ \"%s-${var.public-app_subnet_suffix}-%s\",\n var.name,\n element(var.azs, count.index),\n )\n },\n var.tags,\n- var.public_subnet_tags,\n+ var.public-app_subnet_tags,\n+ )\n+}\n+\n+################\n+# Public-Network subnet\n+################\n+resource \"aws_subnet\" \"public-network\" {\n+ count = var.create_vpc && length(var.public-network_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-network_subnets) >= length(var.azs)) ? length(var.public-network_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = element(concat(var.public-network_subnets, [\"\"]), count.index)\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ map_public_ip_on_launch = var.map_public_ip_on_launch\n+ assign_ipv6_address_on_creation = var.public_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.public_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.public_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.public_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = \"%s-${var.public-network_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.public-network_subnet_tags,\n )\n }\n \n---\noutputs.tf\n@@ -88,24 +88,44 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private.*.ipv6_cidr_block\n }\n \n-output \"public_subnets\" {\n+output \"public-app_subnets\" {\n description = \"List of IDs of public subnets\"\n- value = aws_subnet.public.*.id\n+ value = aws_subnet.public-app.*.id\n }\n \n-output \"public_subnet_arns\" {\n+output \"public-network_subnets\" {\n+ description = \"List of IDs of public subnets\"\n+ value = aws_subnet.public-network.*.id\n+}\n+\n+output \"public-app_subnet_arns\" {\n+ description = \"List of ARNs of public subnets\"\n+ value = aws_subnet.public-app.*.arn\n+}\n+\n+output \"public-network_subnet_arns\" {\n description = \"List of ARNs of public subnets\"\n- value = aws_subnet.public.*.arn\n+ value = aws_subnet.public-network.*.arn\n }\n \n-output \"public_subnets_cidr_blocks\" {\n+output \"public-app_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public.*.cidr_block\n+ value = aws_subnet.public-app.*.cidr_block\n+}\n+\n+output \"public-network_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of public subnets\"\n+ value = aws_subnet.public-network.*.cidr_block\n+}\n+\n+output \"public-app_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.public-app.*.ipv6_cidr_block\n }\n \n-output \"public_subnets_ipv6_cidr_blocks\" {\n+output \"public-network_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public.*.ipv6_cidr_block\n+ value = aws_subnet.public-network.*.ipv6_cidr_block\n }\n \n output \"database_subnets\" {\n---\nvariables.tf\n@@ -148,8 +148,14 @@ variable \"elasticache_subnet_suffix\" {\n default = \"elasticache\"\n }\n \n-variable \"public_subnets\" {\n- description = \"A list of public subnets inside the VPC\"\n+variable \"public-app_subnets\" {\n+ description = \"A list of public-app subnets inside the VPC\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"public-network_subnets\" {\n+ description = \"A list of public-network subnets inside the VPC\"\n type = list(string)\n default = []\n }\n@@ -1955,7 +1961,13 @@ variable \"igw_tags\" {\n default = {}\n }\n \n-variable \"public_subnet_tags\" {\n+variable \"public-app_subnet_tags\" {\n+ description = \"Additional tags for the public subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n+variable \"public-network_subnet_tags\" {\n description = \"Additional tags for the public subnets\"\n type = map(string)\n default = {}\n---\n\n\n---\n\nChoice B:\nmain.tf\n@@ -324,13 +324,13 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n ################\n-# Public subnet\n+# Public-App subnet\n ################\n-resource \"aws_subnet\" \"public\" {\n- count = var.create_vpc && length(var.public_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public_subnets) >= length(var.azs)) ? length(var.public_subnets) : 0\n+resource \"aws_subnet\" \"public-app\" {\n+ count = var.create_vpc && length(var.public-app_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-app_subnets) >= length(var.azs)) ? length(var.public-app_subnets) : 0\n \n vpc_id = local.vpc_id\n- cidr_block = element(concat(var.public_subnets, [\"\"]), count.index)\n+ cidr_block = element(concat(var.public-app_subnets, [\"\"]), count.index)\n availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n map_public_ip_on_launch = var.map_public_ip_on_launch\n@@ -341,13 +341,41 @@ resource \"aws_subnet\" \"public\" {\n tags = merge(\n {\n \"Name\" = format(\n- \"%s-${var.public_subnet_suffix}-%s\",\n+ \"%s-${var.public-app_subnet_suffix}-%s\",\n var.name,\n element(var.azs, count.index),\n )\n },\n var.tags,\n- var.public_subnet_tags,\n+ var.public-app_subnet_tags,\n+ )\n+}\n+\n+################\n+# Public-Network subnet\n+################\n+resource \"aws_subnet\" \"public-network\" {\n+ count = var.create_vpc && length(var.public-network_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-network_subnets) >= length(var.azs)) ? length(var.public-network_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = element(concat(var.public-network_subnets, [\"\"]), count.index)\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ map_public_ip_on_launch = var.map_public_ip_on_launch\n+ assign_ipv6_address_on_creation = var.public_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.public_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.public_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.public_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"%s-${var.public-network_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.public-network_subnet_tags,\n )\n }\n \n---\noutputs.tf\n@@ -88,24 +88,44 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private.*.ipv6_cidr_block\n }\n \n-output \"public_subnets\" {\n+output \"public-app_subnets\" {\n description = \"List of IDs of public subnets\"\n- value = aws_subnet.public.*.id\n+ value = aws_subnet.public-app.*.id\n }\n \n-output \"public_subnet_arns\" {\n+output \"public-network_subnets\" {\n+ description = \"List of IDs of public subnets\"\n+ value = aws_subnet.public-network.*.id\n+}\n+\n+output \"public-app_subnet_arns\" {\n+ description = \"List of ARNs of public subnets\"\n+ value = aws_subnet.public-app.*.arn\n+}\n+\n+output \"public-network_subnet_arns\" {\n description = \"List of ARNs of public subnets\"\n- value = aws_subnet.public.*.arn\n+ value = aws_subnet.public-network.*.arn\n }\n \n-output \"public_subnets_cidr_blocks\" {\n+output \"public-app_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public.*.cidr_block\n+ value = aws_subnet.public-app.*.cidr_block\n+}\n+\n+output \"public-network_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of public subnets\"\n+ value = aws_subnet.public-network.*.cidr_block\n+}\n+\n+output \"public-app_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.public-app.*.ipv6_cidr_block\n }\n \n-output \"public_subnets_ipv6_cidr_blocks\" {\n+output \"public-network_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public.*.ipv6_cidr_block\n+ value = aws_subnet.public-network.*.ipv6_cidr_block\n }\n \n output \"database_subnets\" {\n---\nvariables.tf\n@@ -148,8 +148,14 @@ variable \"elasticache_subnet_suffix\" {\n default = \"elasticache\"\n }\n \n-variable \"public_subnets\" {\n- description = \"A list of public subnets inside the VPC\"\n+variable \"public-app_subnets\" {\n+ description = \"A list of public-app subnets inside the VPC\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"public-network_subnets\" {\n+ description = \"A list of public-network subnets inside the VPC\"\n type = list(string)\n default = []\n }\n@@ -1955,7 +1961,13 @@ variable \"igw_tags\" {\n default = {}\n }\n \n-variable \"public_subnet_tags\" {\n+variable \"public-app_subnet_tags\" {\n+ description = \"Additional tags for the public subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n+variable \"public-network_subnet_tags\" {\n description = \"Additional tags for the public subnets\"\n type = map(string)\n default = {}\n---\n\n\n---\n\nChoice C:\nmain.tf\n@@ -324,13 +324,13 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n ################\n-# Public subnet\n+# Public-App subnet\n ################\n-resource \"aws_subnet\" \"public\" {\n- count = var.create_vpc && length(var.public_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public_subnets) >= length(var.azs)) ? length(var.public_subnets) : 0\n+resource \"aws_subnet\" \"public-app\" {\n+ count = var.create_vpc && length(var.public-app_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-app_subnets) >= length(var.azs)) ? length(var.public-app_subnets) : 0\n \n vpc_id = local.vpc_id\n- cidr_block = element(concat(var.public_subnets, [\"\"]), count.index)\n+ cidr_block = element(concat(var.public-app_subnets, [\"\"]), count.index)\n availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n map_public_ip_on_launch = var.map_public_ip_on_launch\n@@ -341,13 +341,41 @@ resource \"aws_subnet\" \"public\" {\n tags = merge(\n {\n \"Name\" = format(\n- \"%s-${var.public_subnet_suffix}-%s\",\n+ \"%s-${var.public-app_subnet_suffix}-%s\",\n var.name,\n element(var.azs, count.index),\n )\n },\n var.tags,\n- var.public_subnet_tags,\n+ var.public-app_subnet_tags,\n+ )\n+}\n+\n+################\n+# Public-Network subnet\n+################\n+resource \"aws_subnet\" \"public-network\" {\n+ count = var.create_vpc && length(var.public-network_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-network_subnets) >= length(var.azs)) ? length(var.public-network_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = element(concat(var.public-network_subnets, [\"\"]), count.index)\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) description 0 ? element(var.azs, count.index) : null\n+ map_public_ip_on_launch = var.map_public_ip_on_launch\n+ assign_ipv6_address_on_creation = var.public_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.public_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.public_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.public_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"%s-${var.public-network_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.public-network_subnet_tags,\n )\n }\n \n---\noutputs.tf\n@@ -88,24 +88,44 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private.*.ipv6_cidr_block\n }\n \n-output \"public_subnets\" {\n+output \"public-app_subnets\" {\n description = \"List of IDs of public subnets\"\n- value = aws_subnet.public.*.id\n+ value = aws_subnet.public-app.*.id\n }\n \n-output \"public_subnet_arns\" {\n+output \"public-network_subnets\" {\n+ description = \"List of IDs of public subnets\"\n+ value = aws_subnet.public-network.*.id\n+}\n+\n+output \"public-app_subnet_arns\" {\n+ description = \"List of ARNs of public subnets\"\n+ value = aws_subnet.public-app.*.arn\n+}\n+\n+output \"public-network_subnet_arns\" {\n description = \"List of ARNs of public subnets\"\n- value = aws_subnet.public.*.arn\n+ value = aws_subnet.public-network.*.arn\n }\n \n-output \"public_subnets_cidr_blocks\" {\n+output \"public-app_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public.*.cidr_block\n+ value = aws_subnet.public-app.*.cidr_block\n+}\n+\n+output \"public-network_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of public subnets\"\n+ value = aws_subnet.public-network.*.cidr_block\n+}\n+\n+output \"public-app_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n+ value = aws_subnet.public-app.*.ipv6_cidr_block\n }\n \n-output \"public_subnets_ipv6_cidr_blocks\" {\n+output \"public-network_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public.*.ipv6_cidr_block\n+ value = aws_subnet.public-network.*.ipv6_cidr_block\n }\n \n output \"database_subnets\" {\n---\nvariables.tf\n@@ -148,8 +148,14 @@ variable \"elasticache_subnet_suffix\" {\n default = \"elasticache\"\n }\n \n-variable \"public_subnets\" {\n- description = \"A list of public subnets inside the VPC\"\n+variable \"public-app_subnets\" {\n+ description = \"A list of public-app subnets inside the VPC\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"public-network_subnets\" {\n+ description = \"A list of public-network subnets inside the VPC\"\n type = list(string)\n default = []\n }\n@@ -1955,7 +1961,13 @@ variable \"igw_tags\" {\n default = {}\n }\n \n-variable \"public_subnet_tags\" {\n+variable \"public-app_subnet_tags\" {\n+ description = \"Additional tags for the public subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n+variable \"public-network_subnet_tags\" {\n description = \"Additional tags for the public subnets\"\n type = map(string)\n default = {}\n---\n\n\n---\n\nChoice D:\nmain.tf\n@@ -324,13 +324,13 @@ resource \"aws_route_table\" \"intra\" {\n }\n \n ################\n-# Public subnet\n+# Public-App subnet\n ################\n-resource \"aws_subnet\" \"public\" {\n- count = var.create_vpc && length(var.public_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public_subnets) >= length(var.azs)) ? length(var.public_subnets) : 0\n+resource \"aws_subnet\" \"public-app\" {\n+ count = var.create_vpc && length(var.public-app_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-app_subnets) >= length(var.azs)) ? length(var.public-app_subnets) : 0\n \n vpc_id = local.vpc_id\n- cidr_block = element(concat(var.public_subnets, [\"\"]), count.index)\n+ cidr_block = element(concat(var.public-app_subnets, [\"\"]), count.index)\n availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n map_public_ip_on_launch = var.map_public_ip_on_launch\n@@ -341,13 +341,41 @@ resource \"aws_subnet\" \"public\" {\n tags = merge(\n {\n \"Name\" = format(\n- \"%s-${var.public_subnet_suffix}-%s\",\n+ \"%s-${var.public-app_subnet_suffix}-%s\",\n var.name,\n element(var.azs, count.index),\n )\n },\n var.tags,\n- var.public_subnet_tags,\n+ var.public-app_subnet_tags,\n+ )\n+}\n+\n+################\n+# Public-Network subnet\n+################\n+resource \"aws_subnet\" \"public-network\" {\n+ count = var.create_vpc && length(var.public-network_subnets) > 0 && (false == var.one_nat_gateway_per_az || length(var.public-network_subnets) >= length(var.azs)) ? length(var.public-network_subnets) : 0\n+\n+ vpc_id = local.vpc_id\n+ cidr_block = element(concat(var.public-network_subnets, [\"\"]), count.index)\n+ availability_zone = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null\n+ availability_zone_id = length(regexall(\"^[a-z]{2}-\", element(var.azs, count.index))) == 0 ? element(var.azs, count.index) : null\n+ map_public_ip_on_launch = var.map_public_ip_on_launch\n+ assign_ipv6_address_on_creation = var.public_subnet_assign_ipv6_address_on_creation == null ? var.assign_ipv6_address_on_creation : var.public_subnet_assign_ipv6_address_on_creation\n+\n+ ipv6_cidr_block = var.enable_ipv6 && length(var.public_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, 8, var.public_subnet_ipv6_prefixes[count.index]) : null\n+\n+ tags = merge(\n+ {\n+ \"Name\" = format(\n+ \"%s-${var.public-network_subnet_suffix}-%s\",\n+ var.name,\n+ element(var.azs, count.index),\n+ )\n+ },\n+ var.tags,\n+ var.public-network_subnet_tags,\n )\n }\n \n---\noutputs.tf\n@@ -88,24 +88,44 @@ output \"private_subnets_ipv6_cidr_blocks\" {\n value = aws_subnet.private.*.ipv6_cidr_block\n }\n \n-output \"public_subnets\" {\n+output \"public-app_subnets\" {\n description = \"List of IDs of public subnets\"\n- value = aws_subnet.public.*.id\n+ value = aws_subnet.public-app.*.id\n }\n \n-output \"public_subnet_arns\" {\n+output \"public-network_subnets\" {\n+ description = \"List of IDs of public subnets\"\n+ value = aws_subnet.public-network.*.id\n+}\n+\n+output \"public-app_subnet_arns\" {\n+ description = \"List of ARNs of public subnets\"\n+ value = aws_subnet.public-app.*.arn\n+}\n+\n+output \"public-network_subnet_arns\" {\n description = \"List of ARNs of public subnets\"\n- value = aws_subnet.public.*.arn\n+ value = aws_subnet.public-network.*.arn\n }\n \n-output \"public_subnets_cidr_blocks\" {\n+output \"public-app_subnets_cidr_blocks\" {\n description = \"List of cidr_blocks of public subnets\"\n- value = aws_subnet.public.*.cidr_block\n+ value = aws_subnet.public-app.*.cidr_block\n+}\n+\n+output \"public-network_subnets_cidr_blocks\" {\n+ description = \"List of cidr_blocks of public subnets\"\n+ value = aws_subnet.public-network.*.cidr_block\n+}\n+\n+output \"public-app_subnets_ipv6_cidr_blocks\" {\n+ description = \"List of IPv6 cidr_blocks of public subnets in an length(var.public-network_subnets) enabled VPC\"\n+ value = aws_subnet.public-app.*.ipv6_cidr_block\n }\n \n-output \"public_subnets_ipv6_cidr_blocks\" {\n+output \"public-network_subnets_ipv6_cidr_blocks\" {\n description = \"List of IPv6 cidr_blocks of public subnets in an IPv6 enabled VPC\"\n- value = aws_subnet.public.*.ipv6_cidr_block\n+ value = aws_subnet.public-network.*.ipv6_cidr_block\n }\n \n output \"database_subnets\" {\n---\nvariables.tf\n@@ -148,8 +148,14 @@ variable \"elasticache_subnet_suffix\" {\n default = \"elasticache\"\n }\n \n-variable \"public_subnets\" {\n- description = \"A list of public subnets inside the VPC\"\n+variable \"public-app_subnets\" {\n+ description = \"A list of public-app subnets inside the VPC\"\n+ type = list(string)\n+ default = []\n+}\n+\n+variable \"public-network_subnets\" {\n+ description = \"A list of public-network subnets inside the VPC\"\n type = list(string)\n default = []\n }\n@@ -1955,7 +1961,13 @@ variable \"igw_tags\" {\n default = {}\n }\n \n-variable \"public_subnet_tags\" {\n+variable \"public-app_subnet_tags\" {\n+ description = \"Additional tags for the public subnets\"\n+ type = map(string)\n+ default = {}\n+}\n+\n+variable \"public-network_subnet_tags\" {\n description = \"Additional tags for the public subnets\"\n type = map(string)\n default = {}\n---\n\n\n---\n" } ]
B