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

feat(locks) add locks on all public IPs that should not change #433

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions ci.jenkins.io.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ resource "azurerm_public_ip" "ci_jenkins_io_controller" {
sku = "Standard"
tags = local.default_tags
}
resource "azurerm_management_lock" "ci_jenkins_io_controller_publicip" {
name = "ci-jenkins-io-controller-publicip"
scope = azurerm_public_ip.ci_jenkins_io_controller.id
lock_level = "CanNotDelete"
notes = "Locked because this is a sensitive resource that should not be removed"
}
resource "azurerm_network_interface" "ci_jenkins_io_controller" {
name = "controller.${local.service_fqdn}"
location = azurerm_resource_group.ci_jenkins_io_controller.location
Expand Down
6 changes: 6 additions & 0 deletions privatek8s.tf
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ resource "azurerm_public_ip" "public_privatek8s" {
sku = "Standard" # Needed to fix the error "PublicIPAndLBSkuDoNotMatch"
tags = local.default_tags
}
resource "azurerm_management_lock" "public_privatek8s_publicip" {
name = "public-privatek8s-publicip"
scope = azurerm_public_ip.public_privatek8s.id
lock_level = "CanNotDelete"
notes = "Locked because this is a sensitive resource that should not be removed when privatek8s is removed"
}

resource "azurerm_dns_a_record" "public_privatek8s" {
name = "public.privatek8s"
Expand Down
18 changes: 18 additions & 0 deletions publick8s.tf
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ resource "azurerm_public_ip" "publick8s_ipv4" {
sku = "Standard" # Needed to fix the error "PublicIPAndLBSkuDoNotMatch"
tags = local.default_tags
}
resource "azurerm_management_lock" "publick8s_ipv4" {
name = "public-publick8s-ipv4"
scope = azurerm_public_ip.publick8s_ipv4.id
lock_level = "CanNotDelete"
notes = "Locked because this is a sensitive resource that should not be removed when publick8s cluster is re-created"
}

# The LDAP service deployed on this cluster is using TCP not HTTP/HTTPS, it needs its own load balancer
# Setting it with this determined public IP will ease DNS setup and changes
Expand All @@ -198,6 +204,12 @@ resource "azurerm_public_ip" "ldap_jenkins_io_ipv4" {
sku = "Standard" # Needed to fix the error "PublicIPAndLBSkuDoNotMatch"
tags = local.default_tags
}
resource "azurerm_management_lock" "ldap_jenkins_io_ipv4" {
name = "ldap-jenkins-io-ipv4"
scope = azurerm_public_ip.ldap_jenkins_io_ipv4.id
lock_level = "CanNotDelete"
notes = "Locked because this is a sensitive resource that should not be removed when publick8s cluster is re-created"
}

resource "azurerm_public_ip" "publick8s_ipv6" {
name = "public-publick8s-ipv6"
Expand All @@ -208,6 +220,12 @@ resource "azurerm_public_ip" "publick8s_ipv6" {
sku = "Standard" # Needed to fix the error "PublicIPAndLBSkuDoNotMatch"
tags = local.default_tags
}
resource "azurerm_management_lock" "publick8s_ipv6" {
name = "public-publick8s-ipv6"
scope = azurerm_public_ip.publick8s_ipv6.id
lock_level = "CanNotDelete"
notes = "Locked because this is a sensitive resource that should not be removed when publick8s cluster is re-created"
}

resource "azurerm_dns_a_record" "public_publick8s" {
name = "public.publick8s"
Expand Down
6 changes: 6 additions & 0 deletions puppet.jenkins.io.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ resource "azurerm_public_ip" "puppet_jenkins_io" {
sku = "Standard"
tags = local.default_tags
}
resource "azurerm_management_lock" "puppet_jenkins_io_publicip" {
name = "puppet.jenkins.io-publicip"
scope = azurerm_public_ip.puppet_jenkins_io.id
lock_level = "CanNotDelete"
notes = "Locked because this is a sensitive resource that should not be removed"
}
# Defined in https://github.com/jenkins-infra/azure-net/tree/main/vnets.tf
data "azurerm_subnet" "dmz" {
name = "${data.azurerm_virtual_network.private.name}-dmz"
Expand Down