diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2ce3418 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Versions + +* v1.0.0 -- {{ yyyy-mm-dd }} + - initial creation + diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/availabilty_zones.tf b/availabilty_zones.tf new file mode 100644 index 0000000..0684edb --- /dev/null +++ b/availabilty_zones.tf @@ -0,0 +1,25 @@ +data "aws_availability_zones" "zones" { + state = "available" +} + +data "aws_availability_zone" "zone" { + for_each = toset(data.aws_availability_zones.zones.names) + state = "available" + name = each.key +} + + +output "availability_zone_names" { + description = "VPC Availability zone name list" + value = data.aws_availability_zones.zones.names +} + +output "availability_zone_ids" { + description = "VPC Availability zone id list" + value = data.aws_availability_zones.zones.zone_ids +} + +output "availability_zone_suffixes" { + description = "VPC Availability zone suffix list" + value = [for k, v in data.aws_availability_zone.zone : v.name_suffix] +} diff --git a/data.tf b/data.tf new file mode 100644 index 0000000..16506e6 --- /dev/null +++ b/data.tf @@ -0,0 +1,7 @@ +data "aws_caller_identity" "current" {} + +data "aws_arn" "current" { + arn = data.aws_caller_identity.current.arn +} + +data "aws_region" "current" {} diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..262d64b --- /dev/null +++ b/examples/README.md @@ -0,0 +1,3 @@ +# Examples + +Create directories with specific examples and describe how to use the module in a variety of ways. diff --git a/locals.tf.initial b/locals.tf.initial new file mode 100644 index 0000000..2bd4d7f --- /dev/null +++ b/locals.tf.initial @@ -0,0 +1,9 @@ +locals { + account_id = var.account_id != "" ? var.account_id : data.aws_caller_identity.current.account_id + account_environment = data.aws_arn.current.partition == "aws-us-gov" ? "gov" : "ew" + + base_tags = { + "boc:tf_module_version" = local._module_version + "boc:created_by" = "terraform" + } +} diff --git a/prefixes.tf b/prefixes.tf new file mode 100644 index 0000000..d2ee1fe --- /dev/null +++ b/prefixes.tf @@ -0,0 +1,28 @@ +locals { + _prefixes = { + "efs" = "v-efs-" + "s3" = "v-s3-" + "ebs" = "v-ebs-" + "kms" = "k-kms-" + "role" = "r-" + "policy" = "p-" + "group" = "g-" + "security-group" = "" # "sg-" + # VPC + "vpc" = "" + "dhcp-options" = "" + "vpc-peer" = "vpcp-" + "route-table" = "route-" + "subnet" = "" + "vpc-endpoint" = "vpce-" + "elastic-ip" = "eip-" + "nat-gateway" = "nat-" + "internet-gateway" = "igw-" + "network-acl" = "nacl-" + "customer-gateway" = "cgw-" + "vpn-gateway" = "vpcg-" + "vpn-connection" = "vpn_" + "log-group" = "lg-" + "log-stream" = "lgs-" + } +} diff --git a/variables.common.availability_zones.tf b/variables.common.availability_zones.tf new file mode 100644 index 0000000..3e17e57 --- /dev/null +++ b/variables.common.availability_zones.tf @@ -0,0 +1,5 @@ +variable "availability_zones" { + description = "AWS Availability Zones to use (by default will use all available)" + type = list(string) + default = [] +} diff --git a/variables.common.tf b/variables.common.tf new file mode 100644 index 0000000..c77ef47 --- /dev/null +++ b/variables.common.tf @@ -0,0 +1,26 @@ +#--- +# account info +#--- +variable "account_id" { + description = "AWS Account ID (default will pull from current user)" + type = string + default = "" +} + +variable "account_alias" { + description = "AWS Account Alias" + type = string + default = "" +} + +variable "override_prefixes" { + description = "Override built-in prefixes by component. This should be used primarily for common infrastructure things" + type = map(string) + default = {} +} + +variable "tags" { + description = "AWS Tags to apply to appropriate resources" + type = map(string) + default = {} +} diff --git a/version.tf b/version.tf new file mode 100644 index 0000000..a0cd862 --- /dev/null +++ b/version.tf @@ -0,0 +1,3 @@ +locals { + _module_version = "0.0.0" +} diff --git a/versions.tf b/versions.tf new file mode 100644 index 0000000..4ba10ce --- /dev/null +++ b/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = ">= 3.66.0" + } + } +# required_version = ">= 0.13" +}