Skip to content

Commit

Permalink
Add testdata
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Jun 23, 2020
1 parent 8c79756 commit a40c1c9
Show file tree
Hide file tree
Showing 676 changed files with 33,415 additions and 0 deletions.
27 changes: 27 additions & 0 deletions internal/terraform/rootmodule/testdata/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Tested Terraform Hierarchies

This directory contains different hierarchies of root modules
which the language server supports and is tested against.

## Single Root

- `single-root-ext-modules-only`
- `single-root-local-and-ext-modules`
- `single-root-local-modules-only`
- `single-root-no-modules`

## Nested Single Root

- `nested-single-root-no-modules`
- `nested-single-root-ext-modules`
- `nested-single-root-local-submodules-down`
- `nested-single-root-local-submodules-up`

## Nested Multiple Roots

- `main-module-multienv` - https://dev.to/piotrgwiazda/main-module-approach-for-handling-multiple-environments-in-terraform-1oln
- `nested-multi-root-isolated-no-modules`
- `nested-multi-root-isolated-ext-modules`
- `nested-multi-root-isolated-local-submodules-down`
- `nested-multi-root-isolated-local-submodules-up` - e.g. https://github.com/terraform-aws-modules/terraform-aws-security-group
- `nested-multi-root-crosslinked-modules`
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Modules":[{"Key":"main.db","Source":"../modules/database","Dir":"../../modules/database"},{"Key":"main.gorilla-app","Source":"../modules/application","Dir":"../../modules/application"},{"Key":"","Source":"","Dir":"."},{"Key":"main","Source":"../../main","Dir":"../../main"}]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"random": "7903b3f4d7067b3e8ca2440aa4342b57286310e074a806d0f1a673034969817b"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
provider "random" {
version = "~>2.0"
}

module "main" {
source = "../../main"
environment_name = "dev"
app_instances = 1
db_instances = 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Modules":[{"Key":"main","Source":"../../main","Dir":"../../main"},{"Key":"main.db","Source":"../modules/database","Dir":"../../modules/database"},{"Key":"main.gorilla-app","Source":"../modules/application","Dir":"../../modules/application"},{"Key":"","Source":"","Dir":"."}]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"random": "7903b3f4d7067b3e8ca2440aa4342b57286310e074a806d0f1a673034969817b"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
provider "random" {
version = "~>2.0"
}

module "main" {
source = "../../main"
environment_name = "prod"
app_instances = 5
db_instances = 3
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"main","Source":"../../main","Dir":"../../main"},{"Key":"main.db","Source":"../modules/database","Dir":"../../modules/database"},{"Key":"main.gorilla-app","Source":"../modules/application","Dir":"../../modules/application"}]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"random": "7903b3f4d7067b3e8ca2440aa4342b57286310e074a806d0f1a673034969817b"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
provider "random" {
version = "~>2.0"
}

