diff --git a/.github/workflows/test-positive.yml b/.github/workflows/test-positive.yml
index 4412d09..70ee5a2 100644
--- a/.github/workflows/test-positive.yml
+++ b/.github/workflows/test-positive.yml
@@ -12,7 +12,9 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: true
outputs:
- result: "${{ steps.current.outputs.value }}"
+ base_result: ${{ steps.base.outputs.value }}
+ derived_result: ${{ steps.derived.outputs.value }}
+ defaults_result: ${{ steps.defaults.outputs.value }}
steps:
- name: Setup terraform
uses: hashicorp/setup-terraform@v2
@@ -24,17 +26,41 @@ jobs:
uses: actions/checkout@v3
- uses: ./
- id: current
+ id: base
with:
component: foo
stack: core-ue1-dev
settings-path: level1.level2.level3.secrets-arn
+ - uses: ./
+ id: derived
+ with:
+ component: derived
+ stack: core-ue1-dev
+ settings-path: level1.example
+
+ - uses: ./
+ id: defaults
+ with:
+ component: test-defaults
+ stack: core-ue1-dev
+ settings-path: level1.example
+
assert:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: nick-fields/assert-action@v1
with:
- expected: arn:aws:secretsmanager:us-east-1:000000000000:secret:MySecret-PlMes3
- actual: "${{ needs.test.outputs.result }}"
+ expected: '"arn:aws:secretsmanager:us-east-1:000000000000:secret:MySecret-PlMes3"'
+ actual: ${{ needs.test.outputs.base_result }}
+
+ - uses: nick-fields/assert-action@v1
+ with:
+ expected: '"result"'
+ actual: ${{ needs.test.outputs.derived_result }}
+
+ - uses: nick-fields/assert-action@v1
+ with:
+ expected: '"result"'
+ actual: ${{ needs.test.outputs.defaults_result }}
diff --git a/README.md b/README.md
index 835b338..ca0204a 100644
--- a/README.md
+++ b/README.md
@@ -279,12 +279,14 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
### Contributors
-| [![Matt Calhoun][mcalhoun_avatar]][mcalhoun_homepage]
[Matt Calhoun][mcalhoun_homepage] |
-|---|
+| [![Matt Calhoun][mcalhoun_avatar]][mcalhoun_homepage]
[Matt Calhoun][mcalhoun_homepage] | [![Daniel Miller][milldr_avatar]][milldr_homepage]
[Daniel Miller][milldr_homepage] |
+|---|---|
[mcalhoun_homepage]: https://github.com/mcalhoun
[mcalhoun_avatar]: https://img.cloudposse.com/150x150/https://github.com/mcalhoun.png
+ [milldr_homepage]: https://github.com/milldr
+ [milldr_avatar]: https://img.cloudposse.com/150x150/https://github.com/milldr.png
[![README Footer][readme_footer_img]][readme_footer_link]
[![Beacon][beacon]][website]
diff --git a/README.yaml b/README.yaml
index 5e99eac..f3493b8 100644
--- a/README.yaml
+++ b/README.yaml
@@ -87,3 +87,5 @@ include:
contributors:
- name: "Matt Calhoun"
github: "mcalhoun"
+ - name: "Daniel Miller"
+ github: "milldr"
diff --git a/action.yml b/action.yml
index 7fe2b7a..95dae09 100644
--- a/action.yml
+++ b/action.yml
@@ -24,5 +24,11 @@ runs:
- id: settings
shell: bash
run: |
- value=$(atmos describe stacks -s ${{ inputs.stack }} --components ${{ inputs.component }} --sections=settings --format json | jq -rc --arg key "${{inputs.settings-path}}" '.. | select(.settings)?| .settings | select(has($key | split(".")[])) | getpath($key | split("."))')
+ value=$(atmos describe component \
+ ${{ inputs.component }} \
+ -s ${{ inputs.stack }} \
+ --format json | \
+ jq --arg key ${{ inputs.settings-path }} \
+ '.settings | getpath($key | split("."))' \
+ )
echo "value=$value" >> $GITHUB_OUTPUT
diff --git a/stacks/orgs/demo/dev/defaults.yaml b/stacks/orgs/demo/dev/defaults.yaml
new file mode 100644
index 0000000..0b5d0b9
--- /dev/null
+++ b/stacks/orgs/demo/dev/defaults.yaml
@@ -0,0 +1,17 @@
+# Test use of atmos default settings with component settings
+settings:
+ level1:
+ example: default
+
+components:
+ terraform:
+ test-defaults:
+ settings:
+ level1:
+ example: result
+ vars:
+ namespace: demo
+ tenant: core
+ environment: ue1
+ stage: dev
+ foo: bar
diff --git a/stacks/orgs/demo/dev/derived.yaml b/stacks/orgs/demo/dev/derived.yaml
new file mode 100644
index 0000000..9773251
--- /dev/null
+++ b/stacks/orgs/demo/dev/derived.yaml
@@ -0,0 +1,37 @@
+# Test derived component overwriting
+components:
+ terraform:
+ derived/default:
+ metadata:
+ component: derived
+ type: abstract
+ settings:
+ level1:
+ example: default
+ vars:
+ namespace: demo
+ tenant: core
+ environment: ue1
+ stage: dev
+ foo: bar
+
+ # This is the component that we want to test getting settings from.
+ # "derived/default" and "derived/alternate" components should not affect these settings
+ derived:
+ metadata:
+ component: derived
+ inherits:
+ - derived/default
+ settings:
+ level1:
+ example: result
+
+ # Test adding an alternate component. This should not affect the true "derived" component.
+ derived/alternate:
+ metadata:
+ component: derived
+ inherits:
+ - derived/default
+ settings:
+ level1:
+ example: alternate
diff --git a/stacks/orgs/demo/dev/dev.yaml b/stacks/orgs/demo/dev/dev.yaml
index 21c7578..7437163 100644
--- a/stacks/orgs/demo/dev/dev.yaml
+++ b/stacks/orgs/demo/dev/dev.yaml
@@ -1,3 +1,4 @@
+# Test basic use
components:
terraform:
foo:
@@ -5,7 +6,7 @@ components:
level1:
level2:
level3:
- secrets-arn: arn:aws:secretsmanager:us-east-1:000000000000:secret:MySecret-PlMes3
+ secrets-arn: "arn:aws:secretsmanager:us-east-1:000000000000:secret:MySecret-PlMes3"
vars:
namespace: demo
tenant: core