com.pulumi.azure.cdn.FrontdoorSecret Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure Show documentation
Show all versions of azure Show documentation
A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.azure.cdn;
import com.pulumi.azure.Utilities;
import com.pulumi.azure.cdn.FrontdoorSecretArgs;
import com.pulumi.azure.cdn.inputs.FrontdoorSecretState;
import com.pulumi.azure.cdn.outputs.FrontdoorSecretSecret;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import javax.annotation.Nullable;
/**
* Manages a Front Door (standard/premium) Secret.
*
* ```New-AzADServicePrincipal -ApplicationId "00000000-0000-0000-0000-000000000000"```
*
* | Object ID | Key Permissions | Secret Permissions | Certificate Permissions |
* |:-----------------------------------------|:---------------:|:--------------------:|:---------------------------------------------:|
* | `Microsoft.Azure.Cdn` Object ID | - | **Get** | - |
* | Your Personal AAD Object ID | - | **Get** and **List** | **Get**, **List**, **Purge** and **Recover** |
* | Terraform Service Principal | - | **Get** | **Get**, **Import**, **Delete** and **Purge** |
*
* ->**NOTE:** You only need to add the `Access Policy` for your personal AAD Object ID if you are planning to view the `secrets` via the Azure Portal.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azure.core.CoreFunctions;
* import com.pulumi.azuread.AzureadFunctions;
* import com.pulumi.azuread.inputs.GetServicePrincipalArgs;
* import com.pulumi.azure.core.ResourceGroup;
* import com.pulumi.azure.core.ResourceGroupArgs;
* import com.pulumi.azure.keyvault.KeyVault;
* import com.pulumi.azure.keyvault.KeyVaultArgs;
* import com.pulumi.azure.keyvault.inputs.KeyVaultNetworkAclsArgs;
* import com.pulumi.azure.keyvault.inputs.KeyVaultAccessPolicyArgs;
* import com.pulumi.azure.keyvault.Certificate;
* import com.pulumi.azure.keyvault.CertificateArgs;
* import com.pulumi.azure.keyvault.inputs.CertificateCertificateArgs;
* import com.pulumi.azure.cdn.FrontdoorProfile;
* import com.pulumi.azure.cdn.FrontdoorProfileArgs;
* import com.pulumi.azure.cdn.FrontdoorSecret;
* import com.pulumi.azure.cdn.FrontdoorSecretArgs;
* import com.pulumi.azure.cdn.inputs.FrontdoorSecretSecretArgs;
* 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) {
* final var current = CoreFunctions.getClientConfig();
*
* final var frontdoor = AzureadFunctions.getServicePrincipal(GetServicePrincipalArgs.builder()
* .displayName("Microsoft.Azure.Cdn")
* .build());
*
* var example = new ResourceGroup("example", ResourceGroupArgs.builder()
* .name("example-cdn-frontdoor")
* .location("West Europe")
* .build());
*
* var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()
* .name("example-keyvault")
* .location(example.location())
* .resourceGroupName(example.name())
* .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
* .skuName("premium")
* .softDeleteRetentionDays(7)
* .networkAcls(KeyVaultNetworkAclsArgs.builder()
* .defaultAction("Deny")
* .bypass("AzureServices")
* .ipRules("10.0.0.0/24")
* .build())
* .accessPolicies(
* KeyVaultAccessPolicyArgs.builder()
* .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
* .objectId(frontdoor.applyValue(getServicePrincipalResult -> getServicePrincipalResult.objectId()))
* .secretPermissions("Get")
* .build(),
* KeyVaultAccessPolicyArgs.builder()
* .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
* .objectId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
* .certificatePermissions(
* "Get",
* "Import",
* "Delete",
* "Purge")
* .secretPermissions("Get")
* .build())
* .build());
*
* var exampleCertificate = new Certificate("exampleCertificate", CertificateArgs.builder()
* .name("example-cert")
* .keyVaultId(exampleKeyVault.id())
* .certificate(CertificateCertificateArgs.builder()
* .contents(StdFunctions.filebase64(Filebase64Args.builder()
* .input("my-certificate.pfx")
* .build()).result())
* .build())
* .build());
*
* var exampleFrontdoorProfile = new FrontdoorProfile("exampleFrontdoorProfile", FrontdoorProfileArgs.builder()
* .name("example-cdn-profile")
* .resourceGroupName(example.name())
* .skuName("Standard_AzureFrontDoor")
* .build());
*
* var exampleFrontdoorSecret = new FrontdoorSecret("exampleFrontdoorSecret", FrontdoorSecretArgs.builder()
* .name("example-customer-managed-secret")
* .cdnFrontdoorProfileId(exampleFrontdoorProfile.id())
* .secret(FrontdoorSecretSecretArgs.builder()
* .customerCertificates(FrontdoorSecretSecretCustomerCertificateArgs.builder()
* .keyVaultCertificateId(exampleCertificate.id())
* .build())
* .build())
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Front Door Secrets can be imported using the `resource id`, e.g.
*
* ```sh
* $ pulumi import azure:cdn/frontdoorSecret:FrontdoorSecret example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Cdn/profiles/profile1/secrets/secrets1
* ```
*
*/
@ResourceType(type="azure:cdn/frontdoorSecret:FrontdoorSecret")
public class FrontdoorSecret extends com.pulumi.resources.CustomResource {
/**
* The Resource ID of the Front Door Profile. Changing this forces a new Front Door Secret to be created.
*
*/
@Export(name="cdnFrontdoorProfileId", refs={String.class}, tree="[0]")
private Output cdnFrontdoorProfileId;
/**
* @return The Resource ID of the Front Door Profile. Changing this forces a new Front Door Secret to be created.
*
*/
public Output cdnFrontdoorProfileId() {
return this.cdnFrontdoorProfileId;
}
/**
* The name of the Front Door Profile containing this Front Door Secret.
*
*/
@Export(name="cdnFrontdoorProfileName", refs={String.class}, tree="[0]")
private Output cdnFrontdoorProfileName;
/**
* @return The name of the Front Door Profile containing this Front Door Secret.
*
*/
public Output cdnFrontdoorProfileName() {
return this.cdnFrontdoorProfileName;
}
/**
* The name which should be used for this Front Door Secret. Possible values must start with a letter or a number, only contain letters, numbers and hyphens and have a length of between 2 and 260 characters. Changing this forces a new Front Door Secret to be created.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name which should be used for this Front Door Secret. Possible values must start with a letter or a number, only contain letters, numbers and hyphens and have a length of between 2 and 260 characters. Changing this forces a new Front Door Secret to be created.
*
*/
public Output name() {
return this.name;
}
/**
* A `secret` block as defined below. Changing this forces a new Front Door Secret to be created.
*
*/
@Export(name="secret", refs={FrontdoorSecretSecret.class}, tree="[0]")
private Output secret;
/**
* @return A `secret` block as defined below. Changing this forces a new Front Door Secret to be created.
*
*/
public Output secret() {
return this.secret;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public FrontdoorSecret(java.lang.String name) {
this(name, FrontdoorSecretArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public FrontdoorSecret(java.lang.String name, FrontdoorSecretArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public FrontdoorSecret(java.lang.String name, FrontdoorSecretArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:cdn/frontdoorSecret:FrontdoorSecret", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private FrontdoorSecret(java.lang.String name, Output id, @Nullable FrontdoorSecretState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:cdn/frontdoorSecret:FrontdoorSecret", name, state, makeResourceOptions(options, id), false);
}
private static FrontdoorSecretArgs makeArgs(FrontdoorSecretArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? FrontdoorSecretArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static FrontdoorSecret get(java.lang.String name, Output id, @Nullable FrontdoorSecretState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new FrontdoorSecret(name, id, state, options);
}
}