Skip to content

Commit

Permalink
👷 add build docker and terraform config
Browse files Browse the repository at this point in the history
Co-authored-by: Benoit Latinier <benoit@latinier.fr>
  • Loading branch information
GuillaumeJulien and blatinier committed Nov 17, 2023
1 parent 81972c8 commit af589bd
Show file tree
Hide file tree
Showing 11 changed files with 893 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- run: echo "First workflow was a success"
- uses: actions/checkout@v2
- name: Login to Docker
run: docker login rg.fr-par.scw.cloud/picnicdouille -u nologin -p ${{ secrets.SCWTOKEN }}
- name: Build API Container
run: |
cd backend
docker build -f Dockerfile --tag rg.fr-par.scw.cloud/picnicdouille/picnicdouille_app:${{ github.sha }} .
- name: Push Container in registry
run: docker push rg.fr-par.scw.cloud/picnicdouille/picnicdouille_app:${{ github.sha }}

on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo "First workflow was a failure"
- run: echo "CPT MICHEL"

23 changes: 23 additions & 0 deletions infrastructure/.terraform.lock.hcl

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

1 change: 1 addition & 0 deletions infrastructure/.terraform/modules/modules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"app","Source":"./app","Dir":"app"}]}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Terraform Provider for Scaleway

- [Provider Documentation Website](https://www.terraform.io/docs/providers/scaleway/index.html)
- Slack: [Scaleway-community Slack][slack-scaleway] ([#terraform][slack-terraform])
- [![Go Report Card](https://goreportcard.com/badge/github.com/scaleway/terraform-provider-scaleway/v2)](https://goreportcard.com/report/github.com/scaleway/terraform-provider-scaleway/v2)


[slack-scaleway]: https://slack.scaleway.com/
[slack-terraform]: https://scaleway-community.slack.com/app_redirect?channel=terraform

## Requirements

- [Terraform](https://www.terraform.io/downloads.html) 0.10.x
- [Go](https://golang.org/doc/install) 1.11 (to build the provider plugin)

## Building The Provider

Clone repository to: `$GOPATH/src/github.com/scaleway/terraform-provider-scaleway`

```sh
$ mkdir -p $GOPATH/src/github.com/scaleway; cd $GOPATH/src/github.com/scaleway
$ git clone git@github.com:scaleway/terraform-provider-scaleway.git
```

Enter the provider directory and build the provider

```sh
$ cd $GOPATH/src/github.com/scaleway/terraform-provider-scaleway
$ make build
```

## Using the provider

See the [Scaleway Provider Documentation](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs) to get started using the Scaleway provider.

## Developing the Provider

If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.13+ is *required*). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`.

To compile the provider, run `make build`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.

You have the option to [override](https://www.terraform.io/cli/config/config-file#development-overrides-for-provider-developers) the intended version

```sh
$ make build
...
$ $GOPATH/bin/terraform-provider-scaleway
...
```

Please refer to the [TESTING.md](TESTING.md) for testing.
Binary file not shown.
34 changes: 34 additions & 0 deletions infrastructure/app/picnicdouille.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
terraform {
required_providers {
scaleway = {
source = "scaleway/scaleway"
}
}
required_version = ">= 0.13"
}

provider "scaleway" {
zone = "fr-par-1"
region = "fr-par"
}

resource scaleway_container_namespace main {
name = "picnicdouille-app"
description = "application de l'équipe rose pour tirer au sort"
}

resource scaleway_container main {
name = "picnicdouille-container"
description = "environment variables test"
namespace_id = scaleway_container_namespace.main.id
registry_image = "${scaleway_container_namespace.main.registry_endpoint}/alpine:test"
port = 5000
cpu_limit = 70
memory_limit = 128
min_scale = 1
max_scale = 2
privacy = "private"
protocol = "http1"
deploy = true
}

18 changes: 18 additions & 0 deletions infrastructure/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

module "app" {
source = "./app"
}

terraform {
required_providers {
scaleway = {
source = "scaleway/scaleway"
}
}
required_version = ">= 0.13"
}

provider "scaleway" {
zone = "fr-par-1"
region = "fr-par"
}
38 changes: 38 additions & 0 deletions infrastructure/terraform.tfstate
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"version": 4,
"terraform_version": "1.6.4",
"serial": 4,
"lineage": "bf607824-72dd-1aaa-1032-de58b905ca0a",
"outputs": {},
"resources": [
{
"module": "module.app",
"mode": "managed",
"type": "scaleway_container_namespace",
"name": "main",
"provider": "module.app.provider[\"registry.terraform.io/scaleway/scaleway\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"description": "application de l'équipe rose pour tirer au sort",
"destroy_registry": false,
"environment_variables": null,
"id": "fr-par/f6c18f69-e32c-4530-b4b6-a39a895c1d37",
"name": "picnicdouille-app",
"organization_id": "db28676e-35db-4caf-ad4e-91219b4e57de",
"project_id": "db28676e-35db-4caf-ad4e-91219b4e57de",
"region": "fr-par",
"registry_endpoint": "rg.fr-par.scw.cloud/funcscwpicnicdouilleappe5tbjgmc",
"registry_namespace_id": "5be7bae4-b4f4-4b74-a86a-8072de8719cc",
"secret_environment_variables": null,
"timeouts": null
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlZmF1bHQiOjMwMDAwMDAwMDAwMCwiZGVsZXRlIjozMDAwMDAwMDAwMDAsInJlYWQiOjMwMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMDB9fQ=="
}
]
}
],
"check_results": null
}
9 changes: 9 additions & 0 deletions infrastructure/terraform.tfstate.backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"version": 4,
"terraform_version": "1.6.4",
"serial": 1,
"lineage": "bf607824-72dd-1aaa-1032-de58b905ca0a",
"outputs": {},
"resources": [],
"check_results": null
}

0 comments on commit af589bd

Please sign in to comment.