Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature #810

Open
wants to merge 42 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0c8ab91
updated project ids
Kenechukwu881 May 20, 2024
20c1abf
fixing http server tag
keneobum881 May 20, 2024
9a34721
fixing http server tag
keneobum881 May 20, 2024
3b10324
Merge pull request #1 from keneobum881/feature
keneobum881 May 20, 2024
906f1a6
fixing http server tag
keneobum881 May 20, 2024
277bfb4
Merge branch 'dev' into feature
keneobum881 May 20, 2024
cdc12ac
deploying a vpc
keneobum881 May 21, 2024
5dd359e
Merge branch 'feature' of github.com:keneobum881/ken-cloudbuild-gitop…
keneobum881 May 21, 2024
6c14b4d
deploying a vpc
keneobum881 May 21, 2024
4fc5a76
deploying a vpc
keneobum881 May 21, 2024
b99f5bb
deploying a vpc
keneobum881 May 21, 2024
df9dccb
Merge pull request #2 from keneobum881/feature
keneobum881 May 21, 2024
a9bd6b5
Revert "testing vpc"
keneobum881 May 21, 2024
262fc82
Merge pull request #3 from keneobum881/revert-2-feature
keneobum881 May 21, 2024
096e1a1
deploying a vpc
keneobum881 May 21, 2024
c743702
deploying a vpc
keneobum881 May 21, 2024
399a5b6
updating code
keneobum881 May 21, 2024
3f19325
updating code
keneobum881 May 21, 2024
fa3141d
recent changes
keneobum881 May 21, 2024
10531c3
Merge pull request #4 from keneobum881/feature
keneobum881 May 21, 2024
0eef716
deploying gke
keneobum881 May 21, 2024
3f981b6
Merge pull request #5 from keneobum881/feature
keneobum881 May 21, 2024
87b1dda
deploying gke
keneobum881 May 21, 2024
ff2e453
Merge pull request #6 from keneobum881/feature
keneobum881 May 21, 2024
95bafa5
deployig gke cluster
keneobum881 May 22, 2024
1e9f757
deployig gke cluster
keneobum881 May 22, 2024
23f04c8
Merge branch 'dev' into feature
keneobum881 May 22, 2024
1a30603
Merge pull request #7 from keneobum881/feature
keneobum881 May 22, 2024
196483a
deployig gke cluster
keneobum881 May 22, 2024
89a937c
Merge branch 'feature' of github.com:keneobum881/ken-cloudbuild-gitop…
keneobum881 May 22, 2024
bb02927
deployig gke cluster
keneobum881 May 22, 2024
d0124fa
deployig gke cluster
keneobum881 May 22, 2024
2a8e841
Merge pull request #8 from keneobum881/feature
keneobum881 May 22, 2024
c2134c4
deployig gke cluster
keneobum881 May 22, 2024
0011e8c
Merge branch 'dev' into feature
keneobum881 May 22, 2024
9eed9e1
Merge branch 'dev' of github.com:keneobum881/ken-cloudbuild-gitops in…
keneobum881 May 22, 2024
8e6195e
Merge pull request #9 from keneobum881/feature
keneobum881 May 22, 2024
a554c44
deployig gke cluster
keneobum881 May 22, 2024
ecc07e7
Merge branch 'dev' of github.com:keneobum881/ken-cloudbuild-gitops in…
keneobum881 May 22, 2024
0cbb8ba
deployig gke cluster
keneobum881 May 22, 2024
a1ec3ad
deployig gke cluster
keneobum881 May 22, 2024
3c9a675
deployig gke cluster
keneobum881 May 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,5 @@ steps:
echo "*******************************************************************************"
fi
# [END tf-apply]
options:
logging: CLOUD_LOGGING_ONLY
2 changes: 1 addition & 1 deletion environments/dev/backend.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

terraform {
backend "gcs" {
bucket = "PROJECT_ID-tfstate"
bucket = "aksgkelearning-tfstate"
prefix = "env/dev"
}
}
26 changes: 10 additions & 16 deletions environments/dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,14 @@ provider "google" {
project = "${var.project}"
}

