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

terraform, azure and utoronto: fixes and aligning files with terraform state #3578

Merged

Conversation

consideRatio
Copy link
Member

@consideRatio consideRatio commented Jan 5, 2024

This PR represents changes to terraform files that I found relevant to do in order to get utoronto's terraform state to be possible to apply with minimal changes.

terraform plan -var-file=projects/utoronto.tfvars
azurerm_resource_group.jupyterhub: Refreshing state... [id=/subscriptions/ead3521a-d994-4a44-a68d-b16e35642d5b/resourceGroups/2i2c-utoronto-cluster]
azurerm_virtual_network.jupyterhub: Refreshing state... [id=/subscriptions/ead3521a-d994-4a44-a68d-b16e35642d5b/resourceGroups/2i2c-utoronto-cluster/providers/Microsoft.Network/virtualNetworks/k8s-network]
azurerm_container_registry.container_registry: Refreshing state... [id=/subscriptions/ead3521a-d994-4a44-a68d-b16e35642d5b/resourceGroups/2i2c-utoronto-cluster/providers/Microsoft.ContainerRegistry/registries/2i2cutorontohubregistry]
azurerm_subnet.node_subnet: Refreshing state... [id=/subscriptions/ead3521a-d994-4a44-a68d-b16e35642d5b/resourceGroups/2i2c-utoronto-cluster/providers/Microsoft.Network/virtualNetworks/k8s-network/subnets/k8s-nodes-subnet]
azurerm_storage_account.homes: Refreshing state... [id=/subscriptions/ead3521a-d994-4a44-a68d-b16e35642d5b/resourceGroups/2i2c-utoronto-cluster/providers/Microsoft.Storage/storageAccounts/2i2cutorontohubstorage]
azurerm_kubernetes_cluster.jupyterhub: Refreshing state... [id=/subscriptions/ead3521a-d994-4a44-a68d-b16e35642d5b/resourceGroups/2i2c-utoronto-cluster/providers/Microsoft.ContainerService/managedClusters/hub-cluster]
azurerm_storage_share.homes: Refreshing state... [id=https://2i2cutorontohubstorage.file.core.windows.net/homes]
azurerm_kubernetes_cluster_node_pool.user_pool["default"]: Refreshing state... [id=/subscriptions/ead3521a-d994-4a44-a68d-b16e35642d5b/resourceGroups/2i2c-utoronto-cluster/providers/Microsoft.ContainerService/managedClusters/hub-cluster/agentPools/nbdefault]
kubernetes_namespace.homes: Refreshing state... [id=azure-file]
kubernetes_secret.homes: Refreshing state... [id=azure-file/access-credentials]

Note: Objects have changed outside of Terraform

Terraform detected the following changes made outside of Terraform since the last "terraform apply" which may have affected this plan:

  # azurerm_kubernetes_cluster.jupyterhub has changed
  ~ resource "azurerm_kubernetes_cluster" "jupyterhub" {
        id                                  = "/subscriptions/ead3521a-d994-4a44-a68d-b16e35642d5b/resourceGroups/2i2c-utoronto-cluster/providers/Microsoft.ContainerService/managedClusters/hub-cluster"
      ~ kube_config_raw                     = (sensitive value)
        name                                = "hub-cluster"
        tags                                = {}
        # (21 unchanged attributes hidden)

        # (8 unchanged blocks hidden)
    }


Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, the following plan may include actions to undo or respond to these changes.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # kubernetes_namespace.homes will be destroyed
  # (because kubernetes_namespace.homes is not in configuration)
  - resource "kubernetes_namespace" "homes" {
      - id = "azure-file" -> null

      - metadata {
          - annotations      = {} -> null
          - generation       = 0 -> null
          - labels           = {} -> null
          - name             = "azure-file" -> null
          - resource_version = "1418" -> null
          - uid              = "09a992bc-9f2b-4bc8-a616-5e56a4ef4128" -> null
        }
    }

  # kubernetes_secret.homes will be destroyed
  # (because kubernetes_secret.homes is not in configuration)
  - resource "kubernetes_secret" "homes" {
      - data      = (sensitive value) -> null
      - id        = "azure-file/access-credentials" -> null
      - immutable = false -> null
      - type      = "Opaque" -> null

      - metadata {
          - annotations      = {} -> null
          - generation       = 0 -> null
          - labels           = {} -> null
          - name             = "access-credentials" -> null
          - namespace        = "azure-file" -> null
          - resource_version = "2276640" -> null
          - uid              = "ffecfd59-beb3-4527-8528-1709b80da7b9" -> null
        }
    }

Plan: 0 to add, 0 to change, 2 to destroy.

Changes to Outputs:
  ~ kubeconfig               = (sensitive value)

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.

📚 Documentation preview 📚: https://2i2c-pilot-hubs--3578.org.readthedocs.build/en/3578/

@consideRatio consideRatio requested a review from a team as a code owner January 5, 2024 17:35
@consideRatio consideRatio changed the title terraform, azure and utoronto: fixes and terraform state sync terraform, azure and utoronto: fixes and aligning files with terraform state Jan 5, 2024
Copy link
Member

@yuvipanda yuvipanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, one question about max number!

min : 1,
max : 100,
min : 0,
max : 86,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason 86 was chosen?

Copy link
Member Author

@consideRatio consideRatio Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated those values to align with the current configuration, but I don't know the history on why they are configured to 0 - 86.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@consideRatio ah, ok. Can you just add a comment about that here? Once that's done, this is good to go. Thanks for cleaning this up!

@@ -23,7 +23,7 @@ resource "azurerm_storage_share" "homes" {
name = "homes"
storage_account_name = azurerm_storage_account.homes.name
quota = var.storage_size
enabled_protocol = var.storage_protocol
enabled_protocol = "NFS"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In particular, this is great! Let's rip out any other Azure File mounting related stuff we may have too (we use NFS for mounting that too now)

min : 1,
max : 100,
min : 0,
max : 86,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@consideRatio ah, ok. Can you just add a comment about that here? Once that's done, this is good to go. Thanks for cleaning this up!

@consideRatio
Copy link
Member Author

Thank you for reviewing and answering questions about this @yuvipanda. This is now applied, and terraform plan now reports No changes. Your infrastructure matches the configuration. :)

@consideRatio consideRatio merged commit 0c3180f into 2i2c-org:master Jan 5, 2024
4 checks passed
@yuvipanda
Copy link
Member

Thanks for going through this in detail and getting all this set up before the upgrade, @consideRatio!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done 🎉
Development

Successfully merging this pull request may close these issues.

2 participants