From 886041c98af897a8263fa21a2a51aa93f66a4a39 Mon Sep 17 00:00:00 2001 From: JD Date: Mon, 4 Jul 2022 16:16:22 -0700 Subject: [PATCH 1/3] Adding providers data to output --- opta/layer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opta/layer.py b/opta/layer.py index 6d1750387..bf95e1959 100644 --- a/opta/layer.py +++ b/opta/layer.py @@ -455,6 +455,8 @@ def outputs(self, module_idx: Optional[int] = None) -> Iterable[str]: module_idx = len(self.modules) - 1 if module_idx is None else module_idx for module in self.modules[0 : module_idx + 1]: ret += module.outputs() + if self.parent is None: + ret.append("providers") return ret def gen_tf( @@ -482,6 +484,8 @@ def gen_tf( ret, ) ret["output"] = ret.get("output", {}) + if self.parent is None: + ret["output"]["providers"] = {"value": self.providers} ret["output"]["state_storage"] = {"value": self.state_storage()} return hydrate(ret, self.metadata_hydration()) From 64f3bfd161b63fcec46171be53a83bb96825e25e Mon Sep 17 00:00:00 2001 From: JD Date: Mon, 4 Jul 2022 16:56:43 -0700 Subject: [PATCH 2/3] testfixing --- tests/test_layer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_layer.py b/tests/test_layer.py index 10881d5c9..40285e859 100644 --- a/tests/test_layer.py +++ b/tests/test_layer.py @@ -66,6 +66,7 @@ def test_hydration_aws(self, mocker: MockFixture): k8s_node_group_security_id="${data.terraform_remote_state.parent.outputs.k8s_node_group_security_id}", load_balancer_raw_dns="${data.terraform_remote_state.parent.outputs.load_balancer_raw_dns}", load_balancer_arn="${data.terraform_remote_state.parent.outputs.load_balancer_arn}", + providers="${data.terraform_remote_state.parent.outputs.providers}", ), "parent_name": "dummy-parent", "state_storage": "opta-tf-state-opta-tests-dummy-parent-195d", @@ -113,6 +114,7 @@ def test_hydration_gcp(self, mocker: MockFixture): k8s_ca_data="${data.terraform_remote_state.parent.outputs.k8s_ca_data}", k8s_cluster_name="${data.terraform_remote_state.parent.outputs.k8s_cluster_name}", load_balancer_raw_ip="${data.terraform_remote_state.parent.outputs.load_balancer_raw_ip}", + providers="${data.terraform_remote_state.parent.outputs.providers}", ), "parent_name": "gcp-dummy-parent", "state_storage": "opta-tf-state-opta-tests-gcp-dummy-parent", From 033b1e2a4ea91496c5b0e1121eacf6f7112b1192 Mon Sep 17 00:00:00 2001 From: JD Date: Mon, 4 Jul 2022 17:13:44 -0700 Subject: [PATCH 3/3] testfixing --- tests/fixtures/basic_apply.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/fixtures/basic_apply.py b/tests/fixtures/basic_apply.py index 65b184d8c..072fea49c 100644 --- a/tests/fixtures/basic_apply.py +++ b/tests/fixtures/basic_apply.py @@ -51,6 +51,9 @@ "s3_log_bucket_name": {"value": "${module.core.s3_log_bucket_name }"}, "public_nat_ips": {"value": "${module.core.public_nat_ips }"}, "state_storage": {"value": "opta-tf-state-test-dev1-98f2"}, + "providers": { + "value": {"aws": {"account_id": "111111111111", "region": "us-east-1"}} + }, }, }, )