Skip to content

Commit

Permalink
Add utils_describe_stacks data source. Update atmos. Add tests (#281
Browse files Browse the repository at this point in the history
)
  • Loading branch information
aknysh authored Apr 27, 2023
1 parent 4d156f5 commit c31757c
Show file tree
Hide file tree
Showing 60 changed files with 3,139 additions and 351 deletions.
72 changes: 72 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
name: Bug report
description: Create a report to help us improve
labels: ["bug"]
assignees: [""]
body:
- type: markdown
attributes:
value: |
Found a bug?
Please checkout our [Slack Community](https://slack.cloudposse.com)
or visit our [Slack Archive](https://archive.sweetops.com/).
[![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
- type: textarea
id: concise-description
attributes:
label: Describe the Bug
description: A clear and concise description of what the bug is.
placeholder: What is the bug about?
validations:
required: true

- type: textarea
id: expected
attributes:
label: Expected Behavior
description: A clear and concise description of what you expected.
placeholder: What happened?
validations:
required: true

- type: textarea
id: reproduction-steps
attributes:
label: Steps to Reproduce
description: Steps to reproduce the behavior.
placeholder: How do we reproduce it?
validations:
required: true

- type: textarea
id: screenshots
attributes:
label: Screenshots
description: If applicable, add screenshots or logs to help explain.
validations:
required: false

- type: textarea
id: environment
attributes:
label: Environment
description: Anything that will help us triage the bug.
placeholder: |
- OS: [e.g. Linux, OSX, WSL, etc]
- Version [e.g. 10.15]
- Module version
- Terraform version
validations:
required: false

- type: textarea
id: additional
attributes:
label: Additional Context
description: |
Add any other context about the problem here.
validations:
required: false
71 changes: 71 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
name: Feature Request
description: Suggest an idea for this project
labels: ["feature request"]
assignees: [""]
body:
- type: markdown
attributes:
value: |
Have a question?
Please checkout our [Slack Community](https://slack.cloudposse.com)
or visit our [Slack Archive](https://archive.sweetops.com/).
[![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
- type: textarea
id: concise-description
attributes:
label: Describe the Feature
description: A clear and concise description of what the feature is.
placeholder: What is the feature about?
validations:
required: true

- type: textarea
id: expected
attributes:
label: Expected Behavior
description: A clear and concise description of what you expected.
placeholder: What happened?
validations:
required: true

- type: textarea
id: use-case
attributes:
label: Use Case
description: |
Is your feature request related to a problem/challenge you are trying
to solve?
Please provide some additional context of why this feature or
capability will be valuable.
validations:
required: true

- type: textarea
id: ideal-solution
attributes:
label: Describe Ideal Solution
description: A clear and concise description of what you want to happen.
validations:
required: true

- type: textarea
id: alternatives-considered
attributes:
label: Alternatives Considered
description: Explain alternative solutions or features considered.
validations:
required: false

- type: textarea
id: additional
attributes:
label: Additional Context
description: |
Add any other context about the problem here.
validations:
required: false
22 changes: 15 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
## what
* Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?)
* Use bullet points to be concise and to the point.

<!--
- Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?)
- Use bullet points to be concise and to the point.
-->

## why
* Provide the justifications for the changes (e.g. business case).
* Describe why these changes were made (e.g. why do these commits fix the problem?)
* Use bullet points to be concise and to the point.

<!--
- Provide the justifications for the changes (e.g. business case).
- Describe why these changes were made (e.g. why do these commits fix the problem?)
- Use bullet points to be concise and to the point.
-->

## references
* Link to any supporting github issues or helpful documentation to add some context (e.g. stackoverflow).
* Use `closes #123`, if this PR closes a GitHub issue `#123`

<!--
- Link to any supporting github issues or helpful documentation to add some context (e.g. stackoverflow).
- Use `closes #123`, if this PR closes a GitHub issue `#123`
-->
4 changes: 2 additions & 2 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
- uses: actions-ecosystem/action-get-merged-pull-request@v1
id: get-merged-pull-request
with:
github_token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
github_token: ${{ secrets.REPO_ACCESS_TOKEN }}
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v5
with:
publish: ${{ !contains(steps.get-merged-pull-request.outputs.labels, 'no-release') }}
prerelease: false
config-name: auto-release.yml
env:
GITHUB_TOKEN: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/[email protected]
with:
go-version: 1.19
go-version: 1.20

- name: Import GPG key
id: import_gpg
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/[email protected]
with:
go-version: "1.19"
go-version: "1.20"
id: go

- name: Check out code into the Go module directory
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Set up Go
uses: actions/[email protected]
with:
go-version: "1.19"
go-version: "1.20"
id: go

- name: Check out code into the Go module directory
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-codeowners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
checks: "syntax,owners,duppatterns"
owner_checker_allow_unowned_patterns: "false"
# GitHub access token is required only if the `owners` check is enabled
github_access_token: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
github_access_token: "${{ secrets.REPO_ACCESS_TOKEN }}"
- uses: mszostok/[email protected]
if: github.event.pull_request.head.repo.full_name != github.repository
name: "Syntax check of CODEOWNERS"
Expand Down
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.19
1.20
11 changes: 11 additions & 0 deletions docs/data-sources/component_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ locals {
result1 = yamldecode(data.utils_component_config.example1.output)
result2 = yamldecode(data.utils_component_config.example2.output)
result3 = yamldecode(data.utils_component_config.example3.output)
}
data "utils_component_config" "example1" {
Expand All @@ -47,6 +48,14 @@ data "utils_component_config" "example2" {
ignore_errors = false
env = local.env
}
data "utils_component_config" "example3" {
component = local.component
stack = local.stack
ignore_errors = false
atmos_cli_config_path = "."
atmos_base_path = "../../complete"
}
```

<!-- schema generated by tfplugindocs -->
Expand All @@ -58,6 +67,8 @@ data "utils_component_config" "example2" {

### Optional

- `atmos_base_path` (String) atmos base path to components and stacks.
- `atmos_cli_config_path` (String) atmos CLI config path.
- `env` (Map of String) Map of ENV vars in the format 'key=value'. These ENV vars will be set before executing the data source
- `environment` (String) Environment.
- `ignore_errors` (Boolean) Flag to ignore errors if the component is not found in the stack.
Expand Down
105 changes: 105 additions & 0 deletions docs/data-sources/describe_stacks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "utils_describe_stacks Data Source - terraform-provider-utils"
subcategory: ""
description: |-
The describe_stacks data source shows configuration for Atmos stacks and components in the stacks
---

# utils_describe_stacks (Data Source)

The `describe_stacks` data source shows configuration for Atmos stacks and components in the stacks

## Example Usage

```terraform
locals {
stack = "tenant1-ue2-dev"
namespace = ""
tenant = "tenant1"
environment = "ue2"
stage = "dev"
env = {
ENVIRONMENT = local.environment
STAGE = local.stage
ATMOS_CLI_CONFIG_PATH = "."
}
result1 = yamldecode(data.utils_describe_stacks.example1.output)
result2 = yamldecode(data.utils_describe_stacks.example2.output)
result3 = yamldecode(data.utils_describe_stacks.example3.output)
result4 = yamldecode(data.utils_describe_stacks.example4.output)
result5 = yamldecode(data.utils_describe_stacks.example5.output)
result6 = yamldecode(data.utils_describe_stacks.example6.output)
result7 = yamldecode(data.utils_describe_stacks.example7.output)
}
data "utils_describe_stacks" "example1" {
}
data "utils_describe_stacks" "example2" {
stack = local.stack
}
data "utils_describe_stacks" "example3" {
namespace = local.namespace
tenant = local.tenant
environment = local.environment
stage = local.stage
env = local.env
}
data "utils_describe_stacks" "example4" {
atmos_cli_config_path = "."
atmos_base_path = "../../complete"
component_types = ["terraform"]
sections = ["none"]
}
data "utils_describe_stacks" "example5" {
component_types = ["terraform"]
components = ["top-level-component1", "test/test-component-override-3"]
sections = ["none"]
}
data "utils_describe_stacks" "example6" {
tenant = local.tenant
environment = local.environment
stage = local.stage
component_types = ["terraform"]
components = ["test/test-component-override-3"]
sections = ["vars", "metadata", "env"]
}
data "utils_describe_stacks" "example7" {
component_types = ["terraform"]
components = ["top-level-component1"]
sections = ["vars"]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `atmos_base_path` (String) Atmos base path to components and stacks.
- `atmos_cli_config_path` (String) Atmos CLI config path.
- `component_types` (List of String) List of component types to filter by.
- `components` (List of String) List of Atmos components to filter by.
- `env` (Map of String) Map of ENV vars in the format 'key=value'. These ENV vars will be set before executing the data source
- `environment` (String) Environment to filter by.
- `ignore_errors` (Boolean) Flag to ignore errors in the provider when executing 'describe stacks' command.
- `namespace` (String) Namespace to filter by.
- `sections` (List of String) Output only the specified component sections.
- `stack` (String) Atmos stack to filter by.
- `stage` (String) Stage to filter by.
- `tenant` (String) Tenant to filter by.

### Read-Only

- `id` (String) The ID of this resource.
- `output` (String) Stack configurations.


Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
# In 'uri', Golang templates are supported https://pkg.go.dev/text/template
# If 'version' is provided, '{{.Version}}' will be replaced with the 'version' value before pulling the files from 'uri'
uri: github.com/cloudposse/terraform-aws-components.git//modules/account-map?ref={{.Version}}
version: 0.196.1
version: 1.91.0
# Only include the files that match the 'included_paths' patterns
# If 'included_paths' is not specified, all files will be matched except those that match the patterns from 'excluded_paths'
# 'included_paths' support POSIX-style Globs for file names/paths (double-star `**` is supported)
Expand All @@ -37,8 +37,4 @@ spec:

# mixins override files from 'source' with the same 'filename' (e.g. 'context.tf' will override 'context.tf' from the 'source')
# mixins are processed in the order they are declared in the list
mixins:
# Mixins 'uri' supports the following protocols: local files (absolute and relative paths), Git, Mercurial, HTTP, HTTPS, Amazon S3, Google GCP
- uri: https://raw.githubusercontent.com/cloudposse/terraform-aws-components/{{.Version}}/modules/datadog-agent/introspection.mixin.tf
version: 0.196.1
filename: introspection.mixin.tf
mixins: []
Loading

0 comments on commit c31757c

Please sign in to comment.