Skip to content

Commit

Permalink
feat: fix tflint
Browse files Browse the repository at this point in the history
  • Loading branch information
theprashantyadav committed Jul 31, 2023
1 parent 0ffb99c commit 4e25ce0
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 20 deletions.
11 changes: 11 additions & 0 deletions _example/different-account/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Terraform version
terraform {
required_version = ">= 1.4.6"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.1.0"
}
}
}
2 changes: 1 addition & 1 deletion _example/single-account/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
output "transit_gateway_id" {
value = module.transit-gateway.*.transit_gateway_id
value = module.transit-gateway[*].transit_gateway_id
description = "The ID of the transit-gateway."
}

Expand Down
11 changes: 11 additions & 0 deletions _example/single-account/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Terraform version
terraform {
required_version = ">= 1.4.6"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.1.0"
}
}
}
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ resource "aws_ec2_transit_gateway" "main" {
resource "aws_ec2_transit_gateway_vpc_attachment" "main" {
count = var.enable && var.vpc_attachement_create ? 1 : 0

transit_gateway_id = var.use_existing_transit_gateway_id == false ? join("", aws_ec2_transit_gateway.main.*.id) : var.transit_gateway_id
transit_gateway_id = var.use_existing_transit_gateway_id == false ? join("", aws_ec2_transit_gateway.main[*].id) : var.transit_gateway_id
subnet_ids = var.subnet_ids
vpc_id = var.vpc_id
transit_gateway_default_route_table_association = var.transit_gateway_default_route_table_association
Expand Down Expand Up @@ -73,7 +73,7 @@ resource "aws_ram_principal_association" "main" {
count = var.enable && var.resource_share_enable ? length(var.resource_share_account_ids) : 0

principal = element(var.resource_share_account_ids, count.index)
resource_share_arn = join("", aws_ram_resource_share.main.*.id)
resource_share_arn = join("", aws_ram_resource_share.main[*].id)
}

##------------------------------------------------------------------------------
Expand All @@ -99,7 +99,7 @@ resource "aws_route" "main" {

route_table_id = element(distinct(sort(data.aws_route_tables.main[0].ids)), count.index)
destination_cidr_block = element(distinct(sort(var.destination_cidr_block)), ceil(count.index / length(var.destination_cidr_block), ), )
transit_gateway_id = var.use_existing_transit_gateway_id == false ? join("", aws_ec2_transit_gateway.main.*.id) : var.transit_gateway_id
transit_gateway_id = var.use_existing_transit_gateway_id == false ? join("", aws_ec2_transit_gateway.main[*].id) : var.transit_gateway_id
depends_on = [
data.aws_route_tables.main,
aws_ec2_transit_gateway_vpc_attachment.main,
Expand Down
6 changes: 3 additions & 3 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#Description : Manages an EC2 Transit Gateway.

output "transit_gateway_id" {
value = join("", aws_ec2_transit_gateway.main.*.id)
value = join("", aws_ec2_transit_gateway.main[*].id)
description = "The ID of the Transit Gateway."
}

output "resource_share_arn" {
value = join("", aws_ram_principal_association.main.*.resource_share_arn)
value = join("", aws_ram_principal_association.main[*].resource_share_arn)
description = "The ARN of the RAM."
}

Expand All @@ -34,4 +34,4 @@ output "ec2_transit_gateway_vpc_attachment" {
output "ram_resource_share_id" {
value = try(aws_ram_resource_share.main[0].id, "")
description = "The Amazon Resource Name (ARN) of the resource share"
}
}
15 changes: 2 additions & 13 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,16 @@ variable "label_order" {
description = "Label order, e.g. `name`."
}

variable "attributes" {
type = list(any)
default = []
description = "Additional attributes (e.g. `1`)."
}

variable "tags" {
type = map(any)
default = {}
description = "Additional tags (e.g. map(`BusinessUnit`,`XYZ`)."
}

variable "managedby" {
type = string
default = "anmol@clouddrove.com"
description = "ManagedBy, eg 'CloudDrove' or 'AnmolNagpal'."
}

variable "enable" {
description = "Whether or not to enable the entire module or not."
type = bool
default = true
description = "Whether or not to enable the entire module or not."
}

# Transit Gateway
Expand Down

0 comments on commit 4e25ce0

Please sign in to comment.