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

initial-commit #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "gitlab-runner",
"image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu-22.04",
"features": {
"ghcr.io/devcontainers/features/terraform:1.3.5": {
"version": "1.6.1",
"terragrunt": "0.52.1"
},
"ghcr.io/devcontainers-contrib/features/pre-commit:2.0.9": {
"version": "3.4.0"
}
}
}
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
default_language_version:
python: python3

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
args:
- --markdown-linebreak-ext=md
- id: check-merge-conflict
- id: no-commit-to-branch
args:
- "--branch"
- "main"
- id: check-symlinks
- id: check-added-large-files
- id: check-json
- id: check-yaml
- repo: https://github.com/markdownlint/markdownlint
rev: v0.13.0
hooks:
- id: markdownlint
- repo: https://github.com/maxbrunet/pre-commit-renovate
rev: 37.31.1
hooks:
- id: renovate-config-validator
4 changes: 4 additions & 0 deletions backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
terraform {
backend "s3" {
}
}
18 changes: 18 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module "ec2-instance" {
source = "terraform-aws-modules/ec2-instance/aws"
version = "5.5.0"

name = "runner-instance"

instance_type = var.instance_type
key_name = var.key_name
monitoring = true
vpc_security_group_ids = ["sg-12345678"]
subnet_id = "subnet-eddcdzz4"

tags = {
Project = var.project
User = var.user
Environment = var.environment
}
}
10 changes: 10 additions & 0 deletions providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
provider "gitlab" {
token = var.token
base_url = var.base_url
insecure = var.insecure
}

provider "aws" {
region = var.aws_region
profile = var.aws_profile
}
80 changes: 80 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>platform-engineering-org/.github"
],
"customManagers": [
{
"customType": "regex",
"matchStringsStrategy": "combination",
"fileMatch": [
"variables.tf"
],
"matchStrings": [
"variable\\s*\"runner_version\"",
"description",
"type",
"default\\s*=\\s*\"(?<currentValue>.*)\""
],
"depNameTemplate": "gitlab-org/gitlab-runner",
"datasourceTemplate": "gitlab-releases",
"extractVersionTemplate": "^v?(?<version>.*)$"
},
{
"customType": "regex",
"fileMatch": [".devcontainer/devcontainer.json"],
"matchStrings": [
"\"image\": \"(?<depName>mcr.microsoft.com/vscode/devcontainers/base):(?<currentValue>.*)\""
],
"datasourceTemplate": "docker"
},
{
"customType": "regex",
"fileMatch": [".devcontainer/devcontainer.json"],
"matchStrings": [
"\"(?<depName>ghcr.io/devcontainers/features/terraform):(?<currentValue>.*)\""
],
"datasourceTemplate": "docker"
},
{
"customType": "regex",
"matchStringsStrategy": "combination",
"fileMatch": [".devcontainer/devcontainer.json"],
"matchStrings": [
"\"ghcr.io/devcontainers/features/terraform\"",
"\"version\":\\s*\"(?<currentValue>.*)\""
],
"depNameTemplate": "hashicorp/terraform",
"datasourceTemplate": "github-releases"
},
{
"customType": "regex",
"fileMatch": [".devcontainer/devcontainer.json"],
"matchStrings": [
"\"(?<depName>terragrunt)\":\\s*\"(?<currentValue>.*)\""
],
"depNameTemplate": "gruntwork-io/terragrunt",
"datasourceTemplate": "github-releases",
"extractVersionTemplate": "^v?(?<version>.*)$"
},
{
"customType": "regex",
"fileMatch": [".devcontainer/devcontainer.json"],
"matchStrings": [
"\"(?<depName>ghcr.io/devcontainers-contrib/features/pre-commit):(?<currentValue>.*)\""
],
"datasourceTemplate": "docker"
},
{
"customType": "regex",
"matchStringsStrategy": "combination",
"fileMatch": [".devcontainer/devcontainer.json"],
"matchStrings": [
"\"ghcr.io/devcontainers-contrib/features/pre-commit\"",
"\"version\":\\s*\"(?<currentValue>.*)\""
],
"depNameTemplate": "pre-commit/pre-commit",
"datasourceTemplate": "github-releases"
}
]
}
87 changes: 87 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
variable "aws_region" {
description = "AWS region."
type = string
}

variable "aws_profile" {
description = "AWS profile."
type = string
default = "default"
}

variable "token" {
type = string
description = "Gitlab token"
sensitive = true
}

variable "insecure" {
type = string
description = "Do not verify certifcate if true"
default = true
}

variable "base_url" {
type = string
description = "gitlab api end point"
default = "https://gitlab.com/api/v4/"
}

variable "environment" {
description = "A name that identifies the environment, will used as prefix and for tagging."
type = string
default = "dev"
}

variable "runner_name" {
description = "Name of the runner, will be used in the runner config.toml"
type = string
default = "pe-runner"
}

variable "gitlab_url" {
description = "URL of the gitlab instance to connect to."
type = string
default = "https://gitlab.com"
}

variable "registration_token_runner" {
description = "Registration token for the runner."
type = string
sensitive = true
}

variable "timezone" {
description = "Name of the timezone that the runner will be used in."
type = string
default = "Europe/Amsterdam"
}

variable "project" {
description = "Project Name"
type = string
default = "Platform Engineering"
}

variable "user" {
description = "User name"
type = string
}

variable "runner_version" {
description = "Gitlab runner version"
type = string
default = "16.4.1"
}

variable "instance_type" {
description = "AWS instance type"
type = string
default = "t3.micro"
}

variable "key_name" {
description = "AWS instance type"
type = string
default = "t3.micro"
}
28 changes: 28 additions & 0 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.22.0"
}
gitlab = {
source = "gitlabhq/gitlab"
version = "16.4.1"
}
local = {
source = "hashicorp/local"
version = "2.4.0"
}
null = {
source = "hashicorp/null"
version = "3.2.1"
}
tls = {
source = "hashicorp/tls"
version = "4.0.4"
}
random = {
source = "hashicorp/random"
version = "3.5.1"
}
}
}