Example #1
0
func (e *DNSZone) TerraformLink() *terraform.Literal {
	if e.ID != nil {
		glog.V(4).Infof("reusing existing route53 zone with id %q", *e.ID)
		return terraform.LiteralFromStringValue(*e.ID)
	}

	return terraform.LiteralSelfLink("aws_route53_zone", *e.Name)
}
Example #2
0
func (e *InternetGateway) TerraformLink() *terraform.Literal {
	shared := fi.BoolValue(e.Shared)
	if shared {
		if e.ID == nil {
			glog.Fatalf("ID must be set, if InternetGateway is shared: %s", e)
		}

		glog.V(4).Infof("reusing existing InternetGateway with id %q", *e.ID)
		return terraform.LiteralFromStringValue(*e.ID)
	}

	return terraform.LiteralProperty("aws_internet_gateway", *e.Name, "id")
}
Example #3
0
func (t *terraformInstanceTemplate) AddNetworks(network *Network, subnet *Subnet, networkInterfacs []*compute.NetworkInterface) {
	for _, g := range networkInterfacs {
		tf := &terraformNetworkInterface{}
		if network != nil {
			tf.Network = network.TerraformName()
		}
		if subnet != nil {
			tf.Subnetwork = subnet.TerraformName()
		}
		for _, gac := range g.AccessConfigs {
			tac := &terraformAccessConfig{}
			natIP := gac.NatIP
			if strings.HasPrefix(natIP, "${") {
				tac.NatIP = terraform.LiteralExpression(natIP)
			} else if natIP != "" {
				tac.NatIP = terraform.LiteralFromStringValue(natIP)
			}

			tf.AccessConfig = append(tf.AccessConfig, tac)
		}

		t.NetworkInterfaces = append(t.NetworkInterfaces, tf)
	}
}