Skip to content

Commit

Permalink
Update gettings started, add $schema directive at the top of files (#769
Browse files Browse the repository at this point in the history
)

* Remove invalid references

* Add yaml-language-server

* validate YAML schemas

* try to fix validation

* document editor configuration

* fix FAQ video

* document workaround for complex types

* document how to use JSON with atmos.Component

* reformat as definition list

* adjust css. improve filesystem layout docs

* fix indent

* remove duplicate text

* fix tabs/spaces

* reformat

* clarify documentation relative to example

---------

Co-authored-by: Andriy Knysh <[email protected]>
  • Loading branch information
osterman and aknysh authored Nov 15, 2024
1 parent 9acca77 commit 1368b54
Show file tree
Hide file tree
Showing 156 changed files with 904 additions and 200 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,35 @@ jobs:
--recursive
--config=${{ github.workspace }}/examples/.tflint.hcl
fail_on_error: true

# run other demo tests
validate:
name: "[validate] ${{ matrix.demo-folder }}"
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
demo-folder:
- demo-context
- demo-localstack
- demo-stacks
- demo-helmfile
- quick-start-advanced
- quick-start-simple

timeout-minutes: 20
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Validate YAML Schema
uses: InoUno/[email protected]
with:
root: "examples/${{ matrix.demo-folder }}/stacks"
schemaMapping: |
{
"https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json": [
"examples/${{ matrix.demo-folder }}/stacks/**/*.yaml",
"examples/${{ matrix.demo-folder }}/stacks/**/*.yml"
]
}
48 changes: 22 additions & 26 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,44 @@
# Examples

