Skip to content

Commit

Permalink
Merge pull request #68 from bschaatsbergen/some-improvements
Browse files Browse the repository at this point in the history
Overall improvements (pre-commit, comments, json syntax, etc)
  • Loading branch information
bschaatsbergen authored Jan 6, 2023
2 parents 88f7105 + 4898028 commit 5150ce0
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 13 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on:
pull_request:

name: "ShellCheck"

jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -e SC2154
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ repos:
exclude: ^examples/
- id: terraform_docs
exclude: ^examples/

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-merge-conflict
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.7.2
hooks:
- id: shellcheck
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ You can check the status of the certificate in the Google Cloud Console.

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.2.0 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
| <a name="requirement_google"></a> [google](#requirement\_google) | >=4.47.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_google"></a> [google](#provider\_google) | 4.47.0 |
| <a name="provider_google"></a> [google](#provider\_google) | >=4.47.0 |

## Modules

Expand Down
20 changes: 10 additions & 10 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
locals {
// The default port that Atlantis runs on is 4141.
# The default port that Atlantis runs on is 4141.
atlantis_port = lookup(var.env_vars, "ATLANTIS_PORT", 4141)
// Atlantis its home directory is "/home/atlantis".
# Atlantis its home directory is "/home/atlantis".
atlantis_data_dir = lookup(var.env_vars, "ATLANTIS_DATA_DIR", "/home/atlantis")
port_name = "atlantis"
}
Expand Down Expand Up @@ -35,8 +35,8 @@ resource "google_compute_instance_template" "atlantis" {
machine_type = var.machine_type
can_ip_forward = false

// Using the below scheduling configuration,
// the managed instance group will recreate the Spot VM if Compute Engine stops them
# Using the below scheduling configuration,
# the managed instance group will recreate the Spot VM if Compute Engine stops them
scheduling {
automatic_restart = var.spot_machine_enabled ? false : true
preemptible = var.spot_machine_enabled ? true : false
Expand All @@ -45,7 +45,7 @@ resource "google_compute_instance_template" "atlantis" {
instance_termination_action = var.spot_machine_enabled ? "STOP" : null
}

// Ephemeral OS boot disk
# Ephemeral OS boot disk
disk {
source_image = data.google_compute_image.cos.self_link
auto_delete = true
Expand All @@ -61,7 +61,7 @@ resource "google_compute_instance_template" "atlantis" {
}
}

// Persistent disk for Atlantis
# Persistent disk for Atlantis
disk {
device_name = "atlantis-disk-0"
disk_type = "pd-ssd"
Expand Down Expand Up @@ -94,8 +94,8 @@ resource "google_compute_instance_template" "atlantis" {

project = var.project

// Instance Templates cannot be updated after creation with the Google Cloud Platform API.
// In order to update an Instance Template, Terraform will destroy the existing resource and create a replacement
# Instance Templates cannot be updated after creation with the Google Cloud Platform API.
# In order to update an Instance Template, Terraform will destroy the existing resource and create a replacement
lifecycle {
create_before_destroy = true
}
Expand All @@ -108,9 +108,9 @@ module "atlantis" {
container = {
image = var.image
securityContext = {
privileged : true
privileged = true
}
tty : true
tty = true
env = [for key, value in var.env_vars : {
name = key
value = value
Expand Down
3 changes: 3 additions & 0 deletions startup-script.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

# Exit immediately if a command returns a non-zero code
set -e

cat > /etc/systemd/system/atlantis-chown-disk.service <<EOF
[Unit]
Description=Chown the Atlantis mount
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 1.2.0"
required_version = ">= 0.13.0"

required_providers {
google = {
Expand Down

0 comments on commit 5150ce0

Please sign in to comment.