Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
caruccio committed Aug 28, 2024
1 parent 0483372 commit 2d1c58d
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ variables-modules-merge.tf.json: variables-modules.tf
./make-modules $< > $@

test: modules fmt lint init validate
$(MAKE) -C test/

clean:
rm -rf ./.terraform ./.terraform.lock.hcl
$(MAKE) -C test/ clean

i init:
terraform init
Expand All @@ -33,7 +38,7 @@ v validate:
f fmt:
terraform fmt

release: modules fmt update-version
release: import modules fmt update-version
$(MAKE) build-release

update-version:
Expand Down
11 changes: 11 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
all: test

test: .terraform/modules/modules.json
terraform validate
terraform plan

.terraform/modules/modules.json: main.tf
terraform init

clean:
rm -rf ./.terraform ./.terraform.lock.hcl
Empty file added test/identity
Empty file.
Empty file added test/identity.pub
Empty file.
Empty file added test/known_hosts
Empty file.
40 changes: 40 additions & 0 deletions test/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
terraform {
required_providers {
kubectl = {
source = "gavinbunney/kubectl"
version = "~> 1"
}

kubernetes = {
version = "~> 2.8"
}

kustomization = {
source = "kbst/kustomization"
version = "< 1"
}

random = {
version = "~> 2"
}

shell = {
source = "scottwinkler/shell"
version = "~> 1"
}
}
}

provider "kustomization" {
kubeconfig_raw = ""
}

module "cluster" {
source = "../"

cluster_name = "cluster_name"
customer_name = "customer_name"

kubernetes_version = "v0.0.0"
ssh_user = "root"
}

0 comments on commit 2d1c58d

Please sign in to comment.