本文整理汇总了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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}