Merge pull request #4789 from justinsb/elasticip_in_terraform_and_cloudformation

ElasticIP tags for cloudformation & terraform
This commit is contained in:
k8s-ci-robot 2018-03-25 13:33:00 -07:00 committed by GitHub
commit cb6f9112f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 55 additions and 3 deletions

View File

@ -183,6 +183,12 @@ resource "aws_ebs_volume" "us-test-1a-etcd-main-bastionuserdata-example-com" {
resource "aws_eip" "us-test-1a-bastionuserdata-example-com" {
vpc = true
tags = {
KubernetesCluster = "bastionuserdata.example.com"
Name = "us-test-1a.bastionuserdata.example.com"
"kubernetes.io/cluster/bastionuserdata.example.com" = "owned"
}
}
resource "aws_elb" "api-bastionuserdata-example-com" {

View File

@ -16,6 +16,12 @@ provider "aws" {
resource "aws_eip" "us-test-1a-lifecyclephases-example-com" {
vpc = true
tags = {
KubernetesCluster = "lifecyclephases.example.com"
Name = "us-test-1a.lifecyclephases.example.com"
"kubernetes.io/cluster/lifecyclephases.example.com" = "owned"
}
}
resource "aws_internet_gateway" "lifecyclephases-example-com" {

View File

@ -183,6 +183,12 @@ resource "aws_ebs_volume" "us-test-1a-etcd-main-privatecalico-example-com" {
resource "aws_eip" "us-test-1a-privatecalico-example-com" {
vpc = true
tags = {
KubernetesCluster = "privatecalico.example.com"
Name = "us-test-1a.privatecalico.example.com"
"kubernetes.io/cluster/privatecalico.example.com" = "owned"
}
}
resource "aws_elb" "api-privatecalico-example-com" {

View File

@ -183,6 +183,12 @@ resource "aws_ebs_volume" "us-test-1a-etcd-main-privatecanal-example-com" {
resource "aws_eip" "us-test-1a-privatecanal-example-com" {
vpc = true
tags = {
KubernetesCluster = "privatecanal.example.com"
Name = "us-test-1a.privatecanal.example.com"
"kubernetes.io/cluster/privatecanal.example.com" = "owned"
}
}
resource "aws_elb" "api-privatecanal-example-com" {

View File

@ -183,6 +183,12 @@ resource "aws_ebs_volume" "us-test-1a-etcd-main-privatedns1-example-com" {
resource "aws_eip" "us-test-1a-privatedns1-example-com" {
vpc = true
tags = {
KubernetesCluster = "privatedns1.example.com"
Name = "us-test-1a.privatedns1.example.com"
"kubernetes.io/cluster/privatedns1.example.com" = "owned"
}
}
resource "aws_elb" "api-privatedns1-example-com" {

View File

@ -183,6 +183,12 @@ resource "aws_ebs_volume" "us-test-1a-etcd-main-privatedns2-example-com" {
resource "aws_eip" "us-test-1a-privatedns2-example-com" {
vpc = true
tags = {
KubernetesCluster = "privatedns2.example.com"
Name = "us-test-1a.privatedns2.example.com"
"kubernetes.io/cluster/privatedns2.example.com" = "owned"
}
}
resource "aws_elb" "api-privatedns2-example-com" {

View File

@ -183,6 +183,12 @@ resource "aws_ebs_volume" "us-test-1a-etcd-main-privateflannel-example-com" {
resource "aws_eip" "us-test-1a-privateflannel-example-com" {
vpc = true
tags = {
KubernetesCluster = "privateflannel.example.com"
Name = "us-test-1a.privateflannel.example.com"
"kubernetes.io/cluster/privateflannel.example.com" = "owned"
}
}
resource "aws_elb" "api-privateflannel-example-com" {

View File

@ -183,6 +183,12 @@ resource "aws_ebs_volume" "us-test-1a-etcd-main-privateweave-example-com" {
resource "aws_eip" "us-test-1a-privateweave-example-com" {
vpc = true
tags = {
KubernetesCluster = "privateweave.example.com"
Name = "us-test-1a.privateweave.example.com"
"kubernetes.io/cluster/privateweave.example.com" = "owned"
}
}
resource "aws_elb" "api-privateweave-example-com" {

View File

@ -279,12 +279,14 @@ func (_ *ElasticIP) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *ElasticIP) e
}
type terraformElasticIP struct {
VPC *bool `json:"vpc"`
VPC *bool `json:"vpc"`
Tags map[string]string `json:"tags,omitempty"`
}
func (_ *ElasticIP) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *ElasticIP) error {
tf := &terraformElasticIP{
VPC: aws.Bool(true),
VPC: aws.Bool(true),
Tags: e.Tags,
}
return t.RenderResource("aws_eip", *e.Name, tf)
@ -295,12 +297,14 @@ func (e *ElasticIP) TerraformLink() *terraform.Literal {
}
type cloudformationElasticIP struct {
Domain *string `json:"Domain"`
Domain *string `json:"Domain"`
Tags []cloudformationTag `json:"Tags,omitempty"`
}
func (_ *ElasticIP) RenderCloudformation(t *cloudformation.CloudformationTarget, a, e, changes *ElasticIP) error {
tf := &cloudformationElasticIP{
Domain: aws.String("vpc"),
Tags: buildCloudformationTags(e.Tags),
}
return t.RenderResource("AWS::EC2::EIP", *e.Name, tf)