Module: Pangea

Defined in:
lib/pangea/errors.rb,
lib/pangea/cli.rb,
lib/pangea/magma.rb,
lib/pangea/backend.rb,
lib/pangea/logging.rb,
lib/pangea/outputs.rb,
lib/pangea/presets.rb,
lib/pangea/secrets.rb,
lib/pangea/arch_dsl.rb,
lib/pangea/entities.rb,
lib/pangea/cli/theme.rb,
lib/pangea/cli/config.rb,
lib/pangea/validation.rb,
lib/pangea/cli/cascade.rb,
lib/pangea/magma/chain.rb,
lib/pangea/magma/stack.rb,
lib/pangea/architecture.rb,
lib/pangea/magma/runner.rb,
lib/pangea/magma/runner.rb,
lib/pangea/remote_state.rb,
lib/pangea/cli/operations.rb,
lib/pangea/cli/reactivity.rb,
lib/pangea/magma/matchers.rb,
lib/pangea/resources/base.rb,
lib/pangea/tagging/policy.rb,
lib/pangea/types/registry.rb,
lib/pangea/cli/orchestrate.rb,
lib/pangea/cli/synthesizer.rb,
lib/pangea/cli/tofu_events.rb,
lib/pangea/components/base.rb,
lib/pangea/magma/migration.rb,
lib/pangea/magma/workspace.rb,
lib/pangea/tagging/tag_set.rb,
lib/pangea/contracts/errors.rb,
lib/pangea/entities/project.rb,
lib/pangea/types/base_types.rb,
lib/pangea/entities/template.rb,
lib/pangea/provider_contract.rb,
lib/pangea/resource_registry.rb,
lib/pangea/resources/helpers.rb,
lib/pangea/component_registry.rb,
lib/pangea/entities/namespace.rb,
lib/pangea/logging/formatters.rb,
lib/pangea/magma/distribution.rb,
lib/pangea/magma/optimization.rb,
lib/pangea/magma/orchestrator.rb,
lib/pangea/magma/test_support.rb,
lib/pangea/testing/assertions.rb,
lib/pangea/testing/spec_setup.rb,
lib/pangea/types/domain_types.rb,
lib/pangea/resources/reference.rb,
lib/pangea/tagging/fingerprint.rb,
lib/pangea/tagging/tag_adapter.rb,
lib/pangea/testing/type_purity.rb,
lib/pangea/contracts/iam_result.rb,
lib/pangea/resources/types/core.rb,
lib/pangea/testing/spec_generator.rb,
lib/pangea/utilities/ip_discovery.rb,
lib/pangea/contracts/cluster_result.rb,
lib/pangea/contracts/network_result.rb,
lib/pangea/resources/resource_input.rb,
lib/pangea/testing/indifferent_hash.rb,
lib/pangea/logging/structured_logger.rb,
lib/pangea/resources/base_attributes.rb,
lib/pangea/resources/network_helpers.rb,
lib/pangea/resources/types/coercions.rb,
lib/pangea/testing/resource_examples.rb,
lib/pangea/entities/module_definition.rb,
lib/pangea/resources/resource_builder.rb,
lib/pangea/resources/validators/common.rb,
lib/pangea/contracts/architecture_result.rb,
lib/pangea/resources/reference_generator.rb,
lib/pangea/testing/synthesis_test_helpers.rb,
lib/pangea/testing/mock_resource_reference.rb,
lib/pangea/contracts/security_group_accessor.rb,
lib/pangea/resources/builders/output_builder.rb,
lib/pangea/testing/mock_terraform_synthesizer.rb,
lib/pangea/testing/architecture_spec_generator.rb,
lib/pangea/resources/validators/format_validators.rb,
lib/pangea/resources/validators/network_validators.rb

Overview

Copyright 2025 The Pangea Authors

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Defined Under Namespace

Modules: ArchDsl, Backend, ComponentRegistry, Components, Contracts, Entities, Errors, Logging, Magma, Outputs, Presets, ProviderContract, RemoteState, ResourceRegistry, Resources, Secrets, Tagging, TemplateHelpers, Testing, Types, Utilities, Validation Classes: Architecture, CLI

Class Method Summary collapse

Class Method Details

.architecture(name) { ... } ⇒ Pangea::Architecture

Register a named architecture and return its Architecture instance. The block isn’t executed here — only captured for later “apply“ by the synthesis machinery.

Parameters:

  • name (String, Symbol)

    Human-facing name

Yields:

  • The architecture body (see Pangea::Architecture)

Returns:

Raises:

  • (ArgumentError)


101
102
103
104
105
106
107
108
# File 'lib/pangea/architecture.rb', line 101

def architecture(name, &block)
  raise ArgumentError, 'Pangea.architecture requires a block' unless block

  arch = Architecture.new(name.to_s, block)
  @architectures[name.to_s] = arch
  @last_architecture = arch
  arch
end

.architecture_for(name) ⇒ Object

Lookup by name — returns nil if unknown.



111
112
113
# File 'lib/pangea/architecture.rb', line 111

def architecture_for(name)
  @architectures[name.to_s]
end

.architecturesObject

Entire registry snapshot (caller gets a dup — the live map is internal).



117
118
119
# File 'lib/pangea/architecture.rb', line 117

def architectures
  @architectures.dup
end

.last_architectureObject

Most-recently-declared architecture. Used by the synthesizer to fall back when no explicit “template :name do“ block was present in the template file.



124
125
126
# File 'lib/pangea/architecture.rb', line 124

def last_architecture
  @last_architecture
end

.reset_architectures!Object

Reset the registry — primarily for tests that want a clean starting state. Not part of the public DSL.



130
131
132
133
# File 'lib/pangea/architecture.rb', line 130

def reset_architectures!
  @architectures = {}
  @last_architecture = nil
end