當前位置: 首頁>>代碼示例>>Golang>>正文


Golang terraform.TerraformTarget類代碼示例

本文整理匯總了Golang中k8s/io/kops/upup/pkg/fi/cloudup/terraform.TerraformTarget的典型用法代碼示例。如果您正苦於以下問題:Golang TerraformTarget類的具體用法?Golang TerraformTarget怎麽用?Golang TerraformTarget使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TerraformTarget類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: RenderTerraform

func (_ *FirewallRule) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *FirewallRule) error {
	g, err := e.mapToGCE(t.Project)
	if err != nil {
		return err
	}

	var allowed []*terraformAllow
	if g.Allowed != nil {
		for _, ga := range g.Allowed {
			a := &terraformAllow{
				Protocol: ga.IPProtocol,
				Ports:    ga.Ports,
			}

			allowed = append(allowed, a)
		}
	}
	tf := &terraformFirewall{
		Name:         g.Name,
		SourceRanges: g.SourceRanges,
		TargetTags:   g.TargetTags,
		Allowed:      allowed,
	}

	// TODO: This doesn't seem right, but it looks like a TF problem
	tf.Network = e.Network.TerraformName()

	return t.RenderResource("google_compute_firewall", *e.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:29,代碼來源:firewall_rule.go

示例2: RenderTerraform

func (_ *AutoscalingGroup) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *AutoscalingGroup) error {
	tf := &terraformAutoscalingGroup{
		Name:                    e.Name,
		MinSize:                 e.MinSize,
		MaxSize:                 e.MaxSize,
		LaunchConfigurationName: e.LaunchConfiguration.TerraformLink(),
	}

	for _, s := range e.Subnets {
		tf.VPCZoneIdentifier = append(tf.VPCZoneIdentifier, s.TerraformLink())
	}

	tags := e.buildTags(t.Cloud)
	// Make sure we output in a stable order
	var tagKeys []string
	for k := range tags {
		tagKeys = append(tagKeys, k)
	}
	sort.Strings(tagKeys)
	for _, k := range tagKeys {
		v := tags[k]
		tf.Tags = append(tf.Tags, &terraformASGTag{
			Key:               fi.String(k),
			Value:             fi.String(v),
			PropagateAtLaunch: fi.Bool(true),
		})
	}

	return t.RenderResource("aws_autoscaling_group", *e.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:30,代碼來源:autoscalinggroup.go

示例3: RenderTerraform

func (_ *DNSZone) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *DNSZone) error {
	cloud := t.Cloud.(*awsup.AWSCloud)

	// As a special case, we check for an existing zone
	// It is really painful to have TF create a new one...
	// (you have to reconfigure the DNS NS records)
	glog.Infof("Check for existing route53 zone to re-use with name %q", *e.Name)
	z, err := e.findExisting(cloud)
	if err != nil {
		return err
	}

	if z != nil {
		glog.Infof("Existing zone %q found; will configure TF to reuse", aws.StringValue(z.Name))

		e.ID = z.Id
		return nil
	}

	tf := &terraformRoute53Zone{
		Name: e.Name,
		//Tags:               cloud.BuildTags(e.Name, nil),
	}

	return t.RenderResource("aws_route53_zone", *e.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:26,代碼來源:dnszone.go

示例4: RenderTerraform

func (_ *RouteTableAssociation) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *RouteTableAssociation) error {
	tf := &terraformRouteTableAssociation{
		SubnetID:     e.Subnet.TerraformLink(),
		RouteTableID: e.RouteTable.TerraformLink(),
	}

	return t.RenderResource("aws_route_table_association", *e.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:8,代碼來源:routetableassociation.go

示例5: RenderTerraform

func (_ *VPCDHCPOptionsAssociation) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *VPCDHCPOptionsAssociation) error {
	tf := &terraformVPCDHCPOptionsAssociation{
		VPCID:         e.VPC.TerraformLink(),
		DHCPOptionsID: e.DHCPOptions.TerraformLink(),
	}

	return t.RenderResource("aws_vpc_dhcp_options_association", *e.VPC.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:8,代碼來源:vpc_dhcpoptions_association.go

示例6: RenderTerraform

func (_ *IAMInstanceProfileRole) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *IAMInstanceProfileRole) error {
	tf := &terraformIAMInstanceProfile{
		Name:  e.InstanceProfile.Name,
		Roles: []*terraform.Literal{e.Role.TerraformLink()},
	}

	return t.RenderResource("aws_iam_instance_profile", *e.InstanceProfile.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:8,代碼來源:iaminstanceprofilerole.go

示例7: RenderSubnet

func (_ *Subnet) RenderSubnet(t *terraform.TerraformTarget, a, e, changes *Subnet) error {
	tf := &terraformSubnet{
		Name:    e.Name,
		Network: e.Network.TerraformName(),
		Region:  e.Region,
		CIDR:    e.CIDR,
	}
	return t.RenderResource("google_compute_subnetwork", *e.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:9,代碼來源:subnet.go

示例8: RenderTerraform

func (_ *PersistentDisk) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *PersistentDisk) error {
	tf := &terraformDisk{
		Name:       e.Name,
		VolumeType: e.VolumeType,
		SizeGB:     e.SizeGB,
		Zone:       e.Zone,
	}
	return t.RenderResource("google_compute_disk", *e.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:9,代碼來源:persistentdisk.go

示例9: RenderTerraform

func (_ *Network) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Network) error {
	tf := &terraformNetwork{
		Name: e.Name,
		CIDR: e.CIDR,
		//AutoCreateSubnetworks: false,
	}

	return t.RenderResource("google_compute_network", *e.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:9,代碼來源:network.go

示例10: RenderTerraform

func (_ *RouteTable) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *RouteTable) error {
	cloud := t.Cloud.(*awsup.AWSCloud)

	tf := &terraformRouteTable{
		VPCID: e.VPC.TerraformLink(),
		Tags:  cloud.BuildTags(e.Name),
	}

	return t.RenderResource("aws_route_table", *e.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:10,代碼來源:routetable.go

示例11: RenderTerraform

func (_ *EBSVolume) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *EBSVolume) error {
	tf := &terraformVolume{
		AvailabilityZone: e.AvailabilityZone,
		Size:             e.SizeGB,
		Type:             e.VolumeType,
		Tags:             e.Tags,
	}

	return t.RenderResource("aws_ebs_volume", *e.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:10,代碼來源:ebsvolume.go

示例12: RenderTerraform

func (_ *ManagedInstanceGroup) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *ManagedInstanceGroup) error {
	tf := &terraformInstanceGroupManager{
		Name:             e.Name,
		Zone:             e.Zone,
		BaseInstanceName: e.BaseInstanceName,
		InstanceTemplate: e.InstanceTemplate.TerraformLink(),
		TargetSize:       e.TargetSize,
	}

	return t.RenderResource("google_compute_instance_group_manager", *e.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:11,代碼來源:managedinstancegroup.go

示例13: RenderTerraform

func (_ *SecurityGroup) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *SecurityGroup) error {
	cloud := t.Cloud.(*awsup.AWSCloud)

	tf := &terraformSecurityGroup{
		Name:        e.Name,
		VPCID:       e.VPC.TerraformLink(),
		Description: e.Description,
		Tags:        cloud.BuildTags(e.Name),
	}

	return t.RenderResource("aws_security_group", *e.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:12,代碼來源:securitygroup.go

示例14: RenderTerraform

func (_ *Subnet) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Subnet) error {
	cloud := t.Cloud.(*awsup.AWSCloud)

	tf := &terraformSubnet{
		VPCID:            e.VPC.TerraformLink(),
		CIDR:             e.CIDR,
		AvailabilityZone: e.AvailabilityZone,
		Tags:             cloud.BuildTags(e.Name),
	}

	return t.RenderResource("aws_subnet", *e.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:12,代碼來源:subnet.go

示例15: RenderTerraform

func (_ *SSHKey) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *SSHKey) error {
	publicKey, err := t.AddFile("aws_key_pair", *e.Name, "public_key", e.PublicKey)
	if err != nil {
		return fmt.Errorf("error rendering PublicKey: %v", err)
	}

	tf := &terraformSSHKey{
		Name:      e.Name,
		PublicKey: publicKey,
	}

	return t.RenderResource("aws_key_pair", *e.Name, tf)
}
開發者ID:crohling,項目名稱:kops,代碼行數:13,代碼來源:sshkey.go


注:本文中的k8s/io/kops/upup/pkg/fi/cloudup/terraform.TerraformTarget類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。