com.pulumi.azure.domainservices.ReplicaSet 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.domainservices;
import com.pulumi.azure.Utilities;
import com.pulumi.azure.domainservices.ReplicaSetArgs;
import com.pulumi.azure.domainservices.inputs.ReplicaSetState;
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 java.util.List;
import javax.annotation.Nullable;
/**
* Manages a Replica Set for an Active Directory Domain Service.
*
* ## 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.ResourceGroup;
* import com.pulumi.azure.core.ResourceGroupArgs;
* import com.pulumi.azure.network.VirtualNetwork;
* import com.pulumi.azure.network.VirtualNetworkArgs;
* import com.pulumi.azure.network.Subnet;
* import com.pulumi.azure.network.SubnetArgs;
* import com.pulumi.azure.network.NetworkSecurityGroup;
* import com.pulumi.azure.network.NetworkSecurityGroupArgs;
* import com.pulumi.azure.network.inputs.NetworkSecurityGroupSecurityRuleArgs;
* import com.pulumi.azure.network.SubnetNetworkSecurityGroupAssociation;
* import com.pulumi.azure.network.SubnetNetworkSecurityGroupAssociationArgs;
* import com.pulumi.azuread.Group;
* import com.pulumi.azuread.GroupArgs;
* import com.pulumi.azuread.User;
* import com.pulumi.azuread.UserArgs;
* import com.pulumi.azuread.GroupMember;
* import com.pulumi.azuread.GroupMemberArgs;
* import com.pulumi.azuread.ServicePrincipal;
* import com.pulumi.azuread.ServicePrincipalArgs;
* import com.pulumi.azure.domainservices.Service;
* import com.pulumi.azure.domainservices.ServiceArgs;
* import com.pulumi.azure.domainservices.inputs.ServiceInitialReplicaSetArgs;
* import com.pulumi.azure.domainservices.inputs.ServiceNotificationsArgs;
* import com.pulumi.azure.domainservices.inputs.ServiceSecurityArgs;
* import com.pulumi.azure.network.VirtualNetworkPeering;
* import com.pulumi.azure.network.VirtualNetworkPeeringArgs;
* import com.pulumi.azure.network.VirtualNetworkDnsServers;
* import com.pulumi.azure.network.VirtualNetworkDnsServersArgs;
* import com.pulumi.azure.domainservices.ReplicaSet;
* import com.pulumi.azure.domainservices.ReplicaSetArgs;
* import com.pulumi.resources.CustomResourceOptions;
* 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 }{{@code
* public static void main(String[] args) }{{@code
* Pulumi.run(App::stack);
* }}{@code
*
* public static void stack(Context ctx) }{{@code
* var primary = new ResourceGroup("primary", ResourceGroupArgs.builder()
* .name("aadds-primary-rg")
* .location("West Europe")
* .build());
*
* var primaryVirtualNetwork = new VirtualNetwork("primaryVirtualNetwork", VirtualNetworkArgs.builder()
* .name("aadds-primary-vnet")
* .location(primary.location())
* .resourceGroupName(primary.name())
* .addressSpaces("10.0.1.0/16")
* .build());
*
* var primarySubnet = new Subnet("primarySubnet", SubnetArgs.builder()
* .name("aadds-primary-subnet")
* .resourceGroupName(primary.name())
* .virtualNetworkName(primaryVirtualNetwork.name())
* .addressPrefixes("10.0.1.0/24")
* .build());
*
* var primaryNetworkSecurityGroup = new NetworkSecurityGroup("primaryNetworkSecurityGroup", NetworkSecurityGroupArgs.builder()
* .name("aadds-primary-nsg")
* .location(primary.location())
* .resourceGroupName(primary.name())
* .securityRules(
* NetworkSecurityGroupSecurityRuleArgs.builder()
* .name("AllowSyncWithAzureAD")
* .priority(101)
* .direction("Inbound")
* .access("Allow")
* .protocol("Tcp")
* .sourcePortRange("*")
* .destinationPortRange("443")
* .sourceAddressPrefix("AzureActiveDirectoryDomainServices")
* .destinationAddressPrefix("*")
* .build(),
* NetworkSecurityGroupSecurityRuleArgs.builder()
* .name("AllowRD")
* .priority(201)
* .direction("Inbound")
* .access("Allow")
* .protocol("Tcp")
* .sourcePortRange("*")
* .destinationPortRange("3389")
* .sourceAddressPrefix("CorpNetSaw")
* .destinationAddressPrefix("*")
* .build(),
* NetworkSecurityGroupSecurityRuleArgs.builder()
* .name("AllowPSRemoting")
* .priority(301)
* .direction("Inbound")
* .access("Allow")
* .protocol("Tcp")
* .sourcePortRange("*")
* .destinationPortRange("5986")
* .sourceAddressPrefix("AzureActiveDirectoryDomainServices")
* .destinationAddressPrefix("*")
* .build(),
* NetworkSecurityGroupSecurityRuleArgs.builder()
* .name("AllowLDAPS")
* .priority(401)
* .direction("Inbound")
* .access("Allow")
* .protocol("Tcp")
* .sourcePortRange("*")
* .destinationPortRange("636")
* .sourceAddressPrefix("*")
* .destinationAddressPrefix("*")
* .build())
* .build());
*
* var primarySubnetNetworkSecurityGroupAssociation = new SubnetNetworkSecurityGroupAssociation("primarySubnetNetworkSecurityGroupAssociation", SubnetNetworkSecurityGroupAssociationArgs.builder()
* .subnetId(primarySubnet.id())
* .networkSecurityGroupId(primaryNetworkSecurityGroup.id())
* .build());
*
* var dcAdmins = new Group("dcAdmins", GroupArgs.builder()
* .displayName("aad-dc-administrators")
* .securityEnabled(true)
* .build());
*
* var admin = new User("admin", UserArgs.builder()
* .userPrincipalName("dc-admin}{@literal @}{@code hashicorp-example.net")
* .displayName("DC Administrator")
* .password("Pa55w0Rd!!1")
* .build());
*
* var adminGroupMember = new GroupMember("adminGroupMember", GroupMemberArgs.builder()
* .groupObjectId(dcAdmins.objectId())
* .memberObjectId(admin.objectId())
* .build());
*
* var example = new ServicePrincipal("example", ServicePrincipalArgs.builder()
* .applicationId("2565bd9d-da50-47d4-8b85-4c97f669dc36")
* .build());
*
* var aadds = new ResourceGroup("aadds", ResourceGroupArgs.builder()
* .name("aadds-rg")
* .location("westeurope")
* .build());
*
* var exampleService = new Service("exampleService", ServiceArgs.builder()
* .name("example-aadds")
* .location(aadds.location())
* .resourceGroupName(aadds.name())
* .domainName("widgetslogin.net")
* .sku("Enterprise")
* .filteredSyncEnabled(false)
* .initialReplicaSet(ServiceInitialReplicaSetArgs.builder()
* .location(primaryVirtualNetwork.location())
* .subnetId(primarySubnet.id())
* .build())
* .notifications(ServiceNotificationsArgs.builder()
* .additionalRecipients(
* "notifyA}{@literal @}{@code example.net",
* "notifyB}{@literal @}{@code example.org")
* .notifyDcAdmins(true)
* .notifyGlobalAdmins(true)
* .build())
* .security(ServiceSecurityArgs.builder()
* .syncKerberosPasswords(true)
* .syncNtlmPasswords(true)
* .syncOnPremPasswords(true)
* .build())
* .tags(Map.of("Environment", "prod"))
* .build(), CustomResourceOptions.builder()
* .dependsOn(
* example,
* primarySubnetNetworkSecurityGroupAssociation)
* .build());
*
* var replica = new ResourceGroup("replica", ResourceGroupArgs.builder()
* .name("aadds-replica-rg")
* .location("North Europe")
* .build());
*
* var replicaVirtualNetwork = new VirtualNetwork("replicaVirtualNetwork", VirtualNetworkArgs.builder()
* .name("aadds-replica-vnet")
* .location(replica.location())
* .resourceGroupName(replica.name())
* .addressSpaces("10.20.0.0/16")
* .build());
*
* var aaddsReplica = new Subnet("aaddsReplica", SubnetArgs.builder()
* .name("aadds-replica-subnet")
* .resourceGroupName(replica.name())
* .virtualNetworkName(replicaVirtualNetwork.name())
* .addressPrefixes("10.20.0.0/24")
* .build());
*
* var aaddsReplicaNetworkSecurityGroup = new NetworkSecurityGroup("aaddsReplicaNetworkSecurityGroup", NetworkSecurityGroupArgs.builder()
* .name("aadds-replica-nsg")
* .location(replica.location())
* .resourceGroupName(replica.name())
* .securityRules(
* NetworkSecurityGroupSecurityRuleArgs.builder()
* .name("AllowSyncWithAzureAD")
* .priority(101)
* .direction("Inbound")
* .access("Allow")
* .protocol("Tcp")
* .sourcePortRange("*")
* .destinationPortRange("443")
* .sourceAddressPrefix("AzureActiveDirectoryDomainServices")
* .destinationAddressPrefix("*")
* .build(),
* NetworkSecurityGroupSecurityRuleArgs.builder()
* .name("AllowRD")
* .priority(201)
* .direction("Inbound")
* .access("Allow")
* .protocol("Tcp")
* .sourcePortRange("*")
* .destinationPortRange("3389")
* .sourceAddressPrefix("CorpNetSaw")
* .destinationAddressPrefix("*")
* .build(),
* NetworkSecurityGroupSecurityRuleArgs.builder()
* .name("AllowPSRemoting")
* .priority(301)
* .direction("Inbound")
* .access("Allow")
* .protocol("Tcp")
* .sourcePortRange("*")
* .destinationPortRange("5986")
* .sourceAddressPrefix("AzureActiveDirectoryDomainServices")
* .destinationAddressPrefix("*")
* .build(),
* NetworkSecurityGroupSecurityRuleArgs.builder()
* .name("AllowLDAPS")
* .priority(401)
* .direction("Inbound")
* .access("Allow")
* .protocol("Tcp")
* .sourcePortRange("*")
* .destinationPortRange("636")
* .sourceAddressPrefix("*")
* .destinationAddressPrefix("*")
* .build())
* .build());
*
* var replicaSubnetNetworkSecurityGroupAssociation = new SubnetNetworkSecurityGroupAssociation("replicaSubnetNetworkSecurityGroupAssociation", SubnetNetworkSecurityGroupAssociationArgs.builder()
* .subnetId(aaddsReplica.id())
* .networkSecurityGroupId(aaddsReplicaNetworkSecurityGroup.id())
* .build());
*
* var primaryReplica = new VirtualNetworkPeering("primaryReplica", VirtualNetworkPeeringArgs.builder()
* .name("aadds-primary-replica")
* .resourceGroupName(primaryVirtualNetwork.resourceGroupName())
* .virtualNetworkName(primaryVirtualNetwork.name())
* .remoteVirtualNetworkId(replicaVirtualNetwork.id())
* .allowForwardedTraffic(true)
* .allowGatewayTransit(false)
* .allowVirtualNetworkAccess(true)
* .useRemoteGateways(false)
* .build());
*
* var replicaPrimary = new VirtualNetworkPeering("replicaPrimary", VirtualNetworkPeeringArgs.builder()
* .name("aadds-replica-primary")
* .resourceGroupName(replicaVirtualNetwork.resourceGroupName())
* .virtualNetworkName(replicaVirtualNetwork.name())
* .remoteVirtualNetworkId(primaryVirtualNetwork.id())
* .allowForwardedTraffic(true)
* .allowGatewayTransit(false)
* .allowVirtualNetworkAccess(true)
* .useRemoteGateways(false)
* .build());
*
* var replicaVirtualNetworkDnsServers = new VirtualNetworkDnsServers("replicaVirtualNetworkDnsServers", VirtualNetworkDnsServersArgs.builder()
* .virtualNetworkId(replicaVirtualNetwork.id())
* .dnsServers(exampleService.initialReplicaSet().applyValue(initialReplicaSet -> initialReplicaSet.domainControllerIpAddresses()))
* .build());
*
* var replicaReplicaSet = new ReplicaSet("replicaReplicaSet", ReplicaSetArgs.builder()
* .domainServiceId(exampleService.id())
* .location(replica.location())
* .subnetId(aaddsReplica.id())
* .build(), CustomResourceOptions.builder()
* .dependsOn(
* replicaSubnetNetworkSecurityGroupAssociation,
* primaryReplica,
* replicaPrimary)
* .build());
*
* }}{@code
* }}{@code
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Domain Service Replica Sets can be imported using the resource ID of the parent Domain Service and the Replica Set ID, e.g.
*
* ```sh
* $ pulumi import azure:domainservices/replicaSet:ReplicaSet example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.AAD/domainServices/instance1/replicaSets/00000000-0000-0000-0000-000000000000
* ```
*
*/
@ResourceType(type="azure:domainservices/replicaSet:ReplicaSet")
public class ReplicaSet extends com.pulumi.resources.CustomResource {
/**
* A list of subnet IP addresses for the domain controllers in this Replica Set, typically two.
*
*/
@Export(name="domainControllerIpAddresses", refs={List.class,String.class}, tree="[0,1]")
private Output> domainControllerIpAddresses;
/**
* @return A list of subnet IP addresses for the domain controllers in this Replica Set, typically two.
*
*/
public Output> domainControllerIpAddresses() {
return this.domainControllerIpAddresses;
}
/**
* The ID of the Domain Service for which to create this Replica Set. Changing this forces a new resource to be created.
*
*/
@Export(name="domainServiceId", refs={String.class}, tree="[0]")
private Output domainServiceId;
/**
* @return The ID of the Domain Service for which to create this Replica Set. Changing this forces a new resource to be created.
*
*/
public Output domainServiceId() {
return this.domainServiceId;
}
/**
* The publicly routable IP address for the domain controllers in this Replica Set.
*
*/
@Export(name="externalAccessIpAddress", refs={String.class}, tree="[0]")
private Output externalAccessIpAddress;
/**
* @return The publicly routable IP address for the domain controllers in this Replica Set.
*
*/
public Output externalAccessIpAddress() {
return this.externalAccessIpAddress;
}
/**
* The Azure location where this Replica Set should exist. Changing this forces a new resource to be created.
*
*/
@Export(name="location", refs={String.class}, tree="[0]")
private Output location;
/**
* @return The Azure location where this Replica Set should exist. Changing this forces a new resource to be created.
*
*/
public Output location() {
return this.location;
}
/**
* The current service status for the replica set.
*
*/
@Export(name="serviceStatus", refs={String.class}, tree="[0]")
private Output serviceStatus;
/**
* @return The current service status for the replica set.
*
*/
public Output serviceStatus() {
return this.serviceStatus;
}
/**
* The ID of the subnet in which to place this Replica Set. Changing this forces a new resource to be created.
*
*/
@Export(name="subnetId", refs={String.class}, tree="[0]")
private Output subnetId;
/**
* @return The ID of the subnet in which to place this Replica Set. Changing this forces a new resource to be created.
*
*/
public Output subnetId() {
return this.subnetId;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public ReplicaSet(java.lang.String name) {
this(name, ReplicaSetArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public ReplicaSet(java.lang.String name, ReplicaSetArgs 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 ReplicaSet(java.lang.String name, ReplicaSetArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:domainservices/replicaSet:ReplicaSet", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private ReplicaSet(java.lang.String name, Output id, @Nullable ReplicaSetState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:domainservices/replicaSet:ReplicaSet", name, state, makeResourceOptions(options, id), false);
}
private static ReplicaSetArgs makeArgs(ReplicaSetArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? ReplicaSetArgs.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 ReplicaSet get(java.lang.String name, Output id, @Nullable ReplicaSetState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new ReplicaSet(name, id, state, options);
}
}