diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 4090802..ace54c8 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -8,5 +8,5 @@ jobs: secrets: GITHUB: ${{ secrets.GITHUB }} with: - tfcheck: 'example / Evaluate Terraform versions (1.5.0, ./_example/public)' + tfcheck: 'public / Check code format' ... diff --git a/.github/workflows/tf-checks.yml b/.github/workflows/tf-checks.yml index 380e4f7..7c6c002 100644 --- a/.github/workflows/tf-checks.yml +++ b/.github/workflows/tf-checks.yml @@ -5,7 +5,11 @@ on: pull_request: workflow_dispatch: jobs: - example: + public: uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.0.9 with: working_directory: './_example/public' + vpc: + uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.0.9 + with: + working_directory: './_example/vpc' diff --git a/.github/workflows/tflint.yml b/.github/workflows/tflint.yml index 0ba0ac7..a467f87 100644 --- a/.github/workflows/tflint.yml +++ b/.github/workflows/tflint.yml @@ -5,7 +5,7 @@ on: pull_request: workflow_dispatch: jobs: - tflint: + tf-lint: uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@1.0.9 secrets: - GITHUB: ${{ secrets.GITHUB }} + GITHUB: ${{ secrets.GITHUB }} \ No newline at end of file diff --git a/_example/public/example.tf b/_example/public/example.tf index 2628711..0f7e9c3 100644 --- a/_example/public/example.tf +++ b/_example/public/example.tf @@ -31,7 +31,6 @@ module "sftp" { label_order = ["environment", "name"] enable_sftp = true s3_bucket_name = module.s3_bucket.id - endpoint_type = "PUBLIC" workflow_details = { on_upload = { execution_role = "arn:aws:iam::1234567890:role/test-sftp-transfer-role" diff --git a/_example/public/variables.tf b/_example/public/variables.tf index 3b44b89..e69de29 100644 --- a/_example/public/variables.tf +++ b/_example/public/variables.tf @@ -1,14 +0,0 @@ -variable "sftp_users" { - type = list(object({ - username = string - password = string - home_dir = string - })) - default = [] -} - -variable "eip_enabled" { - type = bool - description = "Whether to provision and attach an Elastic IP to be used as the SFTP endpoint. An EIP will be provisioned per subnet." - default = false -} \ No newline at end of file diff --git a/_example/public/versions.tf b/_example/public/versions.tf index 5a227cd..8a25625 100644 --- a/_example/public/versions.tf +++ b/_example/public/versions.tf @@ -1,11 +1,11 @@ # Terraform version terraform { - required_version = ">= 1.5.0" + required_version = ">= 1.6.6" required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.9.0" + version = ">= 5.31.0" } } } \ No newline at end of file diff --git a/_example/vpc/example.tf b/_example/vpc/example.tf index 1d8939c..c659d70 100644 --- a/_example/vpc/example.tf +++ b/_example/vpc/example.tf @@ -120,7 +120,6 @@ module "sftp" { label_order = ["environment", "name"] eip_enabled = false s3_bucket_name = module.s3_bucket.id - sftp_users = var.sftp_users subnet_ids = module.subnets.private_subnet_id vpc_id = module.vpc.vpc_id restricted_home = true diff --git a/_example/vpc/variables.tf b/_example/vpc/variables.tf index ccbe686..e69de29 100644 --- a/_example/vpc/variables.tf +++ b/_example/vpc/variables.tf @@ -1,31 +0,0 @@ -variable "sftp_users" { - type = list(object({ - username = string - password = string - home_dir = string - })) - default = [] -} - -variable "eip_enabled" { - type = bool - description = "Whether to provision and attach an Elastic IP to be used as the SFTP endpoint. An EIP will be provisioned per subnet." - default = false -} - - -variable "workflow_details" { - type = object({ - on_upload = object({ - execution_role = string - workflow_id = string - }) - }) - description = "Workflow details for triggering the execution on file upload." - default = { - on_upload = { - execution_role = null - workflow_id = null - } - } -} \ No newline at end of file diff --git a/_example/vpc/versions.tf b/_example/vpc/versions.tf index 5a227cd..8a25625 100644 --- a/_example/vpc/versions.tf +++ b/_example/vpc/versions.tf @@ -1,11 +1,11 @@ # Terraform version terraform { - required_version = ">= 1.5.0" + required_version = ">= 1.6.6" required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.9.0" + version = ">= 5.31.0" } } } \ No newline at end of file diff --git a/main.tf b/main.tf index 1a176a0..c2b5011 100644 --- a/main.tf +++ b/main.tf @@ -22,12 +22,9 @@ module "labels" { # LOCALS ##---------------------------------------------------------------------------------- locals { - count = var.enabled s3_arn_prefix = "arn:${one(data.aws_partition.default[*].partition)}:s3:::" is_vpc = var.vpc_id != null - user_names = length(var.sftp_users) > 0 ? [for user in var.sftp_users : user.user_name] : [] - user_names_map = length(var.sftp_users) > 0 ? { for user in var.sftp_users : user.user_name => merge(user, { @@ -201,7 +198,7 @@ resource "aws_transfer_server" "transfer_server" { subnet_ids = var.subnet_ids security_group_ids = var.vpc_security_group_ids vpc_id = var.vpc_id - address_allocation_ids = var.eip_enabled ? aws_eip.sftp.*.id : var.address_allocation_ids + address_allocation_ids = var.eip_enabled ? aws_eip.sftp[*].id : var.address_allocation_ids } } lifecycle { diff --git a/variables.tf b/variables.tf index f6d0f4e..c77c64f 100644 --- a/variables.tf +++ b/variables.tf @@ -155,10 +155,4 @@ variable "workflow_details" { variable "enable_workflow" { type = bool default = false -} - -variable "endpoint_type" { - type = string - default = "PUBLIC" - description = "The type of endpoint that you want your SFTP server connect to. If you connect to a VPC (or VPC_ENDPOINT), your SFTP server isn't accessible over the public internet. If you want to connect your SFTP server via public internet, set PUBLIC. Defaults to PUBLIC" } \ No newline at end of file diff --git a/versions.tf b/versions.tf index 5a227cd..8a25625 100644 --- a/versions.tf +++ b/versions.tf @@ -1,11 +1,11 @@ # Terraform version terraform { - required_version = ">= 1.5.0" + required_version = ">= 1.6.6" required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.9.0" + version = ">= 5.31.0" } } } \ No newline at end of file