Skip to content

Commit

Permalink
(DMVP-1164) Add weave-scope module (#8)
Browse files Browse the repository at this point in the history
Co-authored-by: Vahagn Martirosyan <[email protected]>
  • Loading branch information
VahagnMian and Vahagn Martirosyan authored Sep 14, 2022
1 parent 4b9551e commit ef81667
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*
*.lock.hcl


**/.idea/*

.idea/


# Crash log files
crash.log

# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
# .tfvars files are managed as part of configuration and so should be included in
# version control.
#
# example.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
#
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

.DS_Store
.tool-versions
49 changes: 49 additions & 0 deletions modules/weave-scope/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
This module will enable `Weave-Scope` in EKS if `enable_weave_scope` is set to `true`
## Usage
```
module "terraform-aws-eks" {
source = "../terraform-aws-eks"
availability_zones = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
cidr = "172.16.0.0/16"
cluster_name = "my-cluster-sso"
private_subnets = ["172.16.1.0/24", "172.16.2.0/24", "172.16.3.0/24"]
public_subnets = ["172.16.4.0/24", "172.16.5.0/24", "172.16.6.0/24"]
users = [{
username = "macos"
}]
vpc_name = "eks-vpc"
alb_log_bucket_name = "bucket-eks-miandevops-temporary"
enable_weave_scope = true
}
```
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.

## Providers

| Name | Version |
|------|---------|
| <a name="provider_null"></a> [null](#provider\_null) | n/a |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [null_resource.kubectl-apply](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [null_resource.kubectl-version](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |

## Inputs

No inputs.

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
14 changes: 14 additions & 0 deletions modules/weave-scope/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
resource "null_resource" "kubectl-version" {
provisioner "local-exec" {
command = "kubectl version | base64 | tr -d '\n' > ./.terraform/kversion"
interpreter = ["/bin/bash", "-c"]
}
}

resource "null_resource" "kubectl-apply" {
depends_on = [null_resource.kubectl-version]
provisioner "local-exec" {
command = "kubectl apply -f 'https://cloud.weave.works/k8s/scope.yaml?k8s-version=${file("./.terraform/kversion")}'"
interpreter = ["/bin/bash", "-c"]
}
}

0 comments on commit ef81667

Please sign in to comment.