> [!TIP]
> ### You can try `atmos` directly in your browser using GitHub Codespaces!
>
> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=cloudposse/atmos&skip_quickstart=true)
>
> <i>Already start one? Find it [here](https://github.com/codespaces).</i>
>
> ### You can try `atmos` directly in your browser using GitHub Codespaces!
>
> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=cloudposse/atmos&skip_quickstart=true)
>
> <i>Already start one? Find it [here](https://github.com/codespaces).</i>
>
## Try it Locally

To play with these demos locally, start by [installing `atmos`](https://atmos.tools/install).
To play with these demos locally, start by [installing `atmos`](https://atmos.tools/install).

Then run the following commands (Note, these commands requires that you have `curl` and `tar` installed on your system.)
Then, clone this repo and [try out the demos](https://github.com/cloudposse/atmos/tree/main/examples).

```shell
atmos demo download <example>
```
# Clone this repo
git clone [email protected]:cloudposse/atmos.git

For example, the following command will download the `demo-stacks` example.
```shell
atmos demo download demo-stacks
# Try the examples: https://github.com/cloudposse/atmos/tree/main/examples
cd examples/
```

> [!TIP]
> #### Fun Fact
>
> The `download` command is a [custom command](https://atmos.tools/core-concepts/custom-commands) added to the default `atmos.yaml`.
>

## Demos

We designed the demos to be basic examples showcasing functionality. Expect some redundancies and overlap since we reuse examples to demonstrate specific behaviors. Each demo focuses on one area to reduce complexity and make it easier to grasp the concepts.

Think of each demo folder as representing an example of a standalone repository. To make it easier, we put all the demos in one place.

```shell
1. ├── demo-stacks/ # Start your journey here
2. ├── demo-library/ #
3. ├── demo-validation/ #
4. ├── demo-vendoring/ #
5. ├── demo-custom-commands/ #
6. └── demo-workflows/ #
1. ├── demo-stacks/ # Kickstart your journey by exploring stack configurations and their structure.
2. ├── demo-library/ # Explore a reusable component library designed for seamless vendoring.
3. ├── demo-vendoring/ # Learn how to use vendoring to download and integrate remote dependencies from the `demo-library`.
4. ├── demo-validation/ # Validate your configurations to ensure correctness and compliance.
5. ├── demo-localstack/ # Leverage LocalStack to provision an S3 bucket using Atmos and Terraform.
6. ├── demo-helmfile/ # Deploy NGINX on a local lightweight Kubernetes cluster (k3s) using Helm.
7. ├── demo-custom-command/ # Learn how to extend Atmos with your own custom CLI commands.
8. ├── demo-component-versions/ # Discover how to manage and use multiple versions of components effectively.
9. ├── demo-context/ # Simplify resource naming and tagging with our Terraform context provider.
10. └── demo-workflows/ # Automate repetitive tasks with streamlined workflows.
```

## Playground
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-context/stacks/catalog/demo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

components:
terraform:
demo:
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-context/stacks/deploy/_defaults.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

terraform:
backend_type: local

Expand Down
2 changes: 2 additions & 0 deletions examples/demo-context/stacks/deploy/dev/demo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
- deploy/_defaults
- catalog/demo
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-context/stacks/deploy/prod/demo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
- deploy/_defaults
- catalog/demo
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-context/stacks/deploy/staging/demo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
- deploy/_defaults
- catalog/demo
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-helmfile/stacks/catalog/demo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

components:
helmfile:
demo:
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-helmfile/stacks/deploy/dev/demo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
- mixins/k3s
- catalog/demo
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-helmfile/stacks/deploy/prod/demo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
- mixins/k3s
- catalog/demo
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-helmfile/stacks/deploy/staging/demo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
- mixins/k3s
- catalog/demo
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-helmfile/stacks/mixins/k3s.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

env:
# Configure `kubectl` to use the `kubeconfig.yaml` file generated by the K3s server
# This needs to be an absolute path, since `helmfile` is executed from the component's directory
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-localstack/stacks/catalog/demo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

components:
terraform:
demo:
Expand Down
3 changes: 3 additions & 0 deletions examples/demo-localstack/stacks/deploy/dev/demo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
- mixins/localstack
- catalog/demo
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-localstack/stacks/deploy/prod/demo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
- mixins/localstack
- catalog/demo
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-localstack/stacks/deploy/staging/demo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
- mixins/localstack
- catalog/demo
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-localstack/stacks/mixins/localstack.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

env:
# We need to ensure no profile is set when using LocalStack, or the AWS SDK will try to use it
AWS_PROFILE: ""
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-stacks/stacks/catalog/myapp.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

components:
terraform:
myapp:
Expand Down
2 changes: 2 additions & 0 deletions examples/demo-stacks/stacks/deploy/dev.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: dev

Expand Down
4 changes: 3 additions & 1 deletion examples/demo-stacks/stacks/deploy/prod.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: prod

import:
- catalog/myapp

Expand Down
4 changes: 3 additions & 1 deletion examples/demo-stacks/stacks/deploy/staging.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: staging

import:
- catalog/myapp

Expand Down
1 change: 1 addition & 0 deletions examples/demo-workflows/stacks/catalog/myapp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json
1 change: 1 addition & 0 deletions examples/demo-workflows/stacks/deploy/dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json
1 change: 1 addition & 0 deletions examples/demo-workflows/stacks/deploy/prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json
1 change: 1 addition & 0 deletions examples/demo-workflows/stacks/deploy/staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json
2 changes: 2 additions & 0 deletions examples/quick-start-simple/stacks/catalog/station.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

components:
terraform:
station:
Expand Down
2 changes: 2 additions & 0 deletions examples/quick-start-simple/stacks/deploy/dev.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: dev

Expand Down
2 changes: 2 additions & 0 deletions examples/quick-start-simple/stacks/deploy/prod.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: prod

Expand Down
2 changes: 2 additions & 0 deletions examples/quick-start-simple/stacks/deploy/staging.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: staging

Expand Down
2 changes: 2 additions & 0 deletions examples/tests/stacks/catalog/helmfile/echo-server.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

components:
helmfile:
echo-server:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

components:
helmfile:
"infra/infra-server-override":
Expand Down
2 changes: 2 additions & 0 deletions examples/tests/stacks/catalog/helmfile/infra-server.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

components:
helmfile:
"infra/infra-server":
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
- globals/tenant1-globals-does-not-exist
- catalog/terraform/test-component-does-not-exist
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
# Test invalid import when the file imports itself
- catalog/invalid-yaml-and-schema/invalid-import-2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
- [globals/tenant1-globals-invalid]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
globals/tenant1-globals-invalid

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
a: globals/tenant1-globals

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import: globals/tenant1-globals

vars:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:
-
- globals/tenant1-globals
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import:

vars:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

import: {}

vars:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:

terraform:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: invalid

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: invalid

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: invalid

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: invalid

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: invalid

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: invalid

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: invalid

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: invalid

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: invalid

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yaml-language-server: $schema=https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

vars:
stage: invalid

Expand Down
Loading

0 comments on commit 1368b54

Please sign in to comment.