module "vpc" {
source = "../../modules/vpc"
project = "${var.project}"
env = "${local.env}"
}
# module "vpc" {
# source = "../../modules/vpc"
# project = "${var.project}"
# env = "${local.env}"
# }

module "http_server" {
source = "../../modules/http_server"
project = "${var.project}"
subnet = "${module.vpc.subnet}"
}

module "firewall" {
source = "../../modules/firewall"
project = "${var.project}"
subnet = "${module.vpc.subnet}"
}
# module "gke_cluster" {
# source = "../../modules/gke"
# project = "${var.project}"
# subnet = "${module.vpc.subnet}"
# }
24 changes: 6 additions & 18 deletions environments/dev/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,10 @@
# limitations under the License.


output "network" {
value = "${module.vpc.network}"
}
# output "network" {
# value = "${module.vpc.network}"
# }

output "subnet" {
value = "${module.vpc.subnet}"
}

output "firewall_rule" {
value = "${module.firewall.firewall_rule}"
}

output "instance_name" {
value = "${module.http_server.instance_name}"
}

output "external_ip" {
value = "${module.http_server.external_ip}"
}
# output "subnet" {
# value = "${module.vpc.subnet}"
# }
2 changes: 1 addition & 1 deletion environments/dev/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1 +1 @@
project="PROJECT_ID"
project="aksgkelearning"
2 changes: 1 addition & 1 deletion environments/prod/backend.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

terraform {
backend "gcs" {
bucket = "PROJECT_ID-tfstate"
bucket = "aksgkelearning-tfstate"
prefix = "env/prod"
}
}
2 changes: 1 addition & 1 deletion environments/prod/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1 +1 @@
project="PROJECT_ID"
project="aksgkelearning"
2 changes: 1 addition & 1 deletion modules/firewall/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ resource "google_compute_firewall" "allow-http" {
ports = ["80"]
}

target_tags = ["http-server2"]
target_tags = ["http-server"]
source_ranges = ["0.0.0.0/0"]
}
44 changes: 44 additions & 0 deletions modules/gke/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2019 Google LLC
#
# 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
#
# https://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.


locals {
network = "${element(split("-", var.subnet), 0)}"
subnetwork= "${var.subnet[0]}"
}

resource "google_container_cluster" "learning" {
name = "ken-gke-cluster"
location = "us-west1"
network = "${local.network}"
subnetwork="${local.subnetwork}"
remove_default_node_pool = true
initial_node_count = 1
}

# resource "google_container_node_pool" "learning_preemptible_nodes" {
# name = "ken-node-pool"
# location = "us-west1"
# cluster = google_container_cluster.learning.name
# node_count = 1

# node_config {
# preemptible = true
# machine_type = "e2-micro"
# service_account = "id-420039265868-ken@aksgkelearning.iam.gserviceaccount.com"
# oauth_scopes = [
# "https://www.googleapis.com/auth/cloud-platform"
# ]
# }
# }
14 changes: 14 additions & 0 deletions modules/gke/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2019 Google LLC
#
# 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
#
# https://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.

17 changes: 17 additions & 0 deletions modules/gke/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2019 Google LLC
#
# 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
#
# https://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.


variable "project" {}
variable "subnet" {}
18 changes: 18 additions & 0 deletions modules/gke/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2019 Google LLC
#
# 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
#
# https://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.


terraform {
required_version = "~> 1.0.0"
}
5 changes: 5 additions & 0 deletions modules/vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ module "vpc" {
subnet_ip = "10.${var.env == "dev" ? 10 : 20}.10.0/24"
subnet_region = "us-west1"
},
{
subnet_name = "${var.env}-subnet-02"
subnet_ip = "10.${var.env == "dev" ? 10 : 20}.11.0/24"
subnet_region = "us-west1"
},
]

secondary_ranges = {
Expand Down