astonishing-intern-99200
05/04/2021, 3:20 PMpulumi up
fails with the message:
cannot create already existing resource
Note: we start with an empty state, and an empty resources group. The diagnostic settings are created successfully in Azure but are not written to the state. And it fails complaining it already exists. We use the latest release of pulumi (3.1.0) and the azure-native provider (1.3.0). We’ve tried with a storage container as backend, as well as local storage. We also use KeyVault as encryption provider and run everything in Azure Pipelines.
What could be the cause of that? We noticed it specifically in the diagnostic settings, nowhere else….gentle-diamond-70147
05/04/2021, 3:26 PMastonishing-intern-99200
05/04/2021, 3:40 PMSure:
law = azure_native.operationalinsights.Workspace(
resource_name("log-workspace"),
resource_group_name=resource_group.name,
retention_in_days=365,
sku=azure_native.operationalinsights.WorkspaceSkuArgs(
name=azure_native.operationalinsights.WorkspaceSkuNameEnum.PER_GB2018
),
workspace_name=resource_name("log-workspace")
)
kv_diag_settings = azure_native.insights.DiagnosticSetting(
"kvDiagnosticSetting",
resource_uri=kv.id,
log_analytics_destination_type="Dedicated",
logs=[azure_native.insights.LogSettingsArgs(
category="AuditEvent",
enabled=True,
retention_policy=azure_native.insights.RetentionPolicyArgs(
days=365,
enabled=True
),
)],
metrics=[azure_native.insights.MetricSettingsArgs(
category="AllMetrics",
enabled=True,
retention_policy=azure_native.insights.RetentionPolicyArgs(
days=365,
enabled=True
),
)],
name="kvDiagnosticSetting",
workspace_id=law.id
)
adf_diag_settings = azure_native.insights.DiagnosticSetting(
"adfDiagnosticSetting",
resource_uri=adf.id,
log_analytics_destination_type="Dedicated",
logs=[azure_native.insights.LogSettingsArgs(
category="PipelineRuns",
enabled=True,
retention_policy=azure_native.insights.RetentionPolicyArgs(
days=365,
enabled=True
),
),
azure_native.insights.LogSettingsArgs(
category="TriggerRuns",
enabled=True,
retention_policy=azure_native.insights.RetentionPolicyArgs(
days=365,
enabled=True
),
),
azure_native.insights.LogSettingsArgs(
category="ActivityRuns",
enabled=True,
retention_policy=azure_native.insights.RetentionPolicyArgs(
days=365,
enabled=True
),
)],
metrics=[azure_native.insights.MetricSettingsArgs(
category="AllMetrics",
enabled=True,
retention_policy=azure_native.insights.RetentionPolicyArgs(
days=365,
enabled=True
),
)],
name="adfDiagnosticSetting",
workspace_id=law.id
)
adf
, kv
and resource_group
are Pulumi resources, Data Factory, KeyVault and a Resource Group respectively.gentle-diamond-70147
05/04/2021, 3:57 PMDiagnosticSetting
resources that fails or just one of them?astonishing-intern-99200
05/04/2021, 4:01 PMgentle-diamond-70147
05/04/2021, 5:07 PMastonishing-intern-99200
05/04/2021, 5:59 PMgentle-diamond-70147
05/04/2021, 6:14 PMpulumi login --local
?astonishing-intern-99200
05/05/2021, 5:16 AMpulumi destroy
will clean it up properly.brave-planet-10645
05/05/2021, 9:11 AMastonishing-intern-99200
05/05/2021, 10:59 AMpulumi destroy
as well and it appears Pulumi does it correctly and removes everything, including the diagnostic! (another reason to use Pulumi 😉 )
So this is purely an Azure (maybe Portal only, we didn’t check the CLI) thing.brave-planet-10645
05/05/2021, 11:26 AMastonishing-intern-99200
05/05/2021, 11:45 AM