mirror of
https://github.com/optim-enterprises-bv/terraform-talos.git
synced 2025-11-02 11:18:35 +00:00
Add predefined tags
This commit is contained in:
@@ -13,3 +13,8 @@ output "key_file" {
|
||||
description = "key_file"
|
||||
value = "~/.oci/oci_${var.project}_terraform.pem"
|
||||
}
|
||||
|
||||
output "tags" {
|
||||
description = "tags"
|
||||
value = [for tag, value in var.tags : "${oci_identity_tag_namespace.kubernetes.name}.${tag}"]
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ resource "oci_identity_policy" "terraform" {
|
||||
compartment_id = oci_identity_compartment.project.id
|
||||
|
||||
statements = [
|
||||
"Allow group ${oci_identity_group.terraform.name} to use tag-namespaces in compartment ${oci_identity_compartment.project.name}",
|
||||
"Allow group ${oci_identity_group.terraform.name} to manage virtual-network-family in compartment ${oci_identity_compartment.project.name}",
|
||||
"Allow group ${oci_identity_group.terraform.name} to manage load-balancers in compartment ${oci_identity_compartment.project.name}",
|
||||
"Allow group ${oci_identity_group.terraform.name} to manage dns in compartment ${oci_identity_compartment.project.name}",
|
||||
|
||||
13
oracle/init/tags.tf
Normal file
13
oracle/init/tags.tf
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
resource "oci_identity_tag_namespace" "kubernetes" {
|
||||
compartment_id = oci_identity_compartment.project.id
|
||||
name = "Kubernetes"
|
||||
description = "Default kubernetes infrastructure tags"
|
||||
}
|
||||
|
||||
resource "oci_identity_tag" "tags" {
|
||||
for_each = var.tags
|
||||
name = each.key
|
||||
description = each.value
|
||||
tag_namespace_id = oci_identity_tag_namespace.kubernetes.id
|
||||
}
|
||||
@@ -12,3 +12,13 @@ variable "project" {
|
||||
type = string
|
||||
default = "main"
|
||||
}
|
||||
|
||||
variable "tags" {
|
||||
description = "Defined Tags of resources"
|
||||
type = map(string)
|
||||
default = {
|
||||
"Environment" = "Resource environment"
|
||||
"Role" = "Kubernetes node role"
|
||||
"Type" = "Type of resource"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ terraform {
|
||||
required_providers {
|
||||
oci = {
|
||||
source = "hashicorp/oci"
|
||||
version = "4.56.0"
|
||||
version = "4.57.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user