Skip to content

Commit

Permalink
Merge pull request #12 from lonelyCZ/pr-sigle-vars
Browse files Browse the repository at this point in the history
Create a single variables file for cert-manager + Vault workflow
  • Loading branch information
jetstack-bot committed Jul 6, 2022
2 parents a4f4853 + 56a00fd commit 0fd7b38
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 18 deletions.
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
*.tfstate
*.tfstate.*

# Exclude all .tfvars files, which are likely to contain sentitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
#
*.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
Expand Down
16 changes: 13 additions & 3 deletions cm-vault/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,21 @@ To use Kubernetes Provider to configure Cert-Manager. By default, it create a `C

## Usage Steps

Execute `terragrunt run-all init` to init providers of all modules.
### 1. Execute `terragrunt run-all init` to init providers of all modules.

Execute `terragrunt run-all apply` to deploy all modules.
### 2. Configurate custom variable.

Execute `terragrunt run-all destroy` to clean test environment.
You can configurate custom variables in `common.tfvars`.

```
# Path to the kubeconfig file to use for connecting kubernetes cluster. Default is "~/.kube/config"
kubeconfig_path="~/.kube/config"
......
```

### 3. Execute `terragrunt run-all apply` to deploy all modules.

### 4. Execute `terragrunt run-all destroy` to clean test environment.

### Note
If you want to run it in [Kind](https://kind.sigs.k8s.io/) cluster, you need to [create extra port mappings](https://kind.sigs.k8s.io/docs/user/configuration/#extra-port-mappings) to `vault-install` module to port forward.
Expand Down
29 changes: 23 additions & 6 deletions cm-vault/cm-config/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
dependency "vault-install" {
config_path = "../vault-install"
config_path = "../vault-install"

skip_outputs = "true"
skip_outputs = "true"
}

dependency "cm-install" {
config_path = "../cm-install"
config_path = "../cm-install"

skip_outputs = "true"
skip_outputs = "true"
}


dependency "vault-config" {
config_path = "../vault-config"
config_path = "../vault-config"

skip_outputs = "true"
skip_outputs = "true"
}

terraform {
extra_arguments "common_vars" {
commands = [
"apply",
"plan",
"import",
"push",
"refresh",
"destroy"
]

arguments = [
"-var-file=${get_parent_terragrunt_dir()}/../common.tfvars"
]
}
}
16 changes: 16 additions & 0 deletions cm-vault/cm-install/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
terraform {
extra_arguments "common_vars" {
commands = [
"apply",
"plan",
"import",
"push",
"refresh",
"destroy"
]

arguments = [
"-var-file=${get_parent_terragrunt_dir()}/../common.tfvars"
]
}
}
3 changes: 3 additions & 0 deletions cm-vault/common.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# Path to the kubeconfig file to use for connecting kubernetes cluster. Default is "~/.kube/config"
kubeconfig_path="~/.kube/config"
4 changes: 2 additions & 2 deletions cm-vault/vault-config/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependency "vault-install" {
config_path = "../vault-install"
config_path = "../vault-install"

skip_outputs = "true"
skip_outputs = "true"
}
16 changes: 16 additions & 0 deletions cm-vault/vault-install/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
terraform {
extra_arguments "common_vars" {
commands = [
"apply",
"plan",
"import",
"push",
"refresh",
"destroy"
]

arguments = [
"-var-file=${get_parent_terragrunt_dir()}/../common.tfvars"
]
}
}

0 comments on commit 0fd7b38

Please sign in to comment.