🚀 Enhancements
Add `metadata` top-level section to all components. Add `type` attribute to the `metadata` section (`metadata.type`). Update README @aknysh (#99)
what
- Update README
- Add
metadata
top-level section to all components - Add
type
attribute to themetadata
section (metadata.type
)
why
-
Remove the old/obsolete sections from README (new README with new
atmos
features coming soon) -
The
metadata
section is used to describe metadata for a component (it's for the component only, not deep-merged with base components or globals). Other attributes might be added to the section in the future to describe component types, kinds and different behaviors -
type
attribute in themetadata
section specifies the component type:real
(implicit and default, and can be provisioned) orabstract
(non-deployable, just a base class for derived components, like abstract classes in OOP)
components:
terraform:
"test/test-component":
settings:
spacelift:
workspace_enabled: true
# Setting `metadata.type: abstract` makes the component `abstract` (similar to OOP abstract classes, which can't be instantiated),
# explicitly prohibiting the component from being deployed,
# and a Spacelift stack from being created for the component (even if `settings.spacelift.workspace_enabled: true`).
# `terraform apply` and `terraform deploy` will fail with an error that the component cannot be provisioned.
# All other terraform commands on this component will succeed.
# If `metadata.type` attribute is not specified, it defaults to `real` (which means the component can be provisioned).
metadata:
type: real # `real` is implicit, you don't need to specify it; `abstract` makes the component protected from being deployed
metadata.type
attribute in themetadata
section allows explicitly disabling a component from being deployed. This is useful for non-deployable base components (which are just blueprints for derived components) if we need to prohibit the base components from being deployed (accidentally via CLI or via Spacelift).
For Spacelift, this will prevent derived components from inheritingsettings.spacelift.workspace_enabled=false
of not-deployable component (allowing specifying settings.spacelift.workspace_enabled=true` at a global level making the config DRY)
test
components:
terraform:
"test/test-component":
settings:
spacelift:
workspace_enabled: false
metadata:
type: abstract
atmos terraform apply test/test-component -s=tenant1-ue2-dev
Variables for the component 'test/test-component' in the stack 'tenant1/ue2/dev':
enabled: true
environment: ue2
namespace: eg
region: us-east-2
service_1_name: service-1
service_2_name: service-2
stage: dev
tenant: tenant1
Abstract component 'test/test-component' cannot be provisioned
since it's explicitly prohibited from being deployed with 'metadata.type: abstract' attribute
Spacelift config
settings:
spacelift:
workspace_enabled: false
atmos describe component test/test-component -s=tenant1-ue2-dev
results in:
settings:
spacelift: {}