From aa94ff8cc915fb84ed03f205b15ce2efb58cd0f5 Mon Sep 17 00:00:00 2001 From: Patrick Joyce Date: Mon, 28 Feb 2022 19:35:28 -0500 Subject: [PATCH] bump aws provider, rm deprecated data source --- terraform/aws/.terraform.lock.hcl | 28 ++++++++++++++-------------- terraform/aws/README.md | 6 +++--- terraform/aws/ec2.tf | 9 ++++++--- terraform/aws/main.tf | 2 +- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/terraform/aws/.terraform.lock.hcl b/terraform/aws/.terraform.lock.hcl index 9f75db5..8e3b673 100644 --- a/terraform/aws/.terraform.lock.hcl +++ b/terraform/aws/.terraform.lock.hcl @@ -2,21 +2,21 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/aws" { - version = "3.74.2" - constraints = "~> 3.47" + version = "4.2.0" + constraints = "~> 4.2.0" hashes = [ - "h1:gyAOih3vXIcMuixQQSbUZWS2cRDcYmEwOc01/ATpuoo=", - "zh:2b1df436ec034ae9416b23b95efd192b2fe271a7c8595493329dcde8e452c036", - "zh:3aba9abd4bc8a904378b1f852d025a397ef74f0dbe59134a06fc5abebb259efc", - "zh:45700f37e3a97c5b3a8d5d2ec79ae7a8671be8893a6a6c38ae069888d13c20fe", - "zh:5b2ca0fde7f9b723018528ea21b151f2ada360a435ef2dcfb666d7fe686b2845", - "zh:785c52c6b4724873723b77c78e66024dc7ad951eeacb44a8c0cab2dd3c0f9828", - "zh:8b50a307f3324c4e31813abdb08a21c666e302e4c0496d9f8015ae76327cafb4", - "zh:ab78cab83e7806030c1b1e4943a6edb149a901380a1a5f7bceb1a1f41098e4c5", - "zh:c06a7fbffbbfa7b407990091869c0642dc9e38217da2895b49b42892e86eada6", - "zh:e046e30e24b3b95ca8ec0ecac562ac8a47e86f9db0efa460e50c2afce07e084e", - "zh:ef02426419de15931bcdfb400d914d720639607415ac623c04cdf425c71ade41", - "zh:fb1990e9e162cf1837792e4886a4b6dcb3ffdd511d1ba4b56118127525504032", + "h1:7xPC2b+Plr514HPRf837t3YFzlSSIY03StrScaVIfw0=", + "zh:297d6462055eac8eb5c6735bd1a0fec23574e27d56c4c14a39efd8f3931ce4ed", + "zh:457319839adca3638fd76f49fd65e15756717f97ac99bd1805a1c9387a62a250", + "zh:57377384fa28abc4211a0916fc0fb590af238d096ad0490434ffeb89f568df9b", + "zh:578e1d21bd6d38bdaef0909b30959b884e84e6c464796a50e516822955db162a", + "zh:5e7ff13cc976f609aee4ada3c1967ba1f0ce5d276f3102a0aeaedc586d25ea80", + "zh:5e94f09fe1874a2365bd566fecab8f676cd720da1c0bf70875392679549ebf20", + "zh:93da14d7ffb8550b161cb79fe2cfc0f66848dd5022974399ae2bf88da7b9e9c5", + "zh:c51e4541f3d29627974dcb7f5919012a762391accb574ade9e28bdb3c92bada5", + "zh:eff58c1680e3f29e514919346d937bbe47278434ae03ed62443c77e878e267b1", + "zh:f2b749e6c6b77b26e643bbecc829977270cfefab106d5ea57e5a83e96d49cbdd", + "zh:fcc17e60e55c278535c332469727cf215eaea9ec81d38e2b5f05be127ee39a5b", ] } diff --git a/terraform/aws/README.md b/terraform/aws/README.md index 407d359..a7547a2 100644 --- a/terraform/aws/README.md +++ b/terraform/aws/README.md @@ -2,14 +2,14 @@ | Name | Version | |------|---------| -| [aws](#requirement\_aws) | ~> 3.47 | +| [aws](#requirement\_aws) | ~> 4.2.0 | | [wireguard](#requirement\_wireguard) | ~> 0.1.3 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | 3.74.2 | +| [aws](#provider\_aws) | 4.2.0 | | [cloudinit](#provider\_cloudinit) | 2.2.0 | | [external](#provider\_external) | 2.2.0 | | [http](#provider\_http) | 2.1.0 | @@ -31,7 +31,7 @@ No modules. | [wireguard_asymmetric_key.client](https://registry.terraform.io/providers/OJFord/wireguard/latest/docs/resources/asymmetric_key) | resource | | [wireguard_asymmetric_key.server](https://registry.terraform.io/providers/OJFord/wireguard/latest/docs/resources/asymmetric_key) | resource | | [aws_ami.ubuntu](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) | data source | -| [aws_subnet_ids.subnets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source | +| [aws_subnets.subnets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets) | data source | | [aws_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source | | [cloudinit_config.wireguard](https://registry.terraform.io/providers/hashicorp/cloudinit/latest/docs/data-sources/config) | data source | | [external_external.qr](https://registry.terraform.io/providers/hashicorp/external/latest/docs/data-sources/external) | data source | diff --git a/terraform/aws/ec2.tf b/terraform/aws/ec2.tf index 43d6c3b..e5dad76 100644 --- a/terraform/aws/ec2.tf +++ b/terraform/aws/ec2.tf @@ -1,6 +1,6 @@ resource "aws_instance" "wireguard" { ami = data.aws_ami.ubuntu.id - subnet_id = tolist(data.aws_subnet_ids.subnets.ids)[0] + subnet_id = data.aws_subnets.subnets.ids[0] instance_type = "t3.nano" key_name = aws_key_pair.wireguard.key_name vpc_security_group_ids = [aws_security_group.wireguard.id] @@ -70,8 +70,11 @@ data "aws_vpc" "default" { default = true } -data "aws_subnet_ids" "subnets" { - vpc_id = data.aws_vpc.default.id +data "aws_subnets" "subnets" { + filter { + name = "vpc-id" + values = [data.aws_vpc.default.id] + } } data "aws_ami" "ubuntu" { diff --git a/terraform/aws/main.tf b/terraform/aws/main.tf index d4dbf33..c0607e8 100644 --- a/terraform/aws/main.tf +++ b/terraform/aws/main.tf @@ -8,7 +8,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = "~> 3.47" + version = "~> 4.2.0" } wireguard = { source = "OJFord/wireguard"