-
-
Notifications
You must be signed in to change notification settings - Fork 1
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: more iac #46
Merged
Merged
feat: more iac #46
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c2fa4c8
chore: remove unused immich.app dns records
zackpollard c224e81
refactor: add mich ip as a local
zackpollard c31de6f
refactor: give all the cloudflare api keys proper names
zackpollard e79a16d
chore: add example.env for running locally
zackpollard c4fa4a9
feat: add r2 bucket and mich r2 cloudflare token
zackpollard afc7217
feat: add github org iac for secrets initially
zackpollard 5f328e5
chore: add and tell IDE's to add newlines to end of files
zackpollard 90b187b
feat: deploy github org iac through github actions
zackpollard 657ba75
docs: add manual setup steps required for IAC in github actions
zackpollard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Editor configuration, see https://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{md,mdx}] | ||
max_line_length = off | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
quote_type = single |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
### Project gitignore | ||
.env | ||
|
||
### VisualStudioCode template | ||
.vscode/* | ||
!.vscode/settings.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export CLOUDFLARE_ACCOUNT_ID= | ||
export CLOUDFLARE_API_TOKEN= | ||
export TF_STATE_POSTGRES_CONN_STR= | ||
export GITHUB_APP_INSTALLATION_ID= | ||
export GITHUB_APP_ID= | ||
export GITHUB_APP_PEM_FILE= | ||
export GITHUB_OWNER= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Manual Setup Steps | ||
|
||
This lists all the steps required to manually setup the IAC deployments in Github Actions. | ||
|
||
### Github Secrets | ||
|
||
| Secret | Secret Type | Description | | ||
|-----------------------------|-----------------|-----------------------------------------------------------------------------| | ||
| TF_APP_INSTALLATION_ID | Organisation | The installation ID of the Immich Github App | | ||
| TF_APP_ID | Organisation | The ID of the Immich Github App | | ||
| TF_APP_PEM_FILE | Repo (devtools) | The contents of the PEM file for the Github App | | ||
| TF_APP_GITHUB_OWNER | Organisation | The Github owner of the repository (immich-app) | | ||
| CLOUDFLARE_API_TOKEN | Repo (devtools) | The Cloudflare API token scoped to create new API keys | | ||
| CLOUDFLARE_ACCOUNT_ID | Organisation | The Cloudflare account ID | | ||
| TF_STATE_POSTGRES_CONN_STR | Organisation | The connection string for the Postgres database for Terraform state storage | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
locals { | ||
mich_ip = "162.55.86.82" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
resource "cloudflare_r2_bucket" "tf_state_database_backups" { | ||
account_id = var.cloudflare_account_id | ||
name = "tf-state-database-backups" | ||
location = "weur" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ terraform { | |
version = "4.34.0" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
locals { | ||
mich_cidrs = ["162.55.86.82/32"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
locals { | ||
cloudflare_account_id = get_env("CLOUDFLARE_ACCOUNT_ID") | ||
cloudflare_api_token = get_env("CLOUDFLARE_API_TOKEN") | ||
} | ||
|
||
inputs = { | ||
cloudflare_account_id = local.cloudflare_account_id | ||
cloudflare_api_token = local.cloudflare_api_token | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
terraform { | ||
backend "pg" { | ||
schema_name = "prod_github_org" | ||
} | ||
required_version = "~> 1.7" | ||
|
||
required_providers { | ||
github = { | ||
source = "integrations/github" | ||
version = "~> 6.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
provider "github" { | ||
app_auth {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
data "terraform_remote_state" "api_keys_state" { | ||
backend = "pg" | ||
|
||
config = { | ||
conn_str = var.tf_state_postgres_conn_str | ||
schema_name = "prod_cloudflare_api_keys" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
resource "github_actions_organization_secret" "cloudflare_api_token_pages_upload" { | ||
secret_name = "CLOUDFLARE_API_TOKEN_PAGES_UPLOAD" | ||
plaintext_value = data.terraform_remote_state.api_keys_state.outputs.terraform_key_cloudflare_pages_upload | ||
visibility = "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
terraform { | ||
source = "." | ||
|
||
extra_arguments custom_vars { | ||
commands = get_terraform_commands_that_need_vars() | ||
} | ||
} | ||
|
||
include "root" { | ||
path = find_in_parent_folders("root.hcl") | ||
} | ||
|
||
dependencies { | ||
paths = ["../../cloudflare/api-keys"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
variable "tf_state_postgres_conn_str" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we (maybe later?) want to scope this to only the immich-app repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've mostly been pretty lax with anything but the master keys, but we can scope this if you want to reasonably easily