manifold-cli 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +15 -2
- data/lib/manifold/api/project.rb +4 -4
- data/lib/manifold/cli.rb +3 -1
- data/lib/manifold/terraform/project_configuration.rb +12 -6
- data/lib/manifold/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdae058a6565425aa19baae58b7da3b53894e796f80e2a4a71381e47f7efa5a4
|
4
|
+
data.tar.gz: c0098c7dab8c4289d7e4e5e5bc0eb9b2bc49941c527c2f51292351a347e76d84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fea29b28a3883eafd9b96fa8a84a3be0472671185323c6e12e88986a442084311f725f65559f504c62d0324be21ee868d87dc0415f6bcb55de17fbd755a66915
|
7
|
+
data.tar.gz: 78d64517a90ec5a6911807fa7b439930b2712362c173a31c463084ad1f2048571a6ca1e0d402fb899d418ada6e71e2f34cf56ab31c4e93e906f0b2ddb95b03fe
|
data/README.md
CHANGED
@@ -69,16 +69,20 @@ manifold generate
|
|
69
69
|
Manifold can optionally generate Terraform configurations for managing your BigQuery resources. To generate both BigQuery schemas and Terraform configurations, use the `--tf` flag:
|
70
70
|
|
71
71
|
```bash
|
72
|
+
# Generate standard Terraform configuration
|
72
73
|
manifold generate --tf
|
74
|
+
|
75
|
+
# Generate Terraform configuration as a submodule (skips provider configuration)
|
76
|
+
manifold generate --tf --submodule
|
73
77
|
```
|
74
78
|
|
75
79
|
This will create:
|
76
80
|
|
77
|
-
- A root `main.tf.json` file that sets up the Google Cloud provider and workspace modules
|
81
|
+
- A root `main.tf.json` file that sets up the Google Cloud provider and workspace modules (unless using `--submodule`)
|
78
82
|
- Individual workspace configurations in `workspaces/<workspace_name>/main.tf.json`
|
79
83
|
- Dataset and table definitions that reference your generated BigQuery schemas
|
80
84
|
|
81
|
-
The generated Terraform configurations use the Google Cloud provider and expect a `project_id` variable to be set.
|
85
|
+
The generated Terraform configurations use the Google Cloud provider and expect a `project_id` variable to be set. When using the standard configuration (without `--submodule`), you can apply these configurations directly:
|
82
86
|
|
83
87
|
```bash
|
84
88
|
terraform init
|
@@ -86,6 +90,15 @@ terraform plan -var="project_id=your-project-id"
|
|
86
90
|
terraform apply -var="project_id=your-project-id"
|
87
91
|
```
|
88
92
|
|
93
|
+
When using `--submodule`, the generated configuration skips provider setup, allowing you to include the project as a module in a larger Terraform configuration:
|
94
|
+
|
95
|
+
```hcl
|
96
|
+
module "my_manifold_project" {
|
97
|
+
source = "./path/to/manifold/project"
|
98
|
+
project_id = var.project_id
|
99
|
+
}
|
100
|
+
```
|
101
|
+
|
89
102
|
## Manifold Configuration
|
90
103
|
|
91
104
|
### Vectors
|
data/lib/manifold/api/project.rb
CHANGED
@@ -22,9 +22,9 @@ module Manifold
|
|
22
22
|
@workspaces ||= workspace_directories.map { |dir| Workspace.from_directory(dir, logger:) }
|
23
23
|
end
|
24
24
|
|
25
|
-
def generate(with_terraform: false)
|
25
|
+
def generate(with_terraform: false, is_submodule: false)
|
26
26
|
workspaces.each { |w| w.generate(with_terraform:) }
|
27
|
-
generate_terraform_entrypoint if with_terraform
|
27
|
+
generate_terraform_entrypoint(is_submodule:) if with_terraform
|
28
28
|
end
|
29
29
|
|
30
30
|
def workspaces_directory
|
@@ -41,8 +41,8 @@ module Manifold
|
|
41
41
|
workspaces_directory.children.select(&:directory?)
|
42
42
|
end
|
43
43
|
|
44
|
-
def generate_terraform_entrypoint
|
45
|
-
config = Terraform::ProjectConfiguration.new(workspaces)
|
44
|
+
def generate_terraform_entrypoint(is_submodule: false)
|
45
|
+
config = Terraform::ProjectConfiguration.new(workspaces, skip_provider_config: is_submodule)
|
46
46
|
config.write(directory.join("main.tf.json"))
|
47
47
|
end
|
48
48
|
end
|
data/lib/manifold/cli.rb
CHANGED
@@ -47,11 +47,13 @@ module Manifold
|
|
47
47
|
|
48
48
|
desc "generate", "Generate BigQuery schema for all workspaces in the project"
|
49
49
|
method_option :tf, type: :boolean, desc: "Generate Terraform configurations"
|
50
|
+
method_option :submodule, type: :boolean, default: false,
|
51
|
+
desc: "Generate Terraform configurations as a submodule (skips provider configuration)"
|
50
52
|
def generate
|
51
53
|
path = Pathname.pwd
|
52
54
|
name = path.basename.to_s
|
53
55
|
project = API::Project.new(name, directory: path, logger:)
|
54
|
-
project.generate(with_terraform: options[:tf])
|
56
|
+
project.generate(with_terraform: options[:tf], is_submodule: options[:submodule])
|
55
57
|
logger.info "Generated BigQuery schema for all workspaces in the project."
|
56
58
|
end
|
57
59
|
end
|
@@ -4,23 +4,29 @@ module Manifold
|
|
4
4
|
module Terraform
|
5
5
|
# Represents a Terraform configuration for a Manifold project.
|
6
6
|
class ProjectConfiguration < Configuration
|
7
|
-
attr_reader :workspaces, :provider_version
|
7
|
+
attr_reader :workspaces, :provider_version, :skip_provider_config
|
8
8
|
|
9
9
|
DEFAULT_TERRAFORM_GOOGLE_PROVIDER_VERSION = "6.18.1"
|
10
10
|
|
11
|
-
def initialize(workspaces, provider_version: DEFAULT_TERRAFORM_GOOGLE_PROVIDER_VERSION
|
11
|
+
def initialize(workspaces, provider_version: DEFAULT_TERRAFORM_GOOGLE_PROVIDER_VERSION,
|
12
|
+
skip_provider_config: false)
|
12
13
|
super()
|
13
14
|
@workspaces = workspaces
|
14
15
|
@provider_version = provider_version
|
16
|
+
@skip_provider_config = skip_provider_config
|
15
17
|
end
|
16
18
|
|
17
19
|
def as_json
|
18
|
-
{
|
19
|
-
|
20
|
-
"
|
20
|
+
config = {}
|
21
|
+
unless skip_provider_config
|
22
|
+
config["terraform"] = terraform_block
|
23
|
+
config["provider"] = provider_block
|
24
|
+
end
|
25
|
+
|
26
|
+
config.merge!(
|
21
27
|
"variable" => variables_block,
|
22
28
|
"module" => workspace_modules
|
23
|
-
|
29
|
+
)
|
24
30
|
end
|
25
31
|
|
26
32
|
private
|
data/lib/manifold/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manifold-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- claytongentry
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-02-
|
10
|
+
date: 2025-02-07 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: thor
|