Skip to content

Commit 262eb54

Browse files
committed
Upgrade AWS provider to 6.10 and add region variable
1 parent 908eec5 commit 262eb54

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

integrations/terraform/ec2-private-influxdb/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The EC2 instance deployed by this sample is referred to as a "bastion host," mea
3939

4040
### Tags
4141

42-
[Tagging AWS resources](https://aws.amazon.com/solutions/guidance/tagging-on-aws/) is useful. To tag all resources, define `default_tags` in the `aws` provider block, at the top of [`main.tf`](./main.tf):
42+
[Tagging AWS resources](https://aws.amazon.com/solutions/guidance/tagging-on-aws/) is useful. To tag all resources, define `default_tags` in an `aws` provider block, in [`main.tf`](./main.tf):
4343

4444
```terraform
4545
provider "aws" {

integrations/terraform/ec2-private-influxdb/main.tf

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,48 @@ terraform {
33
required_providers {
44
aws = {
55
source = "hashicorp/aws"
6-
version = "~> 5.96.0"
6+
version = "~> 6.10.0"
77
}
88
}
99
}
1010

11-
provider "aws" {
12-
region = "us-west-2"
13-
}
14-
1511
resource "aws_vpc" "vpc" {
1612
cidr_block = "10.0.0.0/16"
13+
region = var.region
1714
}
1815

1916
# Private subnet used by the Timestream for InfluxDB instance.
2017
resource "aws_subnet" "private_subnet" {
2118
vpc_id = aws_vpc.vpc.id
2219
cidr_block = "10.0.1.0/24"
2320
map_public_ip_on_launch = false
21+
region = var.region
2422
}
2523

2624
# Public subnet used by the EC2 bastion host.
2725
resource "aws_subnet" "public_subnet" {
2826
vpc_id = aws_vpc.vpc.id
2927
cidr_block = "10.0.2.0/24"
3028
map_public_ip_on_launch = true
29+
region = var.region
3130
}
3231

3332
resource "aws_internet_gateway" "internet_gateway" {
3433
vpc_id = aws_vpc.vpc.id
34+
region = var.region
3535
}
3636

3737
resource "aws_route" "test_route" {
3838
route_table_id = aws_vpc.vpc.main_route_table_id
3939
destination_cidr_block = "0.0.0.0/0"
4040
gateway_id = aws_internet_gateway.internet_gateway.id
41+
region = var.region
4142
}
4243

4344
resource "aws_route_table_association" "route_table_association" {
4445
subnet_id = aws_subnet.public_subnet.id
4546
route_table_id = aws_vpc.vpc.main_route_table_id
47+
region = var.region
4648
}
4749

4850
resource "aws_security_group" "ec2_security_group" {
@@ -64,6 +66,7 @@ resource "aws_security_group" "ec2_security_group" {
6466
protocol = "-1"
6567
cidr_blocks = ["0.0.0.0/0"]
6668
}
69+
region = var.region
6770
}
6871

6972
resource "aws_security_group" "timestream_influxdb_security_group" {
@@ -78,6 +81,7 @@ resource "aws_security_group" "timestream_influxdb_security_group" {
7881
protocol = "tcp"
7982
security_groups = [aws_security_group.ec2_security_group.id]
8083
}
84+
region = var.region
8185
}
8286

8387
data "aws_ami" "amzn-linux-2023-ami" {
@@ -88,6 +92,7 @@ data "aws_ami" "amzn-linux-2023-ami" {
8892
name = "name"
8993
values = ["al2023-ami-2023.*-arm64"]
9094
}
95+
region = var.region
9196
}
9297

9398
resource "aws_instance" "ec2_instance" {
@@ -109,6 +114,7 @@ resource "aws_instance" "ec2_instance" {
109114
tags = {
110115
Name = var.ec2_instance_name
111116
}
117+
region = var.region
112118
}
113119

114120
resource "aws_timestreaminfluxdb_db_instance" "timestream_influxdb_instance" {
@@ -123,6 +129,7 @@ resource "aws_timestreaminfluxdb_db_instance" "timestream_influxdb_instance" {
123129
port = 8086
124130
organization = "organization"
125131
publicly_accessible = false
132+
region = var.region
126133
}
127134

128135
output "instance_url" {

integrations/terraform/ec2-private-influxdb/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
variable "region" {
2+
type = string
3+
default = "us-west-2"
4+
}
5+
16
variable "username" {
27
type = string
38
default = "admin"

0 commit comments

Comments
 (0)