https://pulumi.com logo
#general
Title
# general
w

wet-sunset-4939

03/08/2020, 11:37 AM
Hi All, Hope you know this issue. I'm trying to create an API for Azure Api management with import the definition from the swagger json file. However I got error is Parsing error(s): The Swagger version specified is unknown. However, I'm able to import the file to Api management manually.
Copy code
// Create the API definition and map it to the HTTP Function backend
  const api = new azure.apimanagement.Api(name, {
    name,
    resourceGroupName: apimInfo.group,
    apiManagementName: apimInfo.name,
    displayName: displayName || name,
    import: autoImport
      ? {
          contentFormat: 'swagger-json',
          contentValue: fs.readFileSync(`./${env}-api.json`, 'utf8')
        }
      : undefined,
    path: apiSuffix || '',
    protocols: ['https'],
    revision,
    serviceUrl
  });
a

acoustic-florist-12628

03/09/2020, 11:02 PM
The only thing I can think of is that the underlying azure terraform provider does not yet support OpenAPI 3.0, so all of the internal API calls will assume that you are providing an OpenAPI 2.0 (a.k.a. Swagger) spec. Provided that this really is the cause of your problem, the reason it would still work when uploading to Azure directly is that the Azure APIs and SDK are capable of ingesting OpenAPI 3.0 spec files as of early 2019. However, the API spec that Terraform uses to autogenerate code stubs hasn't been published by Microsoft yet (unless very recently). Since Pulumi's providers are derived from these, both platforms are unable to create APIs from OpenAPI 3.0 specs. This issue is being tracked here: https://github.com/terraform-providers/terraform-provider-azurerm/issues/3203 Aside from this, I can't think of anything in the spec that would throw this error while still working on the console side.
👍 1
w

wet-sunset-4939

03/10/2020, 12:46 AM
Thanks @acoustic-florist-12628 for your reply. Hope Terraform will fix the issue soon.
3 Views