Skip to content

Commit

Permalink
Feat: Updated the terraform version and fixed the tfsec warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolnagpal committed Aug 28, 2023
2 parents 22ffd9b + a3ef365 commit 7ca7f5d
Show file tree
Hide file tree
Showing 18 changed files with 160 additions and 131 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# These owners will be the default owners for everything in the repo.
* @anmolnagpal @clouddrove/approvers @clouddrove-ci
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## what
* Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?)
* Use bullet points to be concise and to the point.

## why
* Provide the justifications for the changes (e.g. business case).
* Describe why these changes were made (e.g. why do these commits fix the problem?)
* Use bullet points to be concise and to the point.

## references
* Link to any supporting jira issues or helpful documentation to add some context (e.g. stackoverflow).
* Use `closes #123`, if this PR closes a Jira issue `#123`
14 changes: 14 additions & 0 deletions .github/workflows/auto_assignee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Auto Assign PRs

on:
pull_request:
types: [opened, reopened]

workflow_dispatch:
jobs:
assignee:
uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@master
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
assignees: 'clouddrove-ci'
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@master
secrets: inherit
with:
branch: 'master'
branch: 'master'
22 changes: 11 additions & 11 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,42 @@ on:
- master

jobs:
readme-create:
readme:
name: 'readme-create'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v2.3.4
uses: actions/checkout@master

- name: 'Set up Python 3.7'
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: 'create readme'
uses: 'clouddrove/github-actions@v8.0'
uses: 'clouddrove/github-actions@v9.0.2'
with:
actions_subcommand: 'readme'
github_token: '${{ secrets.GITHUB}}'
github_token: '${{ secrets.GITHUB }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


- name: 'pre-commit check errors'
uses: pre-commit/action@v2.0.0
uses: pre-commit/action@v3.0.0
continue-on-error: true

- name: 'pre-commit fix errors'
uses: pre-commit/action@v2.0.0
- name: 'pre-commit fix erros'
uses: pre-commit/action@v3.0.0
continue-on-error: true

- name: 'push readme'
uses: 'clouddrove/github-actions@v8.0'
uses: 'clouddrove/github-actions@v9.0.2'
continue-on-error: true
with:
actions_subcommand: 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 'Slack Notification'
uses: clouddrove/action-slack@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,4 @@ jobs:

- name: Check Terraform format changes
run: terraform fmt --recursive

40 changes: 0 additions & 40 deletions .github/workflows/terratest.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/workflows/tf-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: tf-checks
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
jobs:
example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
with:
working_directory: './_example/'
11 changes: 11 additions & 0 deletions .github/workflows/tflint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: tf-lint
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
jobs:
tflint:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@master
secrets:
GITHUB: ${{ secrets.GITHUB }}
2 changes: 1 addition & 1 deletion .github/workflows/tfsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@master
secrets: inherit
with:
working_directory: '.'
working_directory: '.'
24 changes: 6 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@

<p align="center">

<a href="https://www.terraform.io">
<img src="https://img.shields.io/badge/Terraform-v1.1.7-green" alt="Terraform">
</a>
<a href="LICENSE.md">
<img src="https://img.shields.io/badge/License-APACHE-blue.svg" alt="Licence">
<a href="https://github.com/clouddrove/terraform-aws-sftp/releases/latest">
<img src="https://img.shields.io/github/release/clouddrove/terraform-aws-sftp.svg" alt="Latest Release">
</a>
<a href="https://github.com/clouddrove/terraform-aws-sftp/actions/workflows/tfsec.yml">
<img src="https://github.com/clouddrove/terraform-aws-sftp/actions/workflows/tfsec.yml/badge.svg" alt="tfsec">
</a>
<a href="https://github.com/clouddrove/terraform-aws-sftp/actions/workflows/terraform.yml">
<img src="https://github.com/clouddrove/terraform-aws-sftp/actions/workflows/terraform.yml/badge.svg" alt="static-checks">
<a href="LICENSE.md">
<img src="https://img.shields.io/badge/License-APACHE-blue.svg" alt="Licence">
</a>


Expand Down Expand Up @@ -57,12 +54,6 @@ We have [*fifty plus terraform modules*][terraform_modules]. A few of them are c

This module has a few dependencies:

