-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IBCDPE-935] Setting up declerative defintion of TF resources (#11)
* Start the process of organizing the tf resources
- Loading branch information
1 parent
28a6d2b
commit beeac99
Showing
58 changed files
with
1,357 additions
and
561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# infracost integration | ||
resource "spacelift_context" "k8s-kubeconfig" { | ||
description = "Hooks used to set up the kubeconfig for connecting to the K8s cluster" | ||
name = "Kubernetes Deployments Kubeconfig" | ||
space_id = "root" | ||
|
||
before_init = [ | ||
"aws eks update-kubeconfig --region $REGION --name $CLUSTER_NAME" | ||
] | ||
|
||
before_plan = [ | ||
"aws eks update-kubeconfig --region $REGION --name $CLUSTER_NAME" | ||
] | ||
|
||
before_apply = [ | ||
"aws eks update-kubeconfig --region $REGION --name $CLUSTER_NAME" | ||
] | ||
|
||
before_perform = [ | ||
"aws eks update-kubeconfig --region $REGION --name $CLUSTER_NAME" | ||
] | ||
|
||
before_destroy = [ | ||
"aws eks update-kubeconfig --region $REGION --name $CLUSTER_NAME" | ||
] | ||
} | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module "policies" { | ||
source = "./policies" | ||
} | ||
|
||
module "contexts" { | ||
source = "./contexts" | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
output "enforce_tags_on_resources_id" { | ||
value = spacelift_policy.enforce-tags-on-resources.id | ||
description = "The ID for this spacelift_policy. Checks that a cost center tag is added." | ||
} | ||
|
||
output "check_estimated_cloud_spend_id" { | ||
value = spacelift_policy.cloud-spend-estimation.id | ||
description = "The ID for this spacelift_policy" | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
## Deployments | ||
|
||
These are the different deployments that are within the kubernetes cluster | ||
This directory is not actively used and will be removed in the future |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
resource "spacelift_space" "development" { | ||
name = "development" | ||
parent_space_id = var.parent_space_id | ||
description = "Contains all the resources to deploy out to the dev enviornment." | ||
inherit_entities = true | ||
} | ||
|
||
module "dpe-sandbox-spacelift" { | ||
source = "./spacelift/dpe-sandbox" | ||
parent_space_id = spacelift_space.development.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
resource "spacelift_space" "dpe-sandbox" { | ||
name = "dpe-sandbox" | ||
parent_space_id = var.parent_space_id | ||
description = "Contains resources for the DPE team for sandbox testing." | ||
inherit_entities = true | ||
} | ||
|
||
resource "spacelift_stack" "k8s-stack" { | ||
github_enterprise { | ||
namespace = "Sage-Bionetworks-Workflows" | ||
id = "sage-bionetworks-workflows-gh" | ||
} | ||
|
||
administrative = false | ||
autodeploy = true | ||
branch = "ibcdpe-935-vpc-updates" | ||
description = "Infrastructure to support deploying to an EKS cluster" | ||
name = "DPE DEV Kubernetes Infrastructure" | ||
project_root = "dev/stacks/dpe-sandbox-k8s" | ||
repository = "eks-stack" | ||
terraform_version = "1.7.2" | ||
terraform_workflow_tool = "OPEN_TOFU" | ||
space_id = spacelift_space.dpe-sandbox.id | ||
} | ||
|
||
resource "spacelift_stack" "k8s-stack-deployments" { | ||
github_enterprise { | ||
namespace = "Sage-Bionetworks-Workflows" | ||
id = "sage-bionetworks-workflows-gh" | ||
} | ||
|
||
administrative = false | ||
autodeploy = true | ||
branch = "ibcdpe-935-vpc-updates" | ||
description = "Deployments internal to an EKS cluster" | ||
name = "DPE DEV Kubernetes Deployments" | ||
project_root = "dev/stacks/dpe-sandbox-k8s-deployments" | ||
repository = "eks-stack" | ||
terraform_version = "1.7.2" | ||
terraform_workflow_tool = "OPEN_TOFU" | ||
space_id = spacelift_space.dpe-sandbox.id | ||
} | ||
|
||
resource "spacelift_context_attachment" "k8s-kubeconfig-hooks" { | ||
context_id = "kubernetes-deployments-kubeconfig" | ||
stack_id = spacelift_stack.k8s-stack-deployments.id | ||
} | ||
|
||
resource "spacelift_stack_dependency" "k8s-stack-to-deployments" { | ||
stack_id = spacelift_stack.k8s-stack-deployments.id | ||
depends_on_stack_id = spacelift_stack.k8s-stack.id | ||
} | ||
|
||
resource "spacelift_stack_dependency_reference" "vpc-id-reference" { | ||
stack_dependency_id = spacelift_stack_dependency.k8s-stack-to-deployments.id | ||
output_name = "vpc_id" | ||
input_name = "TF_VAR_vpc_id" | ||
} | ||
|
||
resource "spacelift_stack_dependency_reference" "private-subnet-ids-reference" { | ||
stack_dependency_id = spacelift_stack_dependency.k8s-stack-to-deployments.id | ||
output_name = "private_subnet_ids" | ||
input_name = "TF_VAR_private_subnet_ids" | ||
} | ||
|
||
resource "spacelift_stack_dependency_reference" "security-group-id-reference" { | ||
stack_dependency_id = spacelift_stack_dependency.k8s-stack-to-deployments.id | ||
output_name = "node_security_group_id" | ||
input_name = "TF_VAR_node_security_group_id" | ||
} | ||
|
||
resource "spacelift_stack_dependency_reference" "vpc-cidr-block-reference" { | ||
stack_dependency_id = spacelift_stack_dependency.k8s-stack-to-deployments.id | ||
output_name = "vpc_cidr_block" | ||
input_name = "TF_VAR_vpc_cidr_block" | ||
} | ||
|
||
resource "spacelift_stack_dependency_reference" "region-name" { | ||
stack_dependency_id = spacelift_stack_dependency.k8s-stack-to-deployments.id | ||
output_name = "region" | ||
input_name = "REGION" | ||
} | ||
|
||
resource "spacelift_stack_dependency_reference" "cluster-name" { | ||
stack_dependency_id = spacelift_stack_dependency.k8s-stack-to-deployments.id | ||
output_name = "cluster_name" | ||
input_name = "CLUSTER_NAME" | ||
} | ||
|
||
resource "spacelift_stack_dependency_reference" "cluster-name-tfvar" { | ||
stack_dependency_id = spacelift_stack_dependency.k8s-stack-to-deployments.id | ||
output_name = "cluster_name" | ||
input_name = "TF_VAR_cluster_name" | ||
} | ||
|
||
# resource "spacelift_policy_attachment" "policy-attachment" { | ||
# policy_id = each.value.policy_id | ||
# stack_id = spacelift_stack.k8s-stack.id | ||
# } | ||
|
||
resource "spacelift_stack_destructor" "k8s-stack-deployments-destructor" { | ||
depends_on = [ | ||
spacelift_stack.k8s-stack, | ||
] | ||
|
||
stack_id = spacelift_stack.k8s-stack-deployments.id | ||
} | ||
|
||
resource "spacelift_stack_destructor" "k8s-stack-destructor" { | ||
stack_id = spacelift_stack.k8s-stack.id | ||
} | ||
|
||
resource "spacelift_aws_integration_attachment" "k8s-aws-integration-attachment" { | ||
integration_id = "01HXW154N60KJ8NCC93H1VYPNM" | ||
stack_id = spacelift_stack.k8s-stack.id | ||
read = true | ||
write = true | ||
} | ||
|
||
resource "spacelift_aws_integration_attachment" "k8s-deployments-aws-integration-attachment" { | ||
integration_id = "01HXW154N60KJ8NCC93H1VYPNM" | ||
stack_id = spacelift_stack.k8s-stack-deployments.id | ||
read = true | ||
write = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
output "k8s_stack_id" { | ||
value = spacelift_stack.k8s-stack.id | ||
} | ||
|
||
output "k8s_stack_deployments_id" { | ||
value = spacelift_stack.k8s-stack-deployments.id | ||
} |
Oops, something went wrong.