Skip to content

Commit

Permalink
Merge pull request #27 from overmindtech/k8s-additions
Browse files Browse the repository at this point in the history
Added k8s mappings and dynamic scope
  • Loading branch information
dylanratcliffe authored Jul 28, 2023
2 parents ae21006 + f0cafb5 commit 9c730e6
Show file tree
Hide file tree
Showing 12 changed files with 4,216 additions and 96 deletions.
9 changes: 8 additions & 1 deletion .github/actions/go_init/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ runs:
with:
repository: overmindtech/aws-source
path: ./aws-source
- name: Checkout
uses: actions/checkout@v3
with:
repository: overmindtech/k8s-source
path: ./k8s-source

- name: Move sources in place
shell: bash
run: mv -v aws-source ..
run: |
mv -v aws-source ..
mv -v k8s-source ..
- name: Go Generate
shell: bash
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,26 @@ terraform show -json ./tfplan > ./tfplan.json
ovm-cli submit-plan --title "example change" --plan-json ./tfplan.json
```

## Terraform ➡ Overmind Mapping

In order to calculate the blast radius from a Terraform plan, we use mappings provided by the sources to map a Terraform resource change to an Overmind item. In many cases this is simple, however in some instances, the plan doesn't have enough information for us to determine which resource the change is referring to. A good example is a Terraform environment that manages 2x Kubernetes deployments in 2x clusters which both have the same name.

By default we'll add both deployments to the blast radius since we can't tell them apart. However to improve the results, you can add the `overmind_mappings` output to your plan:

```hcl
output "overmind_mappings" {
value = {
# The key here should be the name of the provider. Resources that use this
# provider will be mapped to a cluster with the below name. If you had
# another provider with an alias such as "prod" the name would be
# "kubernetes.prod"
kubernetes = {
cluster_name = var.terraform_env_name
}
}
}
```

Valid mapping values are:

* `cluster_name`: The name of the cluster that was provided to the kubernetes source using the `source.clusterName` option
Loading

0 comments on commit 9c730e6

Please sign in to comment.