- [Terraform 1.x.x](https://learn.hashicorp.com/terraform/getting-started/install.html)
- [Go](https://golang.org/doc/install)
- [github.com/stretchr/testify/assert](https://github.com/stretchr/testify)
- [github.com/gruntwork-io/terratest/modules/terraform](https://github.com/gruntwork-io/terratest)





Expand All @@ -79,11 +70,11 @@ Here is an example of how you can use this module in your inventory structure:
```hcl
module "sftp" {
source = "clouddrove/sftp/aws"
version = "0.15.0"
version = "1.3.0"
name = "sftp"
environment = "test"
label_order = ["name", "environment"]
key_path = "~/.ssh/id_rsa.pub"
public_key = ""
user_name = "ftp-user"
enable_sftp = true
s3_bucket_id = clouddrove_dev_s3_bucket
Expand All @@ -101,20 +92,17 @@ Here is an example of how you can use this module in your inventory structure:
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| attributes | Additional attributes (e.g. `1`). | `list(any)` | `[]` | no |
| delimiter | Delimiter to be used between `organization`, `environment`, `name` and `attributes`. | `string` | `"-"` | no |
| enable\_sftp | Set to false to prevent the module from creating any resources. | `bool` | `true` | no |
| endpoint\_type | 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 | `string` | `"PUBLIC"` | no |
| environment | Environment (e.g. `prod`, `dev`, `staging`). | `string` | `""` | no |
| identity\_provider\_type | The mode of authentication enabled for this service. The default value is SERVICE\_MANAGED, which allows you to store and access SFTP user credentials within the service. API\_GATEWAY. | `string` | `"SERVICE_MANAGED"` | no |
| key\_path | Name (e.g. `~/.ssh/id_rsa.pub`). | `string` | `""` | no |
| label\_order | Label order, e.g. `name`,`application`. | `list(any)` | `[]` | no |
| managedby | ManagedBy, eg 'CloudDrove'. | `string` | `"hello@clouddrove.com"` | no |
| name | Name (e.g. `app` or `cluster`). | `string` | `""` | no |
| public\_key | Name (e.g. `ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQ`). | `string` | `""` | no |
| repository | Terraform current module repo | `string` | `"https://github.com/clouddrove/terraform-aws-sftp"` | no |
| s3\_bucket\_id | The landing directory (folder) for a user when they log in to the server using their SFTP client. | `string` | n/a | yes |
| sub\_folder | Landind folder. | `string` | `""` | no |
| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`). | `map(any)` | `{}` | no |
| user\_name | User name for SFTP server. | `string` | n/a | yes |
| vpc\_id | VPC ID | `string` | `""` | no |

Expand Down
19 changes: 8 additions & 11 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,15 @@ github_repo: clouddrove/terraform-aws-sftp

# Badges to display
badges:
- name: "Terraform"
image: "https://img.shields.io/badge/Terraform-v1.1.7-green"
url: "https://www.terraform.io"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"
- name: "Latest Release"
image: "https://img.shields.io/github/release/clouddrove/terraform-aws-sftp.svg"
url: "https://github.com/clouddrove/terraform-aws-sftp/releases/latest"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-aws-sftp/actions/workflows/tfsec.yml/badge.svg"
url: "https://github.com/clouddrove/terraform-aws-sftp/actions/workflows/tfsec.yml"
- name: "static-checks"
image: "https://github.com/clouddrove/terraform-aws-sftp/actions/workflows/terraform.yml/badge.svg"
url: "https://github.com/clouddrove/terraform-aws-sftp/actions/workflows/terraform.yml"

- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"

# description of this project
description: |-
Expand All @@ -37,6 +33,7 @@ description: |-
include:
- "terraform.md"

# How to use this project
# How to use this project
usage : |-
### Simple Example
Expand All @@ -48,7 +45,7 @@ usage : |-
name = "sftp"
environment = "test"
label_order = ["name", "environment"]
key_path = "~/.ssh/id_rsa.pub"
public_key = ""
user_name = "ftp-user"
enable_sftp = true
s3_bucket_id = clouddrove_dev_s3_bucket
Expand Down
29 changes: 29 additions & 0 deletions _example/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
provider "aws" {
region = "eu-west-1"
}

module "s3_bucket" {
source = "clouddrove/s3/aws"
version = "1.3.0"

name = "clouddrove-sftp-bucket"
environment = "test"
label_order = ["environment", "name"]

versioning = true
acl = "private"
force_destroy = true
}

module "sftp" {
source = "../"
name = "sftp"
environment = "test"
label_order = ["environment", "name"]

enable_sftp = true
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDfjNc4A+atuEBaElnpQqFkBFgGc+kCslpXh/aKETl1Wh95tOy9IWHomegVxKB44OvB5s6I6HFwRa8MCpcAUnW3vD7hBwOv+PgJ0ZFUGYrl71doDHsWtfgoRhrKlhk2jjS7gOZrrYK2vg0859knhrmRQEm6snqFdZ6bLc6R/r0htgtgUx9mESZHfupL/lylOjBiEboQxpo1lp2MKEmksv5q+8A60ZN+mTEj6M4Zmbiw7ypGjcK8utgOyoJ58uWIMt76VW46M6FIGVymwnqBm5PUgThzTPhwVpIc4kTw2Ko1CF4l8fhHNHr698NNTkpol5QvFiBZIgbTGF9RBJyYpGN1XupY4UCrwLBFb5Sigu42lCfb2/wpuAPk5LpoUhdvrDYyzxMdFy0AhIs+3my9D5jNs2rHywoYzcGfrEwi8tLHRqaV+nOI4URk7GenzAQWbUeKwosgSyVv4XnAFrtHMx2oUN5iqAMwFeZH67gw9BkATiF0ZhExCHGILcLZTNJP2N0= anmol@clouddrove-Lenov"
user_name = "ftp-user"
s3_bucket_id = module.s3_bucket.id
endpoint_type = "PUBLIC"
}
9 changes: 9 additions & 0 deletions _example/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
output "id" {
value = module.sftp[*].id
description = "The Server ID of the Transfer Server (e.g. s-12345678)"
}

output "tags" {
value = module.sftp.tags
description = "A mapping of tags to assign to the SFTP."
}
34 changes: 0 additions & 34 deletions _test/sftp_test.go

This file was deleted.

Loading

0 comments on commit 7ca7f5d

Please sign in to comment.