-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_terraformrc.tmpl
40 lines (36 loc) · 1.62 KB
/
dot_terraformrc.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Note to self: if you're in here trying to figure out how to get Terraform to use locally-cached providers, instead
// of constantly (re)downloading them all of the time:
// 1. make sure you have a `.terraform.lock.hcl` file, because
// 2. this issue (https://github.com/hashicorp/terraform/issues/32936) makes it clear there is a bug in the area.
{{if lookPath "op" -}}
credentials "app.terraform.io" {
{{- if eq (env "CHEZMOI_TERRAFORM_TOKEN") "personal"}}
// Personal token - managed by chezmoi
token = "{{onepasswordRead "op://Personal/Terraform Cloud - personal/Token" "my.1password.com"}}"
{{- else if eq (env "CHEZMOI_TERRAFORM_TOKEN") "ovo"}}
// OVO token - managed by chezmoi
token = "{{onepasswordRead "op://Private/OVO Terraform Cloud token/credential" "ovotech.1password.com"}}"
{{- end}}
}
{{end -}}
// Enables plugin caching and specifies, as a string, the location of the plugin cache directory.
// https://developer.hashicorp.com/terraform/cli/config/config-file#provider-plugin-cache
plugin_cache_dir = "{{.chezmoi.homeDir}}/.terraform.d/plugin-cache"
// https://developer.hashicorp.com/terraform/cli/config/config-file#explicit-installation-method-configuration
provider_installation {
filesystem_mirror {
path = "{{.chezmoi.homeDir}}/m2tp3"
include = [
"registry.terraform.io/hashicorp/random",
"registry.terraform.io/hashicorp/template",
"terraform.ovotech.org.uk/pe/aiven-kafka-users"
]
}
direct {
exclude = [
"registry.terraform.io/hashicorp/random",
"registry.terraform.io/hashicorp/template",
"terraform.ovotech.org.uk/pe/aiven-kafka-users"
]
}
}