Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sandbox): add-tf-to-sandbox #263

Merged
merged 9 commits into from
Jul 28, 2021
30 changes: 30 additions & 0 deletions sandbox/k8s/tf-sourceloop-sandbox/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# EditorConfig is awesome: http://EditorConfig.org
# Uses editorconfig to maintain consistent coding styles

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

[*.{tf,tfvars}]
indent_size = 2
indent_style = space

[*.md]
max_line_length = 0
trim_trailing_whitespace = false

[Makefile]
tab_width = 2
indent_style = tab

[COMMIT_EDITMSG]
max_line_length = 0
14 changes: 14 additions & 0 deletions sandbox/k8s/tf-sourceloop-sandbox/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# terraform
*.tf text=auto eol=lf

# dot files
*.gitattributes text=auto eol=lf
*.yaml text=auto eol=lf
*.yml text=auto eol=lf
*.md text=auto eol=lf
.gitignore text=auto eol=lf
.editorconfig text=auto eol=lf
.terraform-version text=auto eol=lf

# golang
*.go text=auto eol=lf
6 changes: 6 additions & 0 deletions sandbox/k8s/tf-sourceloop-sandbox/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.terraform
terraform.tfstate
*.tfstate*
terraform.tfvars
*.backup
venv/
11 changes: 11 additions & 0 deletions sandbox/k8s/tf-sourceloop-sandbox/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.50.0
hooks:
- id: terraform_fmt
- id: terraform_docs
- repo: git://github.com/dnephin/pre-commit-golang
rev: v0.4.0
hooks:
- id: go-fmt
- id: go-lint
1 change: 1 addition & 0 deletions sandbox/k8s/tf-sourceloop-sandbox/.terraform-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
latest:^0.14
57 changes: 57 additions & 0 deletions sandbox/k8s/tf-sourceloop-sandbox/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 88 additions & 0 deletions sandbox/k8s/tf-sourceloop-sandbox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# tf-sourceloop-sandbox

> This project was generated by [generator-tf-module](https://github.com/sudokar/generator-tf-module)

## Overview

k8s managed by Terraform for the Sourceloop sandbox

## Usage

```hcl
module "tf-sourceloop-sandbox" {
source = "git::ssh://"
}
```

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| null | ~> 2.1 |

## Providers

| Name | Version |
|------|---------|
| null | ~> 2.1 |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| mandatory | this field is mandatory | `string` | n/a | yes |
| optional | this field is optional | `string` | `"default_value"` | no |

## Outputs

| Name | Description |
|------|-------------|
| output\_name | description for output\_name |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

## Development

### Prerequisites

- [terraform](https://learn.hashicorp.com/terraform/getting-started/install#installing-terraform)
- [terraform-docs](https://github.com/segmentio/terraform-docs)
- [pre-commit](https://pre-commit.com/#install)
- [golang](https://golang.org/doc/install#install)
- [golint](https://github.com/golang/lint#installation)

### Configurations

- Configure pre-commit hooks
```sh
pre-commit install
```


- Configure golang deps for tests
```sh
> go get github.com/gruntwork-io/terratest/modules/terraform
> go get github.com/stretchr/testify/assert
```



### Tests

- Tests are available in `test` directory

- In the test directory, run the below command
```sh
go test
```



## Authors

This project is authored by below people

- SourceFuse

> This project was generated by [generator-tf-module](https://github.com/sudokar/generator-tf-module)
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
# network/sourceloop-sanbox: "true"
io.sourceloop.service: audit-ms-example
name: audit-ms-example
namespace: sourceloop-sandbox
spec:
replicas: 1
selector:
matchLabels:
io.sourceloop.service: audit-ms-example
template:
metadata:
labels:
io.sourceloop.service: audit-ms-example
spec:
containers:
- env:
- name: DB_DATABASE
value: audit_db
- name: DB_HOST
value: postgres.sourceloop-sandbox.svc.cluster.local
- name: DB_PASSWORD
value: changeme
- name: DB_PORT
value: "5432"
- name: DB_USER
value: postgres
- name: JWT_ISSUER
value: https://loopback4-microservice-catalog
- name: JWT_SECRET
value: i_am_a_strong_secret
- name: LOG_LEVEL
value: debug
- name: NODE_ENV
value: dev
- name: REDIS_DB
value: "0"
- name: REDIS_HOST
value: redis
- name: REDIS_PASSWORD
value: test
- name: REDIS_PORT
value: "6379"
image: localhost:32000/audit-ms-example
name: audit-ms-example
ports:
- containerPort: 3000
resources: { }
restartPolicy: Always
status: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
labels:
io.sourceloop.service: audit-ms-example
name: audit-ms-example
namespace: sourceloop-sandbox
spec:
type: LoadBalancer
ports:
- name: "3000"
port: 3000
targetPort: 3000
selector:
io.sourceloop.service: audit-ms-example
status:
loadBalancer: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: v1
kind: Pod
metadata:
labels:
# network/sourceloop-sanbox: "true"
io.sourceloop.service: audit-ms-migration
name: audit-ms-migration
namespace: sourceloop-sandbox
spec:
containers:
- args:
- sh
- -c
- sleep 60 && npm run db:migrate
env:
- name: DB_DATABASE
value: audit_db
- name: DB_HOST
value: postgres.sourceloop-sandbox.svc.cluster.local
- name: DB_PASSWORD
value: changeme
- name: DB_PORT
value: "5432"
- name: DB_USER
value: postgres
- name: JWT_ISSUER
value: https://loopback4-microservice-catalog
- name: JWT_SECRET
value: i_am_a_strong_secret
- name: LOG_LEVEL
value: debug
- name: NODE_ENV
value: dev
- name: REDIS_DB
value: "0"
- name: REDIS_HOST
value: redis
- name: REDIS_PASSWORD
value: test
- name: REDIS_PORT
value: "6379"
image: localhost:32000/audit-ms-example:latest
name: audit-ms-migration
resources: {}
restartPolicy: OnFailure
status: {}
Empty file.
Loading