Skip to content

Commit

Permalink
feat: Update examples as per latest code
Browse files Browse the repository at this point in the history
  • Loading branch information
13archit committed Sep 5, 2023
1 parent c52e4a0 commit f27d63f
Show file tree
Hide file tree
Showing 11 changed files with 155 additions and 200 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ updates:
open-pull-requests-limit: 3

- package-ecosystem: "terraform" # See documentation for possible values
directory: "/_example/single-account" # Location of package manifests
directory: "/_example/single_account" # Location of package manifests
schedule:
interval: "weekly"
# Add assignees
Expand All @@ -43,7 +43,7 @@ updates:
open-pull-requests-limit: 3

- package-ecosystem: "terraform" # See documentation for possible values
directory: "/_example/different-account" # Location of package manifests
directory: "/_example/multi_account" # Location of package manifests
schedule:
interval: "weekly"
# Add assignees
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tf-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
single-account-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
with:
working_directory: './_example/single-account/'
working_directory: './_example/single_account/'
different-account-example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
with:
working_directory: './_example/different-account/'
working_directory: './_example/multi_account/'
101 changes: 61 additions & 40 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ badges:
url: "LICENSE.md"

prerequesties:
- name: Terraform 1.4.6
- name: Terraform 1.5.6
url: https://learn.hashicorp.com/terraform/getting-started/install.html

# description of this project
Expand All @@ -43,46 +43,67 @@ usage : |-
### Transit Gateway For Single Account
```hcl
module "transit-gateway" {
source = "clouddrove/transit-gateway/aws"
name = "transit-gateway"
environment = "test"
enable = true
tgw_create = true
amazon_side_asn = 64512
auto_accept_shared_attachments = "enable"
default_route_table_propagation = "enable"
description = "This transit Gateway create for testung purpose"
#TGW Share
resource_share_enable = false
resource_share_allow_external_principals = true
resource_share_account_ids = ["XXXXXXXXXXXXX"]
# VPC Attachements
vpc_attachement_create = false # Enable After once create the subnets
vpc_id = module.vpc.vpc_id
destination_cidr_block = [ "10.0.0.0/8", "172.16.0.0/12"]
}
module "transit-gateway" {
depends_on = [module.vpc, module.subnets]
source = "./../../"
name = "app"
environment = "test"
tgw_create = true
amazon_side_asn = 64512
auto_accept_shared_attachments = "enable"
default_route_table_propagation = "enable"
description = "This transit Gateway create for testing purpose"
#TGW Share
resource_share_enable = true
resource_share_allow_external_principals = true
resource_share_account_ids = ["xxxxxxxxxxxx"]
# VPC Attachements
vpc_attachments = {
vpc1 = {
vpc_id = module.vpc.vpc_id
subnet_ids = module.subnets.public_subnet_id
transit_gateway_default_route_table_association = true
transit_gateway_default_route_table_propagation = true
# Below should be uncommented only when vpc and subnet are already deployed.
#vpc_route_table_ids = module.subnets.public_route_tables_id
#destination_cidr = ["10.11.0.0/16"]
},
vpc2 = {
vpc_id = module.vpc_other.vpc_id
subnet_ids = module.subnets_other.public_subnet_id
transit_gateway_default_route_table_association = false
transit_gateway_default_route_table_propagation = false
# Below should be uncommented only when vpc and subnet are already deployed.
#vpc_route_table_ids = module.subnets_other.public_route_tables_id
#destination_cidr = ["31.0.0.0/16", "53.0.0.0/16"]
}
}
}
```
### Transit Gateway Diffrent AWS Account
### Transit Gateway for Multi AWS Account
```hcl
module "transit-gateway" {
source = "clouddrove/transit-gateway/aws"
name = "transit-gateway"
environment = "test"
#Transit gateway invitation accepter
aws_ram_resource_share_accepter = true
resource_share_arn = "arn:aws:ram:eu-west-1:XXXXXXXXXXX:resource-share/XXXXXXXXXXXXXXXXXXXXXXXXXX"
# VPC Attachements
vpc_attachement_create = false # Enable After once create the subnets
vpc_id = module.vpc.vpc_id
use_existing_transit_gateway_id = true
transit_gateway_id = "tgw-XXXXXXXXXXX"
destination_cidr_block = ["10.0.0.0/8", "172.16.0.0/12"]
}
module "transit_gateway" {
depends_on = [module.vpc, module.subnets]
source = "./../../"
name = "app"
environment = "test"
tgw_create = false
#TGW Share
aws_ram_resource_share_accepter = true
resource_share_arn = "arn:aws:ram:eu-west-1:xxxxxxxxxx:resource-share/xxxxxxxxxxxxxxxxxxxxxxxxxx"
# VPC Attachements
transit_gateway_id = "tgw-xxxxxxxxxxx"
vpc_attachments = {
vpc1 = {
vpc_id = module.vpc.vpc_id
subnet_ids = module.subnets.public_subnet_id
transit_gateway_default_route_table_association = true
transit_gateway_default_route_table_propagation = true
# Below should be uncommented only when vpc and subnet are already deployed.
#vpc_route_table_ids = module.subnets.public_route_tables_id
#destination_cidr = ["10.10.0.0/16"]
}
}
}
```
147 changes: 0 additions & 147 deletions _example/different-account/example.tf

This file was deleted.

71 changes: 71 additions & 0 deletions _example/multi_account/example.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
provider "aws" {
region = "eu-west-2"
}

provider "aws" {
alias = "test"
assume_role {
role_arn = ""
}
region = "eu-west-2"
}

locals {
name = "app_1"
environment = "test"
}

##------------------------------------------------------------------------------
## VPC module call.
##------------------------------------------------------------------------------
module "vpc" {
source = "clouddrove/vpc/aws"
version = "2.0.0"
name = local.name
environment = local.environment
cidr_block = "10.11.0.0/16"
}

##------------------------------------------------------------------------------
## Subnet module call.
##------------------------------------------------------------------------------
module "subnets" {
source = "clouddrove/subnet/aws"
version = "2.0.0"
name = local.name
environment = local.environment
availability_zones = ["eu-west-2a", "eu-west-2b"]
vpc_id = module.vpc.vpc_id
type = "public"
igw_id = module.vpc.igw_id
nat_gateway_enabled = false
cidr_block = module.vpc.vpc_cidr_block
ipv6_cidr_block = module.vpc.ipv6_cidr_block
}

##------------------------------------------------------------------------------
## Transit-gateway module call for diff account.
##------------------------------------------------------------------------------
module "transit_gateway" {
depends_on = [module.vpc, module.subnets]
source = "./../../"
name = local.name
environment = local.environment
tgw_create = false
#TGW Share
aws_ram_resource_share_accepter = true
resource_share_arn = "arn:aws:ram:eu-west-1:xxxxxxxxxx:resource-share/xxxxxxxxxxxxxxxxxxxxxxxxxx"
# VPC Attachements
transit_gateway_id = "tgw-xxxxxxxxxxx"
vpc_attachments = {
vpc1 = {
vpc_id = module.vpc.vpc_id
subnet_ids = module.subnets.public_subnet_id
transit_gateway_default_route_table_association = true
transit_gateway_default_route_table_propagation = true
# Below should be uncommented only when vpc and subnet are already deployed.
#vpc_route_table_ids = module.subnets.public_route_tables_id
#destination_cidr = ["10.10.0.0/16"]
}
}
}
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit f27d63f

Please sign in to comment.