Skip to content

Commit

Permalink
Merge branch 'main' into tunnel-k8s-rest-client
Browse files Browse the repository at this point in the history
  • Loading branch information
denis256 authored Dec 12, 2024
2 parents 4e5b68f + 1389227 commit fdad305
Show file tree
Hide file tree
Showing 90 changed files with 2,016 additions and 2,484 deletions.
6 changes: 4 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env: &env
TERRAFORM_VERSION: 1.5.7
TOFU_VERSION: 1.8.0
PACKER_VERSION: 1.10.0
TERRAGRUNT_VERSION: v0.52.0
TERRAGRUNT_VERSION: v0.69.8
OPA_VERSION: v0.33.1
GO_VERSION: 1.21.1
GO111MODULE: auto
Expand Down Expand Up @@ -110,6 +110,7 @@ version: 2
jobs:
setup:
<<: *env
resource_class: xlarge
docker:
- image: cimg/python:3.10.2

Expand Down Expand Up @@ -178,7 +179,7 @@ jobs:
# run tests with terraform binary
test_terraform:
<<: *defaults
resource_class: large
resource_class: xlarge
steps:
- attach_workspace:
at: /home/circleci
Expand Down Expand Up @@ -338,6 +339,7 @@ jobs:

helm_test:
<<: *defaults
resource_class: large
steps:
- attach_workspace:
at: /home/circleci
Expand Down
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Read the [Gruntwork contribution guidelines](https://gruntwork.notion.site/Grunt
- [ ] Run the relevant tests successfully, including pre-commit checks.
- [ ] Ensure any 3rd party code adheres with our [license policy](https://www.notion.so/gruntwork/Gruntwork-licenses-and-open-source-usage-policy-f7dece1f780341c7b69c1763f22b1378) or delete this line if its not applicable.
- [ ] Include release notes. If this PR is backward incompatible, include a migration guide.
- [ ] Make a plan for release of the functionality in this PR. If it delivers value to an end user, you are responsible for ensuring it is released promptly, and correctly. If you are not a maintainer, you are responsible for finding a maintainer to do this for you.

## Release Notes (draft)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terratest

[![Maintained by Gruntwork.io](https://img.shields.io/badge/maintained%20by-gruntwork.io-%235849a6.svg)](https://gruntwork.io/?ref=repo_terratest)
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/gruntwork-io/terratest/tree/master.svg?style=svg&circle-token=8abd167739d60e4c1b6c1502d2092339a6c6a133)](https://dl.circleci.com/status-badge/redirect/gh/gruntwork-io/terratest/tree/master)
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/gruntwork-io/terratest/tree/main.svg?style=svg&circle-token=8abd167739d60e4c1b6c1502d2092339a6c6a133)](https://dl.circleci.com/status-badge/redirect/gh/gruntwork-io/terratest/tree/main)
[![Go Report Card](https://goreportcard.com/badge/github.com/gruntwork-io/terratest)](https://goreportcard.com/report/github.com/gruntwork-io/terratest)
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/mod/github.com/gruntwork-io/terratest?tab=overview)
![go.mod version](https://img.shields.io/github/go-mod/go-version/gruntwork-io/terratest)
Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This is the code for the [Terratest website](https://terratest.gruntwork.io).

Terratest website is built with Jekyll and published on Github Pages from `docs` folder on `master` branch.
Terratest website is built with Jekyll and published on Github Pages from `docs` folder on `main` branch.

# Quick Start

Expand Down Expand Up @@ -43,7 +43,7 @@ Clone or fork Terratest [repository](https://github.com/gruntwork-io/terratest).

# Deployment

GitHub Pages automatically rebuilds the website from the `/docs` folder whenever you commit and push changes to the `master`
GitHub Pages automatically rebuilds the website from the `/docs` folder whenever you commit and push changes to the `main`
branch.

# Working with the documentation
Expand Down
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repository: "github.com/gruntwork-io/terratest"
twitter_username: https://twitter.com/gruntwork_io
github_username: https://github.com/gruntwork-io

github_api_url: https://raw.githubusercontent.com/gruntwork-io/terratest/master
github_api_url: https://raw.githubusercontent.com/gruntwork-io/terratest/main

# Build settings
# theme: minima
Expand Down
18 changes: 9 additions & 9 deletions docs/_data/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
default: true
learn_more:
- name: Terraform Hello, World
url: https://github.com/gruntwork-io/terratest/tree/master/examples/terraform-hello-world-example
url: https://github.com/gruntwork-io/terratest/tree/main/examples/terraform-hello-world-example

- id: packer-hello-world
name: Packer Hello, World Example
Expand All @@ -22,7 +22,7 @@
default: true
learn_more:
- name: Packer Hello, World
url: https://github.com/gruntwork-io/terratest/tree/master/examples/packer-hello-world-example
url: https://github.com/gruntwork-io/terratest/tree/main/examples/packer-hello-world-example

- id: docker-hello-world
name: Docker Hello, World Example
Expand All @@ -36,7 +36,7 @@
default: true
learn_more:
- name: Docker Hello, World
url: https://github.com/gruntwork-io/terratest/tree/master/examples/docker-hello-world-example
url: https://github.com/gruntwork-io/terratest/tree/main/examples/docker-hello-world-example

- id: kubernetes-hello-world
name: Kubernetes Hello, World Example
Expand All @@ -49,7 +49,7 @@
default: true
learn_more:
- name: Kubernetes Hello, World
url: https://github.com/gruntwork-io/terratest/tree/master/examples/kubernetes-hello-world-example
url: https://github.com/gruntwork-io/terratest/tree/main/examples/kubernetes-hello-world-example

- id: terragrunt-hello-world
name: Terragrunt Example
Expand All @@ -64,7 +64,7 @@
default: true
learn_more:
- name: Terragrunt
url: https://github.com/gruntwork-io/terratest/tree/master/examples/terragrunt-example
url: https://github.com/gruntwork-io/terratest/tree/main/examples/terragrunt-example

- id: aws-hello-world
name: AWS Hello, World Example
Expand All @@ -77,7 +77,7 @@
default: true
learn_more:
- name: AWS Hello, World
url: https://github.com/gruntwork-io/terratest/tree/master/examples/terraform-aws-hello-world-example
url: https://github.com/gruntwork-io/terratest/tree/main/examples/terraform-aws-hello-world-example

- id: gcp-hello-world
name: GCP Hello, World Example
Expand All @@ -90,7 +90,7 @@
default: true
learn_more:
- name: GCP Hello, World
url: https://github.com/gruntwork-io/terratest/tree/master/examples/terraform-gcp-hello-world-example
url: https://github.com/gruntwork-io/terratest/tree/main/examples/terraform-gcp-hello-world-example

- id: azure-basic
name: Azure Hello, World Example
Expand All @@ -107,7 +107,7 @@
default: true
learn_more:
- name: Terraform Azure Example
url: https://github.com/gruntwork-io/terratest/tree/master/examples/azure/terraform-azure-example
url: https://github.com/gruntwork-io/terratest/tree/main/examples/azure/terraform-azure-example

- id: opa-terraform
name: OPA Terraform Example
Expand All @@ -124,7 +124,7 @@
default: true
learn_more:
- name: Terraform OPA Example
url: https://github.com/gruntwork-io/terratest/tree/master/examples/terraform-opa-example
url: https://github.com/gruntwork-io/terratest/tree/main/examples/terraform-opa-example

- id: client-factory
name: Azure Client Factory
Expand Down
4 changes: 2 additions & 2 deletions docs/_docs/01_getting-started/packages-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ nav_title_link: /docs/
---

Now that you've had a chance to browse the examples and their tests, here's an overview of the packages you'll find in
Terratest's [modules folder](https://github.com/gruntwork-io/terratest/tree/master/modules) and how they can help you test different types infrastructure:
Terratest's [modules folder](https://github.com/gruntwork-io/terratest/tree/main/modules) and how they can help you test different types infrastructure:

{:.doc-styled-table}
| Package | Description |
Expand All @@ -27,7 +27,7 @@ Terratest's [modules folder](https://github.com/gruntwork-io/terratest/tree/mast
| **http-helper** | Functions for making HTTP requests. Examples: make an HTTP request to a URL and check the status code and body contain the expected values, run a simple HTTP server locally. |
| **k8s** | Functions that make it easier to work with Kubernetes. Examples: Getting the list of nodes in a cluster, waiting until all nodes in a cluster is ready. |
| **logger** | A replacement for Go's `t.Log` and `t.Logf` that writes the logs to `stdout` immediately, rather than buffering them until the very end of the test. This makes debugging and iterating easier. |
| **logger/parser** | Includes functions for parsing out interleaved go test output and piecing out the individual test logs. Used by the [terratest_log_parser](https://github.com/gruntwork-io/terratest/tree/master/cmd/terratest_log_parser) command. |
| **logger/parser** | Includes functions for parsing out interleaved go test output and piecing out the individual test logs. Used by the [terratest_log_parser](https://github.com/gruntwork-io/terratest/tree/main/cmd/terratest_log_parser) command. |
| **oci** | Functions that make it easier to work with OCI. Examples: Getting the most recent image of a compartment + OS pair, deleting a custom image, retrieving a random subnet. |
| **packer** | Functions for working with Packer. Examples: run a Packer build and return the ID of the artifact that was created. |
| **random** | Functions for generating random data. Examples: generate a unique ID that can be used to namespace resources so multiple tests running in parallel don't clash. |
Expand Down
4 changes: 2 additions & 2 deletions docs/_docs/01_getting-started/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ types of infrastructure code you can test (e.g., Packer, Kubernetes, etc).

1. Create an `examples` and `test` folder.

1. Copy the folder including all the files from the [basic terraform example](https://github.com/gruntwork-io/terratest/tree/master/examples/terraform-basic-example/) into the `examples` folder.
1. Copy the folder including all the files from the [basic terraform example](https://github.com/gruntwork-io/terratest/tree/main/examples/terraform-basic-example/) into the `examples` folder.

1. Copy the [basic terraform example test](https://github.com/gruntwork-io/terratest/blob/master/test/terraform_basic_example_test.go) into the `test` folder.
1. Copy the [basic terraform example test](https://github.com/gruntwork-io/terratest/blob/main/test/terraform_basic_example_test.go) into the `test` folder.

1. To configure dependencies, run:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This will:
- Create a `report.xml` file containing a Junit XML file of the test summary (so it can be integrated in your CI).

The output can be integrated in your CI engine to further enhance the debugging experience. See Terratest's own
[circleci configuration](https://github.com/gruntwork-io/terratest/blob/master/.circleci/config.yml) for an example of how to integrate the utility with CircleCI. This
[circleci configuration](https://github.com/gruntwork-io/terratest/blob/main/.circleci/config.yml) for an example of how to integrate the utility with CircleCI. This
provides for each build:

- A test summary view showing you which tests failed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ Here are some techniques we use with Docker:

- If your script is used in a Packer template, add a [Docker
builder](https://www.packer.io/docs/builders/docker.html) to the template so you can create a Docker image from the
same code. See the [Packer Docker Example](https://github.com/gruntwork-io/terratest/tree/master/examples/packer-docker-example) for working sample code.
same code. See the [Packer Docker Example](https://github.com/gruntwork-io/terratest/tree/main/examples/packer-docker-example) for working sample code.

- We have prebuilt Docker images for major Linux distros that have many important dependencies (e.g., curl, vim,
tar, sudo) already installed. See the [test-docker-images folder](https://github.com/gruntwork-io/terratest/tree/master/test-docker-images) for more details.
tar, sudo) already installed. See the [test-docker-images folder](https://github.com/gruntwork-io/terratest/tree/main/test-docker-images) for more details.

- Create a `docker-compose.yml` to make it easier to run your Docker image with all the ports, environment variables,
and other settings it needs. See the [Packer Docker Example](https://github.com/gruntwork-io/terratest/tree/master/examples/packer-docker-example) for working sample code.
and other settings it needs. See the [Packer Docker Example](https://github.com/gruntwork-io/terratest/tree/main/examples/packer-docker-example) for working sample code.

- With scripts in Docker, you can replace _some_ real-world dependencies with mocks! One way to do this is to create
some "mock scripts" and to bind-mount them in `docker-compose.yml` in a way that replaces the real dependency. For
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ each time you change a single line of code can be very slow.

This is where Terratest's `test_structure` package comes in handy: it allows you to explicitly break up your tests into
stages and to be able to disable any one of those stages simply by setting an environment variable. Check out the
[terraform_packer_example_test.go](https://github.com/gruntwork-io/terratest/blob/master/test/terraform_packer_example_test.go)
[terraform_packer_example_test.go](https://github.com/gruntwork-io/terratest/blob/main/test/terraform_packer_example_test.go)
for working sample code.
2 changes: 1 addition & 1 deletion docs/_docs/04_community/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Development](http://tom.preston-werner.com/2010/08/23/readme-driven-development.
stays up to date and allows you to think through the problem at a high level before you get lost in the weeds of
coding.

The documentation is built with Jekyll and hosted on the Github Pages from `docs` folder on `master` branch. Check out [Terratest website](https://github.com/gruntwork-io/terratest/tree/master/docs#working-with-the-documentation) to learn more about working with the documentation.
The documentation is built with Jekyll and hosted on the Github Pages from `docs` folder on `main` branch. Check out [Terratest website](https://github.com/gruntwork-io/terratest/tree/main/docs#working-with-the-documentation) to learn more about working with the documentation.

### Update the tests

Expand Down
2 changes: 1 addition & 1 deletion docs/_docs/04_community/license.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ nav_title_link: /docs/

## License

This code is released under the Apache 2.0 License. See [LICENSE](https://github.com/gruntwork-io/terratest/blob/master/LICENSE){:target="_blank"} and [NOTICE](https://github.com/gruntwork-io/terratest/blob/master/NOTICE){:target="_blank"} for more details.
This code is released under the Apache 2.0 License. See [LICENSE](https://github.com/gruntwork-io/terratest/blob/main/LICENSE){:target="_blank"} and [NOTICE](https://github.com/gruntwork-io/terratest/blob/main/NOTICE){:target="_blank"} for more details.
2 changes: 1 addition & 1 deletion docs/_includes/examples/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
{% unless include.skip_view_on_github %}
<div class="example__file-link">
<p>View on GitHub:</p>
<a href="https://{{ site.repository }}/tree/master{{ file.url }}">{{ site.repository }}{{ file.url }}</a>
<a href="https://{{ site.repository }}/tree/main{{ file.url }}">{{ site.repository }}{{ file.url }}</a>
</div>
{% endunless %}
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/_includes/examples/explorer.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{% if include.example_id == nil %}
<div class="hidden-navs__static-links">
<a
href="https://github.com/gruntwork-io/terratest/tree/master/examples"
href="https://github.com/gruntwork-io/terratest/tree/main/examples"
class="examples__nav-item static-link nav-{{ example.id }}"
target="_blank"
>
Expand Down
2 changes: 1 addition & 1 deletion examples/azure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ These modules are currently using the latest version of Go and was tested with *

## Azure-sdk-for-go version

Let's make sure [go.mod](https://github.com/gruntwork-io/terratest/blob/master/go.mod) includes the appropriate [azure-sdk-for-go version](https://github.com/Azure/azure-sdk-for-go/releases/tag/v46.1.0):
Let's make sure [go.mod](https://github.com/gruntwork-io/terratest/blob/main/go.mod) includes the appropriate [azure-sdk-for-go version](https://github.com/Azure/azure-sdk-for-go/releases/tag/v46.1.0):

```go
require (
Expand Down
4 changes: 2 additions & 2 deletions examples/azure/terraform-azure-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ it should be free, but you are completely responsible for all Azure charges.

## Check Go Dependencies

Check that the `github.com/Azure/azure-sdk-for-go` version in your generated `go.mod` for this test matches the version in the terratest [go.mod](https://github.com/gruntwork-io/terratest/blob/master/go.mod) file.
Check that the `github.com/Azure/azure-sdk-for-go` version in your generated `go.mod` for this test matches the version in the terratest [go.mod](https://github.com/gruntwork-io/terratest/blob/main/go.mod) file.

> This was tested with **go1.14.1**.
### Check Azure-sdk-for-go version

Let's make sure [go.mod](https://github.com/gruntwork-io/terratest/blob/master/go.mod) includes the appropriate [azure-sdk-for-go version](https://github.com/Azure/azure-sdk-for-go/releases/tag/v38.1.0):
Let's make sure [go.mod](https://github.com/gruntwork-io/terratest/blob/main/go.mod) includes the appropriate [azure-sdk-for-go version](https://github.com/Azure/azure-sdk-for-go/releases/tag/v38.1.0):

```go
require (
Expand Down
1 change: 1 addition & 0 deletions examples/packer-docker-example/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

set :port, server_port
set :bind, '0.0.0.0'
set :server, 'puma'

get '/' do
server_text
Expand Down
2 changes: 1 addition & 1 deletion examples/packer-docker-example/configure-sinatra-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sudo apt-get update
sudo apt-get install -y make zlib1g-dev build-essential ruby ruby-dev

echo "Installing Sinatra"
sudo gem install sinatra json rackup
sudo gem install sinatra json rackup puma

echo "Moving $APP_RB_SRC to $APP_RB_DST"
mkdir -p "$(dirname "$APP_RB_DST")"
Expand Down
8 changes: 5 additions & 3 deletions examples/packer-hello-world-example/build.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ packer {

source "docker" "ubuntu-docker" {
changes = ["ENTRYPOINT [\"\"]"]
commit = true
image = "gruntwork/ubuntu-test:16.04"

commit = true
image = "gruntwork/ubuntu-test:16.04"
platform = "linux/amd64"
}

build {
Expand All @@ -22,6 +24,6 @@ build {

post-processor "docker-tag" {
repository = "gruntwork/packer-hello-world-example"
tag = ["latest"]
tag = ["latest"]
}
}
Binary file removed examples/terraform-aws-lambda-example/src/bootstrap
Binary file not shown.
4 changes: 2 additions & 2 deletions examples/terraform-aws-lambda-example/src/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ type Event struct {
Echo string `json:"Echo"`
}

// Fails if ShouldFail is `true`, otherwise echos the input.
// HandleRequest Fails if ShouldFail is `true`, otherwise echos the input.
func HandleRequest(ctx context.Context, evnt *Event) (string, error) {
if evnt == nil {
return "", fmt.Errorf("received nil event")
}
if evnt.ShouldFail {
return "", fmt.Errorf("Failed to handle %#v", evnt)
return "", fmt.Errorf("failed to handle %#v", evnt)
}
return evnt.Echo, nil
}
Expand Down
Loading

0 comments on commit fdad305

Please sign in to comment.