generated from cloudposse/terraform-example-module
-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
394 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,54 @@ | ||
module "example" { | ||
provider "aws" { | ||
region = var.region | ||
} | ||
|
||
module "vpc" { | ||
source = "cloudposse/vpc/aws" | ||
version = "v0.18.2" | ||
|
||
cidr_block = "10.0.0.0/16" | ||
|
||
context = module.this.context | ||
} | ||
|
||
# Create new one security group | ||
|
||
module "new_security_group" { | ||
source = "../.." | ||
|
||
vpc_id = module.vpc.vpc_id | ||
sg_rules = var.sg_rules | ||
|
||
context = module.this.context | ||
} | ||
|
||
# Create rules for pre-created security group | ||
|
||
resource "aws_security_group" "external" { | ||
name_prefix = format("%s-%s-", module.this.id, "external") | ||
vpc_id = module.vpc.vpc_id | ||
tags = module.this.tags | ||
} | ||
|
||
module "external_security_group" { | ||
source = "../.." | ||
|
||
example = var.example | ||
vpc_id = module.vpc.vpc_id | ||
sg_id = aws_security_group.external.id | ||
sg_rules = var.sg_rules | ||
security_group_enabled = false | ||
|
||
context = module.this.context | ||
} | ||
|
||
# Disabled module | ||
|
||
module "disabled_security_group" { | ||
source = "../.." | ||
|
||
vpc_id = module.vpc.vpc_id | ||
sg_id = aws_security_group.external.id | ||
sg_rules = var.sg_rules | ||
context = module.this.context | ||
enabled = false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,44 @@ | ||
output "id" { | ||
description = "ID of the created example" | ||
value = module.example.id | ||
output "new_sg_id" { | ||
description = "The new one Security Group ID" | ||
value = module.new_security_group.sg_id | ||
} | ||
|
||
output "example" { | ||
description = "Output \"example\" from example module" | ||
value = module.example.example | ||
output "new_sg_arn" { | ||
description = "The new one Security Group ARN" | ||
value = module.new_security_group.sg_arn | ||
} | ||
|
||
output "random" { | ||
description = "Output \"random\" from example module" | ||
value = module.example.random | ||
output "new_sg_name" { | ||
description = "The new one Security Group Name" | ||
value = module.new_security_group.sg_name | ||
} | ||
|
||
output "external_sg_id" { | ||
description = "The external Security Group ID" | ||
value = module.external_security_group.sg_id | ||
} | ||
|
||
output "external_sg_arn" { | ||
description = "The external Security Group ARN" | ||
value = module.external_security_group.sg_arn | ||
} | ||
|
||
output "external_sg_name" { | ||
description = "The external Security Group Name" | ||
value = module.external_security_group.sg_name | ||
} | ||
|
||
output "disabled_sg_id" { | ||
description = "The disabled Security Group ID (should be empty)" | ||
value = module.disabled_security_group.sg_id | ||
} | ||
|
||
output "disabled_sg_arn" { | ||
description = "The disabled Security Group ARN (should be empty)" | ||
value = module.disabled_security_group.sg_arn | ||
} | ||
|
||
output "disabled_sg_name" { | ||
description = "The disabled Security Group Name (should be empty)" | ||
value = module.disabled_security_group.sg_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
variable "example" { | ||
type = string | ||
description = "The value which will be passed to the example module" | ||
variable "region" { | ||
type = string | ||
} | ||
|
||
variable "sg_rules" { | ||
type = list(any) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
terraform { | ||
required_version = ">= 0.12.0, < 0.14" | ||
required_version = ">= 0.12.26" | ||
|
||
required_providers { | ||
local = "~> 1.2" | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 2.0" | ||
} | ||
} | ||
} |
Oops, something went wrong.