Skip to content

Commit

Permalink
Merge pull request #43 from isovalent/pr/hhoover/randomfix
Browse files Browse the repository at this point in the history
Random subnet fix
  • Loading branch information
hhoover committed Sep 13, 2024
2 parents 2e7d953 + 0eb35c2 commit 82bd0f4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
6 changes: 2 additions & 4 deletions ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ resource "random_id" "index" {
}

locals {
subnet_ids_list = tolist(data.aws_subnets.public.ids) // used for a random subnet
subnet_ids_random_index = random_id.index.dec % length(data.aws_subnets.public.ids) // used for a random subnet
instance_subnet_id = local.subnet_ids_list[local.subnet_ids_random_index] // used for a random subnet
subnet_ids_list = tolist(data.aws_subnets.public.ids) // used to distrubute nodes in subnets
}

// Create etcd instances
Expand Down Expand Up @@ -102,7 +100,7 @@ resource "aws_instance" "etcds" {
aws_security_group.etcd.id
]
associate_public_ip_address = true
subnet_id = local.instance_subnet_id
subnet_id = element(local.subnet_ids_list, count.index)

lifecycle {
ignore_changes = [
Expand Down
7 changes: 1 addition & 6 deletions examples/test-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@ provider "aws" {
region = "us-west-1"
}

provider "github" {
owner = "isovalent"
token = var.github_token
}

module "test_vpc" {
source = "git::ssh://git@github.com/isovalent/terraform-aws-vpc.git?ref=1.1"
source = "git::ssh://git@github.com/isovalent/terraform-aws-vpc.git?ref=v1.9"
providers = {
aws = aws.us_west_1
}
Expand Down
4 changes: 0 additions & 4 deletions examples/test-cluster/variables.tf

This file was deleted.

0 comments on commit 82bd0f4

Please sign in to comment.