def get_hashicorp_provider_address(
    pulumi_class: Any,
    provider_type: str,
    stack: pulumi.StackReference,
    additional_configs: Mapping[str, Any] = {},
) -> Any:
    """
    This supports getting a Provider object with an explicit address set.
    This will take the address from the pulumi config file if it is set or fall back to the address in the stack refererence. This allows using SSM port tunneling when run from a workstation.
    :param pulumi_class: Should be one of pulumi_consul or pulumi_nomad
    :param provider_type: One of "consul", "nomad"
    :param stack: The corresponding stack reference
    :return: pulumi.providerReference. Should be used in opts
    """
    override_address = pulumi.Config(provider_type).get("address")
    address = override_address or stack.require_output("address")
    return pulumi_class.Provider(provider_type, address=address, **additional_configs)
Example #2
0
import json
import pulumi_aws as aws

# https://www.pulumi.com/docs/intro/concepts/organizing-stacks-projects/#inter-stack-dependencies

# read local config settings - network
config = Config()

# reading in vpc StackReference Path from local config
mystackpath = config.require("mystackpath")

# setting the StackReference
mycrosswalkvpc = StackReference(mystackpath)

# Get all network values from previously created vpc #
pulumi_vpc = mycrosswalkvpc.require_output("pulumi_vpc_id")
pulumi_vpc_name = mycrosswalkvpc.require_output("pulumi_vpc_name")
pulumi_vpc_cidr = mycrosswalkvpc.require_output("pulumi_vpc_cidr")
pulumi_vpc_id = mycrosswalkvpc.require_output("pulumi_vpc_id")
pulumi_private_subnets = mycrosswalkvpc.require_output(
    "pulumi_vpc_private_subnet_ids")
pulumi_public_subnets = mycrosswalkvpc.require_output(
    "pulumi_vpc_public_subnet_ids")
pulumi_az_amount = mycrosswalkvpc.require_output("pulumi_vpc_az_zones")
env_stack = get_stack()
env_project = get_project()

# common tags
my_tags = {
    "application": "fargate",
    "crosswalk-vpc": "yes",
Example #3
0
#pulumi imports
import pulumi
from pulumi.output import Output
import pulumi_aws as aws
from pulumi import export, Config, StackReference

# need this so that later files can read the subnets
config = pulumi.Config()

# reading in vpc StackReference Path from local config
mystackpath = config.get("mystackpath")

# setting the StackReference
mycloudformationvpc = StackReference(f"{mystackpath}")
myvpccidrblock = mycloudformationvpc.require_output(
    "pulumi-cloudformation-vpc-cidr")
myvpcid = mycloudformationvpc.require_output("pulumi-cloudformation-vpc-id")
pulumi_cloudformation_vpc_with_arn = mycloudformationvpc.require_output(
    "pulumi-cloudformation-arn")

# Retrieve public subnet cidrs blocks from local config
public_subnet_cidrs = config.require_object("public_subnets")
# Retrieve private subnet cidrs blocks from local config
private_subnet_cidrs = config.require_object("private_subnets")


def get_aws_az():
    zones = aws.get_availability_zones()
    return zones.names[:
                       3]  # Returns availability zones 0, 1, 2.  So total of 3 az's.