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

azurerm_managed_application fails to read state after provisioning #21267

Closed
1 task done
sflandergan opened this issue Apr 3, 2023 · 3 comments · Fixed by #21541
Closed
1 task done

azurerm_managed_application fails to read state after provisioning #21267

sflandergan opened this issue Apr 3, 2023 · 3 comments · Fixed by #21541

Comments

@sflandergan
Copy link

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.7

AzureRM Provider Version

3.5.0

Affected Resource(s)/Data Source(s)

azurerm_managed_application

Terraform Configuration Files

terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
    }
  }
}

variable "ux4iot_application_definition_id" {
  type        = string
  description = "Application Definition ID of ux4iot"
}

variable "resource_group_name" {
  type        = string
  description = "Resource group to install Service Bus ux4iot and the IoT Hub into"
  default     = "my-rg"
}

variable "location" {
  type        = string
  description = "Azure location where to deploy ux4iot and the IoT Hub into"
  default     = "WestEurope"
}

resource "azurerm_iothub" "main" {
  location            = var.location
  name                = "my-iothub"
  resource_group_name = var.resource_group_name
  sku {
    capacity = 1
    name     = "S1"
  }
}

resource "azurerm_iothub_shared_access_policy" "ux4iot" {
  iothub_name         = azurerm_iothub.main.name
  name                = "ux4iot"
  resource_group_name = var.resource_group_name
  registry_read       = true
  service_connect     = true
}

data "azurerm_iothub_shared_access_policy" "iothubowner" {
  iothub_name         = azurerm_iothub.main.name
  name                = "iothubowner"
  resource_group_name = var.resource_group_name
}

resource "azurerm_managed_application" "ux4iot" {
  application_definition_id   = var.ux4iot_application_definition_id
  kind                        = "ServiceCatalog"
  location                    = var.location
  managed_resource_group_name = "ux4iot-resources"
  name                        = "ux4iot"
  resource_group_name         = var.resource_group_name
  parameters                  = {
    iotHubEventHubConnectionString = azurerm_iothub_shared_access_policy.ux4iot.primary_connection_string
    iotHubServiceConnectionString  = "Endpoint=${azurerm_iothub.main.event_hub_events_endpoint};SharedAccessKeyName=iothubowner;SharedAccessKey=${data.azurerm_iothub_shared_access_policy.iothubowner.primary_key};EntityPath=${azurerm_iothub.main.event_hub_events_path}"
    sku = "small"
  }

  tags = var.tags
}

Debug Output/Panic Output

Terraform reports the following error after successful provisioning


╷
│ Error: missing key 'value' in parameters or output map map[]
│ 
│   with module.ux4iot[0].azurerm_managed_application.ux4iot,
│   on modules/ux4iot/main.tf line 35, in resource "azurerm_managed_application" "ux4iot":
│   35: resource "azurerm_managed_application" "ux4iot" {
│ 
╵

The output from the Microsoft.Solutions/applications looks fine:

{
    "id": "/subscriptions/3.../resourceGroups/s.../providers/Microsoft.Solutions/applications/s...",
    "name": "s...",
    "type": "Microsoft.Solutions/applications",
    "kind": "ServiceCatalog",
    "location": "westeurope",
    "plan": {
        "name": "standard",
        "promotionCode": "",
        "product": "ux4iot",
        "publisher": "deviceinsightgmbh-4961725",
        "version": "1.5.0"
    },
    "etag": "\"9000a30e-0000-0d00-0000-642b17bb0000\"",
    "tags": {
        "environment": "int"
    },
    "properties": {
        "managedResourceGroupId": "/subscriptions/3.../resourceGroups/s...",
        "applicationDefinitionId": "/subscriptions/a.../resourceGroups/ux4iot-shared/providers/Microsoft.Solutions/applicationDefinitions/ux4iot",
        "parameters": {
            "serverVersion": {
                "type": "String",
                "value": "3.5.0"
            },
            "traefikVersion": {
                "type": "String",
                "value": "1.0.0"
            },
            "redisVersion": {
                "type": "String",
                "value": "1.2.0"
            },
            "iotHubEventHubConnectionString": {
                "type": "SecureString"
            },
            "iotHubServiceConnectionString": {
                "type": "SecureString"
            },
            "primaryAdminSecret": {
                "type": "SecureString"
            },
            "secondaryAdminSecret": {
                "type": "SecureString"
            },
            "eventHubConsumerGroup": {
                "type": "String",
                "value": "$Default"
            },
            "throttlingInterval": {
                "type": "Int",
                "value": -1
            },
            "skipCustomResource": {
                "type": "Bool",
                "value": false
            },
            "skipKeyVaultContents": {
                "type": "Bool",
                "value": false
            },
            "dnsLabelOverride": {
                "type": "String",
                "value": ""
            },
            "connectionStateCacheTTL": {
                "type": "Int",
                "value": 60
            },
            "customTimestampKey": {
                "type": "String",
                "value": "_ts"
            },
            "customDeviceIdKey": {
                "type": "String",
                "value": "deviceId"
            },
            "connectionStateOnTelemetry": {
                "type": "Bool",
                "value": true
            },
            "logLevel": {
                "type": "String",
                "value": "info"
            },
            "location": {
                "type": "String",
                "value": "westeurope"
            },
            "sku": {
                "type": "String",
                "value": "small"
            }
        },
        "provisioningState": "Succeeded",
        "authorizations": [
            {
                "principalId": "e...",
                "roleDefinitionId": "8..."
            }
        ],
        "managementMode": "Managed",
        "artifacts": [
            {
                "name": "ViewDefinition",
                "type": "Custom",
                "uri": "https://management.azure.com/subscriptions/3.../resourceGroups/s.../providers/Microsoft.Solutions/applications/s.../applicationArtifacts/ViewDefinition?api-version=2017-12-01"
            }
        ],
        "createdBy": {
            "oid": "c...",
            "puid": "1...",
            "applicationId": "0..."
        },
        "updatedBy": {
            "oid": "c...",
            "puid": "1...",
            "applicationId": "0..."
        }
    }
}


### Expected Behaviour

_No response_

### Actual Behaviour

_No response_

### Steps to Reproduce

1. `terraform apply`
2. wait for the module to crash 

### Important Factoids

_No response_

### References

_No response_
@sflandergan sflandergan added the bug label Apr 3, 2023
@github-actions github-actions bot removed the bug label Apr 3, 2023
@myc2h6o
Copy link
Contributor

myc2h6o commented Apr 5, 2023

Hi @sflandergan thanks for raising the issue! The SecureString type seems not having its value returned, it probably needs some special handling for this type in the provider.

@abtris
Copy link

abtris commented Jun 8, 2023

I have the same problem just on newer azure provider 3.59.0

@manicminer manicminer added this to the v3.69.0 milestone Aug 9, 2023
Copy link

github-actions bot commented May 8, 2024

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 May 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants