pulumi / pulumi-azuredevops

An AzureDevOps Pulumi resource package, providing multi-language access to AzureDevOps
Apache License 2.0
20 stars 3 forks source link

Importing existing Feeds not working #408

Open kerko opened 5 months ago

kerko commented 5 months ago

Describe what happened

I am trying to import an existing Azure DevOps Feed so it is managed by Pulumi.

Seems like the read during the import is not issued with the correct parameters.

I can read the feed just fine with the Get or GetFeed Methods.

Sample program

$ pulumi import azuredevops:index/feed:Feed internal-feed 52b41ced-793e-4779-9048-9c42c4ed6782

Output

Previewing import (dev):
     Type                       Name                         Plan       Info
 +   pulumi:pulumi:Stack        azuredevops-feed-import-dev  create     1 error
 =   └─ azuredevops:index:Feed  internal-feed                import     1 error
Diagnostics:
  azuredevops:index:Feed (internal-feed):
    error: Preview failed: refreshing urn:pulumi:dev::azuredevops-feed-import::azuredevops:index/feed:Feed::internal-feed: 1 error occurred:
        *  reading feed during read: Argument args.FeedId can not be nil or empty

  pulumi:pulumi:Stack (azuredevops-feed-import-dev):
    error: preview failed

Log output

https://gist.github.com/kerko/572035cc37d43b069fbd5031c50bcd2e

Affected Resource(s)

azuredevops.Feed

Output of pulumi about

$ pulumi about
running 'dotnet build -nologo .'
  Determining projects to restore...

  Alle Projekte sind für die Wiederherstellung auf dem neuesten Stand.

  azuredevops-feed-import -> D:\bugs\pulumi\azuredevops-feed-import\bin\Debug\net6.0\azuredevops-feed-import.dll

Der Buildvorgang wurde erfolgreich ausgeführt.

    0 Warnung(en)
    0 Fehler

Verstrichene Zeit 00:00:01.09

'dotnet build -nologo .' completed successfully
CLI          
Version      3.111.1
Go Version   go1.22.1
Go Compiler  gc

Plugins
NAME         VERSION
azuredevops  3.1.1
dotnet       unknown

Host
OS       Microsoft Windows 11 Pro
Version  10.0.22631 Build 22631
Arch     x86_64

This project is written in dotnet: executable='C:\Program Files\dotnet\dotnet.exe' version='8.0.206'

Backend
Name           DESKTOP-JK
URL            file://~
User           AzureAD\JanKerkenhoff
Organizations
Token type     personal

Dependencies:
NAME                VERSION
Pulumi              3.63.1
Pulumi.AzureDevOps  3.1.1

Pulumi locates its logs in C:\Users\JANKER~1\AppData\Local\Temp by default
warning: Failed to get information about the current stack: No current snapshot

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

danielrbradley commented 5 months ago

It appears this is not implemented in the upstream provider. The import section in both their and our docs is missing: https://registry.terraform.io/providers/microsoft/azuredevops/latest/docs/resources/feed

Additionally, the implementation for the create and update operations do not call d.SetId(...): https://github.com/microsoft/terraform-provider-azuredevops/blob/7f801b0cda433ecd68bac6ea9888c4a6f7a7d9a7/azuredevops/internal/service/feed/resource_feed.go#L56-L85

You could try filing an issue in the upstream project to see if this enhancement could be added.