Skip to content

Commit b2ae948

Browse files
authored
Fix AWS not applying tags for ELB for Kubernetes deployments (#11)
Fix AWS subnet creation where a config was being generated, but had only been applied to Azure and GCP deployments. Retrofit correct tags and naming policy to AWS subnet creation. Existing deployments may re-run to gain updated names and tags. Signed-off-by: Daniel Chaffelson <[email protected]>
1 parent 873f107 commit b2ae948

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

roles/infrastructure/tasks/initialize_base.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
cidr: "{{ __public_subnet_item }}"
5151
tags:
5252
"kubernetes.io/role/elb": "1"
53+
"Name": "{{ [infra__namespace, infra__vpc_public_subnets_suffix, __public_subnet_idx|string] | join('-') }}"
5354

5455
- name: Generate Private Subnet Details
5556
ansible.builtin.set_fact:
@@ -63,4 +64,5 @@
6364
name: "{{ [infra__namespace, infra__vpc_private_subnets_suffix, __private_subnet_idx|string] | join('-') }}"
6465
cidr: "{{ __private_subnet_item }}"
6566
tags:
66-
"kubernetes.io/role/internal-elb": "1"
67+
"kubernetes.io/role/internal-elb": "1"
68+
"Name": "{{ [infra__namespace, infra__vpc_private_subnets_suffix, __private_subnet_idx|string] | join('-') }}"

roles/infrastructure/tasks/setup_aws_network.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,16 @@
4444
amazon.aws.ec2_vpc_subnet:
4545
region: "{{ infra__region }}"
4646
vpc_id: "{{ infra__aws_vpc_id }}"
47-
cidr: "{{ __aws_subnet_cidr_item }}"
47+
cidr: "{{ __aws_subnet_create_item.cidr }}"
4848
state: present
49-
tags: "{{ infra__tags | combine({ 'Name': infra__namespace }, recursive=True) }}"
49+
tags: "{{ infra__tags | combine(__aws_subnet_create_item.tags, recursive=True) }}"
5050
map_public: yes
5151
az: "{{ __aws_az_info.availability_zones[__aws_subnet_index % infra__aws_vpc_az_count | int].zone_name }}"
5252
loop_control:
53-
loop_var: __aws_subnet_cidr_item
53+
loop_var: __aws_subnet_create_item
5454
index_var: __aws_subnet_index
55-
loop: "{{ infra__vpc_public_subnet_cidrs | union(infra__vpc_private_subnet_cidrs) }}"
55+
label: __aws_subnet_create_item.name
56+
loop: "{{ infra__vpc_public_subnets_info | union(infra__vpc_private_subnets_info) }}"
5657
register: __aws_subnets
5758

5859
- name: Set fact for AWS Subnet IDs

0 commit comments

Comments
 (0)