microsoft / terraform-provider-azuredevops

Terraform Azure DevOps provider
https://www.terraform.io/docs/providers/azuredevops/
MIT License
387 stars 281 forks source link

New Resource: Azure Service Connection for Visual Studio Marketplace #478

Open Danielkem opened 3 years ago

Danielkem commented 3 years ago

Community Note

Description

Similar to other service endpoints, it would be helpful to be able to describe a Visual Studio Marketplace service connection. When describing it as a generic service connection it is successfully imported and when running terraform plan it does not complain. However, if you try to apply a change it fails with the following error:

The pipeline is not valid. Job Job1: Step PublishAzureDevOpsExtension input connectedServiceName expects a service connection of type VstsMarketplacePublishing but the provided service connection serviceendpoint is of type generic.

New or Affected Resource(s)

Potential Terraform Configuration

resource "azuredevops_project" "project" {
  name               = "Sample Project"
  visibility         = "private"
  version_control    = "Git"
  work_item_template = "Agile"
}

resource "azuredevops_serviceendpoint_visualstudiomarketplace" "serviceendpoint" {
  project_id            = azuredevops_project.project.id
  marketplace_url       = "https://some-server.example.com"
  personal_access_token = "Personal access token"
  service_endpoint_name = "Sample Generic"
  description           = "Managed by Terraform"
}
lindhe commented 3 years ago

When describing it as a generic service connection it is successfully imported and when running terraform plan it does not complain. However, if you try to apply a change it fails with the following error:

The pipeline is not valid. Job Job1: Step PublishAzureDevOpsExtension input connectedServiceName expects a service connection of type VstsMarketplacePublishing but the provided service connection serviceendpoint is of type generic.

Sounds like a bug to me...

xuzhang3 commented 3 years ago

@lindhe All service connection have fixed type and parameter scheme, the generic service connection won't to able to handle this new service connection.

lindhe commented 3 years ago

I agree that it is unreasonable to have a visualstudiomarketplace type service connection handled by a generic service connection type Terraform object. That's why I consider it a bug that Daniel was able to successfully terraform import the object and run terraform plan without an issue.

xuzhang3 commented 3 years ago

@lindhe Different service connection may have same parameter structure, but the type is different, this may be the reason why you can apply the import and plan command.

lindhe commented 3 years ago

Would it be possible for the provider to catch that earlier, before terraform apply?

xuzhang3 commented 3 years ago

@lindhe I need do some investigation to figured if we can trigger the error earlier, eg tarraform plan.