module "main" {
source = "../../main"
environment_name = "staging"
app_instances = 2
db_instances = 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
variable "environment_name" {
type = string
}

variable "app_instances" {
type = number
}

variable "db_instances" {
type = number
}

module "db" {
source = "../modules/database"
environment_name = var.environment_name
app_prefix = "foxtrot"
instances = var.db_instances
}

module "gorilla-app" {
source = "../modules/application"
environment_name = var.environment_name
app_prefix = "protect-gorillas"
instances = var.app_instances
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
variable "environment_name" {
type = string
}

variable "app_prefix" {
type = string
}

variable "instances" {
type = number
}

resource "random_pet" "application" {
count = var.instances
keepers = {
unique = "${var.environment_name}-${var.app_prefix}"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
variable "environment_name" {
type = string
}

variable "db_prefix" {
type = string
}

variable "instances" {
type = number
}

resource "random_pet" "database" {
count = var.instances
keepers = {
unique = "${var.environment_name}-${var.db_prefix}"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Modules":[{"Key":"vpc1.vpc","Source":"./modules/vpc","Dir":".terraform/modules/vpc1/terraform-google-network-2.3.0/modules/vpc"},{"Key":"vpc2","Source":"terraform-google-modules/network/google","Version":"2.3.0","Dir":".terraform/modules/vpc2/terraform-google-network-2.3.0"},{"Key":"vpc2.routes","Source":"./modules/routes","Dir":".terraform/modules/vpc2/terraform-google-network-2.3.0/modules/routes"},{"Key":"vpc2.vpc","Source":"./modules/vpc","Dir":".terraform/modules/vpc2/terraform-google-network-2.3.0/modules/vpc"},{"Key":"vpc1.routes","Source":"./modules/routes","Dir":".terraform/modules/vpc1/terraform-google-network-2.3.0/modules/routes"},{"Key":"vpc1.subnets","Source":"./modules/subnets","Dir":".terraform/modules/vpc1/terraform-google-network-2.3.0/modules/subnets"},{"Key":"vpc2.subnets","Source":"./modules/subnets","Dir":".terraform/modules/vpc2/terraform-google-network-2.3.0/modules/subnets"},{"Key":"","Source":"","Dir":"."},{"Key":"vpc1","Source":"terraform-google-modules/network/google","Version":"2.3.0","Dir":".terraform/modules/vpc1/terraform-google-network-2.3.0"}]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
releaseType: terraform-module
handleGHRelease: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# OSX leaves these everywhere on SMB shares
._*

# OSX trash
.DS_Store

# Python
*.pyc

# Emacs save files
*~
\#*\#
.\#*

# Vim-related files
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist

### https://raw.github.com/github/gitignore/90f149de451a5433aebd94d02d11b0e28843a1af/Terraform.gitignore

# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log

# Kitchen files
**/inspec.lock
**/.kitchen
**/.kitchen.local.yml
**/Gemfile.lock

# 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
test/fixtures/shared/terraform.tfvars

credentials.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
driver:
name: "terraform"
command_timeout: 1800

provisioner:
name: "terraform"

platforms:
- name: local

suites:
- name: "simple_project"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/simple_project/
verifier:
name: terraform
color: true
systems:
- name: inspec-gcp
backend: gcp
controls:
- gcp
- name: local
backend: local
controls:
- gcloud
- name: "simple_project_with_regional_network"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/simple_project_with_regional_network/
verifier:
name: terraform
color: true
systems:
- name: inspec-gcp
backend: gcp
controls:
- gcp
- name: "secondary_ranges"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/secondary_ranges/
verifier:
name: terraform
color: true
systems:
- name: local
attrs_outputs:
customized_inspec_attribute: output_network_name
customized_inspec_attribute: output_network_self_link
customized_inspec_attribute: output_subnets_ips
customized_inspec_attribute: output_routes
customized_inspec_attribute: output_subnets_flow_logs
customized_inspec_attribute: output_subnets_names
customized_inspec_attribute: output_subnets_private_access
customized_inspec_attribute: output_subnets_regions
customized_inspec_attribute: output_subnets_secondary_ranges
customized_inspec_attribute: output_project_id
backend: local
controls:
- gcloud
- inspec_attributes
- name: "multi_vpc"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/multi_vpc/
verifier:
name: terraform
color: true
systems:
- name: local
backend: local
controls:
- gcloud
- name: "delete_default_gateway_routes"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/delete_default_gateway_routes/
verifier:
name: terraform
color: true
systems:
- name: local
backend: local
controls:
- gcloud
- name: "submodule_firewall"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/submodule_firewall/
verifier:
name: terraform
color: true
systems:
- name: inspec-gcp
backend: gcp
controls:
- gcp
- name: local
attrs_outputs:
customized_inspec_attribute: output_network_name
customized_inspec_attribute: output_network_self_link
customized_inspec_attribute: output_subnets_ips
customized_inspec_attribute: output_routes
customized_inspec_attribute: output_subnets_flow_logs
customized_inspec_attribute: output_subnets_names
customized_inspec_attribute: output_subnets_private_access
customized_inspec_attribute: output_subnets_regions
customized_inspec_attribute: output_subnets_secondary_ranges
customized_inspec_attribute: output_project_id
backend: local
controls:
- gcloud
- inspec_attributes
- name: "submodule_network_peering"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/submodule_network_peering/
verifier:
name: terraform
color: true
systems:
- name: local
backend: local
controls:
- gcloud
- name: "ilb_routing"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/ilb_routing/
verifier:
name: terraform
color: true
systems:
- name: local
backend: local
controls:
- gcloud
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.5.3
Loading

0 comments on commit a40c1c9

Please sign in to comment.