Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
terraform_module
/
svc_deploy_tf
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5b731aa3
authored
Oct 24, 2023
by
chenxx
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update
1 parent
0682db05
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
10 deletions
README.md
main.tf
variables.tf
README.md
View file @
5b731aa
...
@@ -19,7 +19,7 @@ No modules.
...
@@ -19,7 +19,7 @@ No modules.
| Name | Type |
| Name | Type |
|------|------|
|------|------|
|
[
kubernetes_deployment.CUS
](
https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/deployment
)
| resource |
|
[
kubernetes_deployment.CUS
](
https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/deployment
)
| resource |
|
[
kubernetes_namespace.
CUS
](
https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace
)
| resource |
|
[
kubernetes_namespace.
new_namespace
](
https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace
)
| resource |
|
[
kubernetes_service.CUS
](
https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/service
)
| resource |
|
[
kubernetes_service.CUS
](
https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/service
)
| resource |
## Inputs
## Inputs
...
@@ -27,7 +27,7 @@ No modules.
...
@@ -27,7 +27,7 @@ No modules.
| Name | Description | Type | Default | Required |
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
|------|-------------|------|---------|:--------:|
|
<a
name=
"input_image"
></a>
[
image
](
#input\_image
)
| Docker image name |
`string`
| n/a | yes |
|
<a
name=
"input_image"
></a>
[
image
](
#input\_image
)
| Docker image name |
`string`
| n/a | yes |
|
<a
name=
"input_label
"
></a>
[
label
](
#input\_label
)
| user label
|
`list(string)`
|
`[]`
| no |
|
<a
name=
"input_label
s"
></a>
[
labels
](
#input\_labels
)
| labels list
|
`list(string)`
|
`[]`
| no |
|
<a
name=
"input_name"
></a>
[
name
](
#input\_name
)
| Name of the deployment resource. Auto-generated if empty. |
`string`
|
`""`
| no |
|
<a
name=
"input_name"
></a>
[
name
](
#input\_name
)
| Name of the deployment resource. Auto-generated if empty. |
`string`
|
`""`
| no |
|
<a
name=
"input_namespace"
></a>
[
namespace
](
#input\_namespace
)
| Namespace to deploy. Auto-generated if empty. |
`string`
|
`"default"`
| no |
|
<a
name=
"input_namespace"
></a>
[
namespace
](
#input\_namespace
)
| Namespace to deploy. Auto-generated if empty. |
`string`
|
`"default"`
| no |
|
<a
name=
"input_ports"
></a>
[
ports
](
#input\_ports
)
| Service ports to expose |
`list(number)`
|
`[]`
| no |
|
<a
name=
"input_ports"
></a>
[
ports
](
#input\_ports
)
| Service ports to expose |
`list(number)`
|
`[]`
| no |
...
...
main.tf
View file @
5b731aa
...
@@ -33,9 +33,7 @@ resource "kubernetes_deployment" "CUS" {
...
@@ -33,9 +33,7 @@ resource "kubernetes_deployment" "CUS" {
spec {
spec {
replicas = 1
replicas = 1
selector {
selector {
match_labels = {
match_labels = {for label in var.labels: label => label}
labels = {for label in var.labels: label => label}
}
}
}
template {
template {
metadata {
metadata {
...
@@ -59,13 +57,10 @@ resource "kubernetes_deployment" "CUS" {
...
@@ -59,13 +57,10 @@ resource "kubernetes_deployment" "CUS" {
resource "kubernetes_service" "CUS" {
resource "kubernetes_service" "CUS" {
metadata {
metadata {
name = "${var.name}-svc"
name = "${var.name}-svc"
#namespace = kubernetes_namespace.test.metadata.0.name
namespace = var.namespace
namespace = var.namespace
}
}
spec {
spec {
selector = {
selector = {for label in var.labels: label => label}
app = var.name
}
type = "NodePort"
type = "NodePort"
dynamic "port" {
dynamic "port" {
...
...
variables.tf
View file @
5b731aa
...
@@ -6,7 +6,7 @@ variable "image" {
...
@@ -6,7 +6,7 @@ variable "image" {
}
}
# @label "Ports"
# @label "Ports
include container_port and service ports
"
# @group "Basic"
# @group "Basic"
variable "ports" {
variable "ports" {
type = list(number)
type = list(number)
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment