Skip to content

Commit d102606

Browse files
committed
fix: typos and minor issues
Signed-off-by: matttrach <matt.trachier@suse.com>
1 parent 6abbb8d commit d102606

14 files changed

Lines changed: 32 additions & 22 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ run.sh
3232
static_files.txt
3333
* copy
3434
*.tfbackend
35+
*.log

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ These tools will need to be installed on the machine running Terraform:
4343
- helm (v3)
4444
- git
4545
- awscli (if using ipv6)
46-
- age (encrytion tool used for storing env secrets when necessary) https://github.com/filosottile/age
46+
- age (encryption tool used for storing env secrets when necessary) https://github.com/filosottile/age
4747

4848
Check out the flake.nix file for a list of packages that we use when developing and testing.
4949

examples/prod/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ locals {
3131
acme_server_url = var.acme_server_url
3232
owner = var.owner
3333
rke2_version = var.rke2_version
34-
rke2_minor = split(".", local.rke2_version)[1]
34+
rke2_minor = tonumber(split(".", local.rke2_version)[1])
3535
default_ingress = local.rke2_minor >= 35 ? "traefik" : "nginx"
3636
local_file_path = var.file_path
3737
runner_ip = chomp(data.http.myip.response_body) # "runner" is the server running Terraform

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
devShells.default = pkgs.mkShell {
143143
buildInputs = [ devShellPackage ];
144144
shellHook = ''
145-
while read word; do echo -e "*$word\n#" | aspell -a --dont-validate-words 2&>/dev/null; done < aspell_custom.txt
145+
while read word; do echo -e "*$word\n#" | aspell -a --dont-validate-words 2>/dev/null; done < aspell_custom.txt
146146
export PS1="nix:# ";
147147
'';
148148
};

get-pr-comments.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This gets all of the comments for a PR, helpful when writing with an agent.
2+
# Expects your environment to have GITHUB_TOKEN with a PAT that can access the API.
3+
PROJECT="rancher/terraform-rancher2-aws"
4+
PULL_ID=$1
5+
curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
6+
-H "Accept: application/vnd.github+json" \
7+
"https://api.github.com/repos/$PROJECT/pulls/${PULL_ID}/comments" | \
8+
jq -r '.[] | "File: \(.path)\nLine: \(.line)\nDiff:\n\(.diff_hunk)\n\nComment:\n\(.body)\n\n========================================\n"'

modules/deploy/create.sh.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ fi
5050
# Set up plugin cache directory
5151
# shellcheck disable=SC2154
5252
if [ ! -d "${plugin_cache}" ]; then
53-
install -d "$TF_PLUGIN_CACHE_DIR"
53+
install -d "${plugin_cache}"
5454
fi
5555
if [ -n "$TF_PLUGIN_CACHE_DIR" ]; then
5656
# shellcheck disable=SC2154
57-
cp -r "$TF_PLUGIN_CACHE_DIR" "${plugin_cache}"
57+
cp -a "$TF_PLUGIN_CACHE_DIR/." "${plugin_cache}/" 2>/dev/null || true
5858
fi
5959
# shellcheck disable=SC2154
6060
export TF_PLUGIN_CACHE_DIR="${plugin_cache}"

modules/deploy/destroy.sh.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ fi
4949
# Set up plugin cache directory
5050
# shellcheck disable=SC2154
5151
if [ ! -d "${plugin_cache}" ]; then
52-
install -d "$TF_PLUGIN_CACHE_DIR"
52+
install -d "${plugin_cache}"
5353
fi
5454

5555
if [ -n "$TF_PLUGIN_CACHE_DIR" ]; then
5656
# shellcheck disable=SC2154
57-
cp -r "$TF_PLUGIN_CACHE_DIR" "${plugin_cache}"
57+
cp -a "$TF_PLUGIN_CACHE_DIR/." "${plugin_cache}/" 2>/dev/null || true
5858
fi
5959

6060
# shellcheck disable=SC2154

modules/deploy/main.tf

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ resource "file_local" "write_tmp_inputs" {
119119
directory = local.tf_data_dir
120120
name = "inputs.tmp"
121121
contents = local.inputs
122-
permissions = "0755"
122+
permissions = "0600"
123123
}
124124
resource "file_local_snapshot" "persist_inputs" {
125125
depends_on = [
@@ -140,9 +140,10 @@ resource "file_local" "instantiate_inputs_snapshot" {
140140
file_local.write_tmp_inputs,
141141
file_local_snapshot.persist_inputs,
142142
]
143-
directory = local.deploy_path
144-
name = "inputs.tfvars"
145-
contents = base64decode(file_local_snapshot.persist_inputs.snapshot)
143+
directory = local.deploy_path
144+
name = "inputs.tfvars"
145+
contents = base64decode(file_local_snapshot.persist_inputs.snapshot)
146+
permissions = "0600"
146147
}
147148

148149
### Environment Variables ###
@@ -155,7 +156,7 @@ resource "file_local" "write_tmp_env" {
155156
directory = local.tf_data_dir
156157
name = "env.tmp"
157158
contents = local.export_contents
158-
permissions = "0644"
159+
permissions = "0600"
159160
}
160161
resource "file_local_snapshot" "persist_envrc" {
161162
depends_on = [
@@ -179,7 +180,7 @@ resource "file_local" "instantiate_envrc_snapshot" {
179180
directory = local.deploy_path
180181
name = "envrc"
181182
contents = base64decode(file_local_snapshot.persist_envrc.snapshot)
182-
permissions = "0644"
183+
permissions = "0600"
183184
}
184185

185186
## Generated Files ##
@@ -236,8 +237,8 @@ resource "terraform_data" "destroy" {
236237
when = destroy
237238
# no changing the directory or this won't work on different machines!
238239
command = <<-EOT
239-
# if the original filesystem is wiped out, the destroy script may not exist on a consequetive apply (not the first apply)
240-
# in which case we need the generate_destroy resoruce to regenerate the destroy script, and the destroy_end resource will hande the destroy.
240+
# if the original filesystem is wiped out, the destroy script may not exist on a consecutive apply (not the first apply)
241+
# in which case we need the generate_destroy resource to regenerate the destroy script, and the destroy_end resource will handle the destroy.
241242
if [ -f ${self.triggers_replace.dp}/destroy.sh ]; then
242243
${self.triggers_replace.dp}/destroy.sh
243244
fi

modules/deploy/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ variable "jitter_min" {
108108
description = <<-EOT
109109
Number of seconds min to wait before running apply.
110110
This is part of a range of seconds that will be randomly selected to wait in order to prevent
111-
file cache override curruption from multiple terraform instances running at the same time.
111+
file cache override corruption from multiple terraform instances running at the same time.
112112
EOT
113113
default = 0
114114
}
@@ -117,7 +117,7 @@ variable "jitter_max" {
117117
description = <<-EOT
118118
Number of seconds max to wait before running apply.
119119
This is part of a range of seconds that will be randomly selected to wait in order to prevent
120-
file cache override curruption from multiple terraform instances running at the same time.
120+
file cache override corruption from multiple terraform instances running at the same time.
121121
EOT
122122
default = 0
123123
}

modules/install_rancher/rancher/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ locals {
55
rancher_helm_channel = var.rancher_helm_channel
66
rancher_version = replace(var.rancher_version, "v", "") # don't include the v
77
rke2_version = var.rke2_version
8-
rke2_minor = split(".", local.rke2_version)[1]
8+
rke2_minor = tonumber(split(".", local.rke2_version)[1])
99
helm_chart_use_strategy = var.rancher_helm_chart_use_strategy
1010
rancher_helm_chart_values = jsondecode(base64decode(var.rancher_helm_chart_values))
1111
default_hc_values = {

0 commit comments

Comments
 (0)