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

Support for subnet delegation Microsoft.LabServices/labplans don't work #18920

Closed
1 task done
bricecamus opened this issue Oct 21, 2022 · 2 comments
Closed
1 task done
Labels

Comments

@bricecamus
Copy link

bricecamus commented Oct 21, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.3.1

AzureRM Provider Version

3.8.0

Affected Resource(s)/Data Source(s)

azurerm_subnet

Terraform Configuration Files

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "=3.8.0"
    }
    azapi = {
      source = "azure/azapi"
    }
  }
}

provider "azurerm" {
  subscription_id = "xxxxxx-xxxxxx-xxxxxx-xxxxxx-xxxxxx"
  features {}
}

resource "azurerm_resource_group" "terraform-labs-rg" {
  name     = "terraform-labs-rg"
  location = "Canada East"
}

resource "azurerm_network_security_group" "terraform-labs-sg" {
  name                = "terraform-labs-sg"
  location            = azurerm_resource_group.terraform-labs-rg.location
  resource_group_name = azurerm_resource_group.terraform-labs-rg.name

  security_rule {
      access                 = "Allow"
      direction              = "Inbound"
      name                   = "AllowSSH"
      priority               = 1000
      protocol               = "*"
      source_address_prefix  = "*"
      source_port_range      = "*"
      destination_port_range = "22-22"
      destination_address_prefix = "*"
  }

  security_rule {
    access                 = "Allow"
    direction              = "Inbound"
    name                   = "AllowRDP"
    priority               = 1001
    protocol               = "*"
    source_address_prefix  = "*"
    source_port_range      = "*"
    destination_port_range = "3389-3389"
    destination_address_prefix = "*"
    }
}

resource "azurerm_virtual_network" "terraform-labs-vn" {
  name                = "terraform-labs-vn"
  location            = azurerm_resource_group.terraform-labs-rg.location
  resource_group_name = azurerm_resource_group.terraform-labs-rg.name
  address_space       = ["10.3.0.0/16"]
}

resource "azurerm_subnet" "terraform-labs-subnet" {
  name                 = "terraform-labs-subnet"
  resource_group_name  = azurerm_resource_group.terraform-labs-rg.name
  virtual_network_name = azurerm_virtual_network.terraform-labs-vn.name
  address_prefixes     = ["10.3.1.0/24"]

    delegation {
      name = "delegation"

      service_delegation {
        name = "Microsoft.LabServices/labplans"
      }
    }
}

resource "azurerm_subnet_network_security_group_association" "terraform-labs-sg-association" {
  subnet_id                 = azurerm_subnet.terraform-labs-subnet.id
  network_security_group_id = azurerm_network_security_group.terraform-labs-sg.id
}

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.LabServices/labPlans@2022-08-01"
  name = "terraform-labs-plan"
  location = "canadaeast"
  parent_id = azurerm_resource_group.terraform-labs-rg.id
  tags = {
    tagName1 = "test-tag-1"
    tagName2 = "test-tag-2"
  }
  body = jsonencode({
    properties = {
      allowedRegions = [
        "canadaeast"
      ]
      defaultAutoShutdownProfile = {
        disconnectDelay = "00:15:00"
        idleDelay = "00:15:00"
        noConnectDelay = "00:15:00"
        shutdownOnDisconnect = "Disabled"
        shutdownOnIdle = "None"
        shutdownWhenNotConnected = "Disabled"
      }
      defaultConnectionProfile = {
        clientRdpAccess = "Public"
        clientSshAccess = "Public"
        webRdpAccess = "Public"
        webSshAccess = "Public"
      }
      defaultNetworkProfile = {
        subnetId = azurerm_subnet.terraform-labs-subnet.id
      }
    }
  })
}

Debug Output/Panic Output

Error: expected delegation.0.service_delegation.0.name to be one of [Microsoft.ApiManagement/service Microsoft.AzureCosmosDB/clusters Microsoft.BareMetal/AzureVMware Microsoft.BareMetal/CrayServers Microsoft.Batch/batchAccounts Microsoft.ContainerInstance/containerGroups Microsoft.ContainerService/managedClusters Microsoft.Databricks/workspaces Microsoft.DBforMySQL/flexibleServers Microsoft.DBforMySQL/serversv2 Microsoft.DBforPostgreSQL/flexibleServers Microsoft.DBforPostgreSQL/serversv2 Microsoft.DBforPostgreSQL/singleServers Microsoft.HardwareSecurityModules/dedicatedHSMs Microsoft.Kusto/clusters Microsoft.Logic/integrationServiceEnvironments Microsoft.MachineLearningServices/workspaces Microsoft.Netapp/volumes Microsoft.Network/managedResolvers Microsoft.PowerPlatform/vnetaccesslinks Microsoft.ServiceFabricMesh/networks Microsoft.Sql/managedInstances Microsoft.Sql/servers Microsoft.StoragePool/diskPools Microsoft.StreamAnalytics/streamingJobs Microsoft.Synapse/workspaces Microsoft.Web/hostingEnvironments Microsoft.Web/serverFarms], got Microsoft.LabServices/labplans 
│
│   with azurerm_subnet.terraform-labs-subnet,
│   on main.tf line 70, in resource "azurerm_subnet" "terraform-labs-subnet":
│   70:         name = "Microsoft.LabServices/labplans"

Expected Behaviour

Successfull delegation of the subnet to the Microsoft.LabServices/labplans service.

Actual Behaviour

Can't terraform plan due to the error.

Steps to Reproduce

  1. az login To connect at Azure account
  2. terraform init
  3. terraform plan

Important Factoids

No response

References

The enhancement have been added following my issue : #18819

@bricecamus bricecamus added the bug label Oct 21, 2022
@github-actions github-actions bot removed the bug label Oct 21, 2022
@bricecamus
Copy link
Author

Error on my side, everything work!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants