Azure Classic

v5.19.0 published on Friday, Sep 16, 2022 by Pulumi

GatewayCertificateAuthority

Manages an API Management Gateway Certificate Authority.

Example Usage

using System;
using System.Collections.Generic;
using System.IO;
using Pulumi;
using Azure = Pulumi.Azure;

	private static string ReadFileBase64(string path) {
		return Convert.ToBase64String(Encoding.UTF8.GetBytes(File.ReadAllText(path)))
	}

return await Deployment.RunAsync(() => 
{
    var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
    {
        Location = "West Europe",
    });

    var exampleService = new Azure.ApiManagement.Service("exampleService", new()
    {
        Location = exampleResourceGroup.Location,
        ResourceGroupName = exampleResourceGroup.Name,
        PublisherName = "pub1",
        PublisherEmail = "pub1@email.com",
        SkuName = "Consumption_0",
    });

    var exampleGateway = new Azure.ApiManagement.Gateway("exampleGateway", new()
    {
        ApiManagementId = exampleService.Id,
        Description = "Example API Management gateway",
        LocationData = new Azure.ApiManagement.Inputs.GatewayLocationDataArgs
        {
            Name = "example name",
            City = "example city",
            District = "example district",
            Region = "example region",
        },
    });

    var exampleCertificate = new Azure.ApiManagement.Certificate("exampleCertificate", new()
    {
        ApiManagementName = exampleService.Name,
        ResourceGroupName = exampleResourceGroup.Name,
        Data = ReadFileBase64("example.pfx"),
    });

    var exampleGatewayCertificateAuthority = new Azure.ApiManagement.GatewayCertificateAuthority("exampleGatewayCertificateAuthority", new()
    {
        ApiManagementId = exampleService.Id,
        CertificateName = exampleCertificate.Name,
        GatewayName = exampleGateway.Name,
        IsTrusted = true,
    });

});
package main

import (
	"encoding/base64"
	"io/ioutil"

	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/apimanagement"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func filebase64OrPanic(path string) pulumi.StringPtrInput {
	if fileData, err := ioutil.ReadFile(path); err == nil {
		return pulumi.String(base64.StdEncoding.EncodeToString(fileData[:]))
	} else {
		panic(err.Error())
	}
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleService, err := apimanagement.NewService(ctx, "exampleService", &apimanagement.ServiceArgs{
			Location:          exampleResourceGroup.Location,
			ResourceGroupName: exampleResourceGroup.Name,
			PublisherName:     pulumi.String("pub1"),
			PublisherEmail:    pulumi.String("pub1@email.com"),
			SkuName:           pulumi.String("Consumption_0"),
		})
		if err != nil {
			return err
		}
		exampleGateway, err := apimanagement.NewGateway(ctx, "exampleGateway", &apimanagement.GatewayArgs{
			ApiManagementId: exampleService.ID(),
			Description:     pulumi.String("Example API Management gateway"),
			LocationData: &apimanagement.GatewayLocationDataArgs{
				Name:     pulumi.String("example name"),
				City:     pulumi.String("example city"),
				District: pulumi.String("example district"),
				Region:   pulumi.String("example region"),
			},
		})
		if err != nil {
			return err
		}
		exampleCertificate, err := apimanagement.NewCertificate(ctx, "exampleCertificate", &apimanagement.CertificateArgs{
			ApiManagementName: exampleService.Name,
			ResourceGroupName: exampleResourceGroup.Name,
			Data:              filebase64OrPanic("example.pfx"),
		})
		if err != nil {
			return err
		}
		_, err = apimanagement.NewGatewayCertificateAuthority(ctx, "exampleGatewayCertificateAuthority", &apimanagement.GatewayCertificateAuthorityArgs{
			ApiManagementId: exampleService.ID(),
			CertificateName: exampleCertificate.Name,
			GatewayName:     exampleGateway.Name,
			IsTrusted:       pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.apimanagement.Service;
import com.pulumi.azure.apimanagement.ServiceArgs;
import com.pulumi.azure.apimanagement.Gateway;
import com.pulumi.azure.apimanagement.GatewayArgs;
import com.pulumi.azure.apimanagement.inputs.GatewayLocationDataArgs;
import com.pulumi.azure.apimanagement.Certificate;
import com.pulumi.azure.apimanagement.CertificateArgs;
import com.pulumi.azure.apimanagement.GatewayCertificateAuthority;
import com.pulumi.azure.apimanagement.GatewayCertificateAuthorityArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
            .location("West Europe")
            .build());

        var exampleService = new Service("exampleService", ServiceArgs.builder()        
            .location(exampleResourceGroup.location())
            .resourceGroupName(exampleResourceGroup.name())
            .publisherName("pub1")
            .publisherEmail("pub1@email.com")
            .skuName("Consumption_0")
            .build());

        var exampleGateway = new Gateway("exampleGateway", GatewayArgs.builder()        
            .apiManagementId(exampleService.id())
            .description("Example API Management gateway")
            .locationData(GatewayLocationDataArgs.builder()
                .name("example name")
                .city("example city")
                .district("example district")
                .region("example region")
                .build())
            .build());

        var exampleCertificate = new Certificate("exampleCertificate", CertificateArgs.builder()        
            .apiManagementName(exampleService.name())
            .resourceGroupName(exampleResourceGroup.name())
            .data(Base64.getEncoder().encodeToString(Files.readAllBytes(Paths.get("example.pfx"))))
            .build());

        var exampleGatewayCertificateAuthority = new GatewayCertificateAuthority("exampleGatewayCertificateAuthority", GatewayCertificateAuthorityArgs.builder()        
            .apiManagementId(exampleService.id())
            .certificateName(exampleCertificate.name())
            .gatewayName(exampleGateway.name())
            .isTrusted(true)
            .build());

    }
}
import pulumi
import base64
import pulumi_azure as azure

example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_service = azure.apimanagement.Service("exampleService",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    publisher_name="pub1",
    publisher_email="pub1@email.com",
    sku_name="Consumption_0")
example_gateway = azure.apimanagement.Gateway("exampleGateway",
    api_management_id=example_service.id,
    description="Example API Management gateway",
    location_data=azure.apimanagement.GatewayLocationDataArgs(
        name="example name",
        city="example city",
        district="example district",
        region="example region",
    ))
example_certificate = azure.apimanagement.Certificate("exampleCertificate",
    api_management_name=example_service.name,
    resource_group_name=example_resource_group.name,
    data=(lambda path: base64.b64encode(open(path).read().encode()).decode())("example.pfx"))
example_gateway_certificate_authority = azure.apimanagement.GatewayCertificateAuthority("exampleGatewayCertificateAuthority",
    api_management_id=example_service.id,
    certificate_name=example_certificate.name,
    gateway_name=example_gateway.name,
    is_trusted=True)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * as fs from "fs";

const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleService = new azure.apimanagement.Service("exampleService", {
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    publisherName: "pub1",
    publisherEmail: "pub1@email.com",
    skuName: "Consumption_0",
});
const exampleGateway = new azure.apimanagement.Gateway("exampleGateway", {
    apiManagementId: exampleService.id,
    description: "Example API Management gateway",
    locationData: {
        name: "example name",
        city: "example city",
        district: "example district",
        region: "example region",
    },
});
const exampleCertificate = new azure.apimanagement.Certificate("exampleCertificate", {
    apiManagementName: exampleService.name,
    resourceGroupName: exampleResourceGroup.name,
    data: Buffer.from(fs.readFileSync("example.pfx"), 'binary').toString('base64'),
});
const exampleGatewayCertificateAuthority = new azure.apimanagement.GatewayCertificateAuthority("exampleGatewayCertificateAuthority", {
    apiManagementId: exampleService.id,
    certificateName: exampleCertificate.name,
    gatewayName: exampleGateway.name,
    isTrusted: true,
});

Coming soon!

Create a GatewayCertificateAuthority Resource

new GatewayCertificateAuthority(name: string, args: GatewayCertificateAuthorityArgs, opts?: CustomResourceOptions);
@overload
def GatewayCertificateAuthority(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                api_management_id: Optional[str] = None,
                                certificate_name: Optional[str] = None,
                                gateway_name: Optional[str] = None,
                                is_trusted: Optional[bool] = None)
@overload
def GatewayCertificateAuthority(resource_name: str,
                                args: GatewayCertificateAuthorityArgs,
                                opts: Optional[ResourceOptions] = None)
func NewGatewayCertificateAuthority(ctx *Context, name string, args GatewayCertificateAuthorityArgs, opts ...ResourceOption) (*GatewayCertificateAuthority, error)
public GatewayCertificateAuthority(string name, GatewayCertificateAuthorityArgs args, CustomResourceOptions? opts = null)
public GatewayCertificateAuthority(String name, GatewayCertificateAuthorityArgs args)
public GatewayCertificateAuthority(String name, GatewayCertificateAuthorityArgs args, CustomResourceOptions options)
type: azure:apimanagement:GatewayCertificateAuthority
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args GatewayCertificateAuthorityArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args GatewayCertificateAuthorityArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args GatewayCertificateAuthorityArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args GatewayCertificateAuthorityArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args GatewayCertificateAuthorityArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

GatewayCertificateAuthority Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The GatewayCertificateAuthority resource accepts the following input properties:

ApiManagementId string

The ID of the API Management Service. Changing this forces a new resource to be created.

CertificateName string

The name of the API Management Certificate. Changing this forces a new resource to be created.

GatewayName string

The name of the API Management Gateway. Changing this forces a new resource to be created.

IsTrusted bool

Whether the API Management Gateway Certificate Authority is trusted.

ApiManagementId string

The ID of the API Management Service. Changing this forces a new resource to be created.

CertificateName string

The name of the API Management Certificate. Changing this forces a new resource to be created.

GatewayName string

The name of the API Management Gateway. Changing this forces a new resource to be created.

IsTrusted bool

Whether the API Management Gateway Certificate Authority is trusted.

apiManagementId String

The ID of the API Management Service. Changing this forces a new resource to be created.

certificateName String

The name of the API Management Certificate. Changing this forces a new resource to be created.

gatewayName String

The name of the API Management Gateway. Changing this forces a new resource to be created.

isTrusted Boolean

Whether the API Management Gateway Certificate Authority is trusted.

apiManagementId string

The ID of the API Management Service. Changing this forces a new resource to be created.

certificateName string

The name of the API Management Certificate. Changing this forces a new resource to be created.

gatewayName string

The name of the API Management Gateway. Changing this forces a new resource to be created.

isTrusted boolean

Whether the API Management Gateway Certificate Authority is trusted.

api_management_id str

The ID of the API Management Service. Changing this forces a new resource to be created.

certificate_name str

The name of the API Management Certificate. Changing this forces a new resource to be created.

gateway_name str

The name of the API Management Gateway. Changing this forces a new resource to be created.

is_trusted bool

Whether the API Management Gateway Certificate Authority is trusted.

apiManagementId String

The ID of the API Management Service. Changing this forces a new resource to be created.

certificateName String

The name of the API Management Certificate. Changing this forces a new resource to be created.

gatewayName String

The name of the API Management Gateway. Changing this forces a new resource to be created.

isTrusted Boolean

Whether the API Management Gateway Certificate Authority is trusted.

Outputs

All input properties are implicitly available as output properties. Additionally, the GatewayCertificateAuthority resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up an Existing GatewayCertificateAuthority Resource

Get an existing GatewayCertificateAuthority resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: GatewayCertificateAuthorityState, opts?: CustomResourceOptions): GatewayCertificateAuthority
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        api_management_id: Optional[str] = None,
        certificate_name: Optional[str] = None,
        gateway_name: Optional[str] = None,
        is_trusted: Optional[bool] = None) -> GatewayCertificateAuthority
func GetGatewayCertificateAuthority(ctx *Context, name string, id IDInput, state *GatewayCertificateAuthorityState, opts ...ResourceOption) (*GatewayCertificateAuthority, error)
public static GatewayCertificateAuthority Get(string name, Input<string> id, GatewayCertificateAuthorityState? state, CustomResourceOptions? opts = null)
public static GatewayCertificateAuthority get(String name, Output<String> id, GatewayCertificateAuthorityState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ApiManagementId string

The ID of the API Management Service. Changing this forces a new resource to be created.

CertificateName string

The name of the API Management Certificate. Changing this forces a new resource to be created.

GatewayName string

The name of the API Management Gateway. Changing this forces a new resource to be created.

IsTrusted bool

Whether the API Management Gateway Certificate Authority is trusted.

ApiManagementId string

The ID of the API Management Service. Changing this forces a new resource to be created.

CertificateName string

The name of the API Management Certificate. Changing this forces a new resource to be created.

GatewayName string

The name of the API Management Gateway. Changing this forces a new resource to be created.

IsTrusted bool

Whether the API Management Gateway Certificate Authority is trusted.

apiManagementId String

The ID of the API Management Service. Changing this forces a new resource to be created.

certificateName String

The name of the API Management Certificate. Changing this forces a new resource to be created.

gatewayName String

The name of the API Management Gateway. Changing this forces a new resource to be created.

isTrusted Boolean

Whether the API Management Gateway Certificate Authority is trusted.

apiManagementId string

The ID of the API Management Service. Changing this forces a new resource to be created.

certificateName string

The name of the API Management Certificate. Changing this forces a new resource to be created.

gatewayName string

The name of the API Management Gateway. Changing this forces a new resource to be created.

isTrusted boolean

Whether the API Management Gateway Certificate Authority is trusted.

api_management_id str

The ID of the API Management Service. Changing this forces a new resource to be created.

certificate_name str

The name of the API Management Certificate. Changing this forces a new resource to be created.

gateway_name str

The name of the API Management Gateway. Changing this forces a new resource to be created.

is_trusted bool

Whether the API Management Gateway Certificate Authority is trusted.

apiManagementId String

The ID of the API Management Service. Changing this forces a new resource to be created.

certificateName String

The name of the API Management Certificate. Changing this forces a new resource to be created.

gatewayName String

The name of the API Management Gateway. Changing this forces a new resource to be created.

isTrusted Boolean

Whether the API Management Gateway Certificate Authority is trusted.

Import

API Management Gateway Certificate Authority can be imported using the resource id, e.g.

 $ pulumi import azure:apimanagement/gatewayCertificateAuthority:GatewayCertificateAuthority example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/gateways/gateway1/certificateAuthorities/cert1

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.