diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml old mode 100644 new mode 100755 diff --git a/.tflint.hcl b/.tflint.hcl old mode 100644 new mode 100755 diff --git a/IAM.md b/IAM.md old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 7e36f9e..0e333f4 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # AWS EC2 Keypair -![squareops_avatar] - -[squareops_avatar]: https://squareops.com/wp-content/uploads/2022/12/squareops-logo.png + + + + + ### [SquareOps Technologies](https://squareops.com/) Your DevOps Partner for Accelerating cloud journey.
@@ -43,14 +45,14 @@ The required IAM permissions to create resources from this module can be found [ | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.21 | -| [tls](#requirement\_tls) | >= 3.4 | +| [aws](#requirement\_aws) | >= 5.0.0 | +| [tls](#requirement\_tls) | >= 4.0.3 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.21 | +| [aws](#provider\_aws) | >= 5.0.0 | ## Modules @@ -68,9 +70,13 @@ The required IAM permissions to create resources from this module can be found [ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| [additional\_aws\_tags](#input\_additional\_aws\_tags) | Additional tags to be applied to AWS resources. | `map(string)` | `{}` | no | +| [aws\_region](#input\_aws\_region) | Name of the AWS region where S3 bucket is to be created. | `string` | `"us-east-1"` | no | +| [create\_private\_key](#input\_create\_private\_key) | Whether to create the private key or not. | `bool` | `true` | no | | [environment](#input\_environment) | Specifies the identifier for the environment where the key pair will be used. | `string` | `""` | no | -| [key\_name](#input\_key\_name) | Specifies the name to be assigned to the key pair that will be generated. | `string` | `""` | no | +| [key\_pair\_name](#input\_key\_pair\_name) | Specifies the name to be assigned to the key pair that will be generated. | `string` | `""` | no | | [ssm\_parameter\_path](#input\_ssm\_parameter\_path) | Specifies the SSM parameter name that will be used to store the generated key pair. | `string` | `"/example/ssm"` | no | +| [tags](#input\_tags) | Tags to be applied to AWS resources. | `map(string)` |
{
"Environment": "",
"Name": ""
}
| no | ## Outputs diff --git a/examples/complete/README.md b/examples/complete/README.md old mode 100644 new mode 100755 index 64dc23a..dd63621 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -21,8 +21,8 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.21 | -| [tls](#requirement\_tls) | >= 3.4 | +| [aws](#requirement\_aws) | >= 5.0.0 | +| [tls](#requirement\_tls) | >= 4.0.3 | ## Providers @@ -32,7 +32,7 @@ No providers. | Name | Source | Version | |------|--------|---------| -| [key\_pair](#module\_key\_pair) | squareops/keypair/aws | n/a | +| [key\_pair](#module\_key\_pair) | ../../ | n/a | ## Resources diff --git a/examples/complete/main.tf b/examples/complete/main.tf old mode 100644 new mode 100755 index 89fe4f2..5ed64c8 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -1,8 +1,12 @@ locals { name = "key" - region = "us-east-2" + aws_region = "us-east-2" environment = "prod" - additional_tags = { + tags = { + Environment = "stg" + Name = "key_pair" + } + additional_aws_tags = { Owner = "organization_name" Expires = "Never" Department = "Engineering" @@ -10,8 +14,8 @@ locals { } module "key_pair" { - source = "squareops/keypair/aws" - key_name = format("%s-%s-kp", local.environment, local.name) + source = "../../" + key_pair_name = format("%s-%s-kp", local.environment, local.name) environment = local.environment ssm_parameter_path = format("%s-%s-ssm", local.environment, local.name) #SSM parameter secret name } diff --git a/examples/complete/outputs.tf b/examples/complete/outputs.tf old mode 100644 new mode 100755 diff --git a/examples/complete/provider.tf b/examples/complete/provider.tf old mode 100644 new mode 100755 index c7c13b7..9cc09d7 --- a/examples/complete/provider.tf +++ b/examples/complete/provider.tf @@ -1,6 +1,6 @@ provider "aws" { - region = local.region + region = local.aws_region default_tags { - tags = local.additional_tags + tags = local.additional_aws_tags } -} \ No newline at end of file +} diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf old mode 100644 new mode 100755 index c2da4bc..0c19e8c --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -4,11 +4,11 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.21" + version = ">= 5.0.0" } tls = { source = "hashicorp/tls" - version = ">= 3.4" + version = ">= 4.0.3" } } } diff --git a/main.tf b/main.tf old mode 100644 new mode 100755 index a937119..d1ce582 --- a/main.tf +++ b/main.tf @@ -1,8 +1,8 @@ module "key_pair" { source = "terraform-aws-modules/key-pair/aws" version = "2.0.0" - key_name = var.key_name - create_private_key = true + key_name = var.key_pair_name + create_private_key = var.create_private_key } @@ -11,8 +11,5 @@ resource "aws_ssm_parameter" "ssm_ec2_keypair" { description = "Stores the private key of ec2 key pair" type = "SecureString" value = module.key_pair.private_key_pem - tags = { - Environment = var.environment - Name = var.ssm_parameter_path - } + tags = var.tags } diff --git a/outputs.tf b/outputs.tf old mode 100644 new mode 100755 diff --git a/variables.tf b/variables.tf old mode 100644 new mode 100755 index af191a3..6eb4a52 --- a/variables.tf +++ b/variables.tf @@ -1,4 +1,25 @@ -variable "key_name" { +variable "additional_aws_tags" { + description = "Additional tags to be applied to AWS resources." + type = map(string) + default = {} +} + +variable "tags" { + description = "Tags to be applied to AWS resources." + type = map(string) + default = { + Environment = "" + Name = "" + } +} + +variable "aws_region" { + description = "Name of the AWS region where S3 bucket is to be created." + default = "us-east-1" + type = string +} + +variable "key_pair_name" { description = "Specifies the name to be assigned to the key pair that will be generated." default = "" type = string @@ -15,3 +36,9 @@ variable "ssm_parameter_path" { default = "/example/ssm" type = string } + +variable "create_private_key" { + description = "Whether to create the private key or not." + default = true + type = bool +} diff --git a/version.tf b/version.tf old mode 100644 new mode 100755 index c2da4bc..0c19e8c --- a/version.tf +++ b/version.tf @@ -4,11 +4,11 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.21" + version = ">= 5.0.0" } tls = { source = "hashicorp/tls" - version = ">= 3.4" + version = ">= 4.0.3" } } }