diff --git a/packer/nginx/aws/nginx.pkr.hcl b/packer/nginx/aws/nginx.pkr.hcl index d07b792..899afc5 100644 --- a/packer/nginx/aws/nginx.pkr.hcl +++ b/packer/nginx/aws/nginx.pkr.hcl @@ -87,6 +87,12 @@ source "amazon-ebs" "disk" { ssh_username = "ubuntu" subnet_id = var.subnet_id associate_public_ip_address = true + tags = { + Base_AMI_ID = "{{ .SourceAMI }}" + Base_AMI_Name = "{{ .SourceAMIName }}" + Base_AMI_Owner = "{{ .SourceAMIOwner }}" + Extra = "{{ .SourceAMITags.TagName }}" + } } build { diff --git a/packer/nms/aws/nms.pkr.hcl b/packer/nms/aws/nms.pkr.hcl index 9f765c9..9ef8475 100644 --- a/packer/nms/aws/nms.pkr.hcl +++ b/packer/nms/aws/nms.pkr.hcl @@ -108,6 +108,12 @@ source "amazon-ebs" "disk" { ssh_username = var.ssh_username subnet_id = var.subnet_id associate_public_ip_address = true + tags = { + Base_AMI_ID = "{{ .SourceAMI }}" + Base_AMI_Name = "{{ .SourceAMIName }}" + Base_AMI_Owner = "{{ .SourceAMIOwner }}" + Extra = "{{ .SourceAMITags.TagName }}" + } } build { diff --git a/terraform/basic-reference/aws/compute.tf b/terraform/basic-reference/aws/compute.tf index 9f24c6a..a3367aa 100644 --- a/terraform/basic-reference/aws/compute.tf +++ b/terraform/basic-reference/aws/compute.tf @@ -44,6 +44,9 @@ module "agent_common" { resource "aws_key_pair" "bastion_key_pair" { key_name = "bastion-key-pair" public_key = file(pathexpand(var.ssh_pub_key)) + tags = { + Owner = data.aws_caller_identity.current.user_id + } } @@ -56,8 +59,9 @@ resource "aws_instance" "nms_example" { user_data = module.nms_common.nms_cloud_init.rendered user_data_replace_on_change = true iam_instance_profile = aws_iam_instance_profile.nms_ssm.name - tags = { - Name = "nms_example" + tags = { + Name = "nms_example" + Owner = data.aws_caller_identity.current.user_id } } @@ -69,8 +73,9 @@ resource "aws_instance" "bastion_example" { subnet_id = local.public_subnet_id associate_public_ip_address = true key_name = aws_key_pair.bastion_key_pair.key_name - tags = { - Name = "bastion_host" + tags = { + Name = "bastion_host" + Owner = data.aws_caller_identity.current.user_id } } @@ -87,6 +92,7 @@ resource "aws_instance" "agent_example" { user_data_replace_on_change = true user_data = module.agent_common.agent_cloud_init.rendered tags = { - Name = "agent_example" + Name = "agent_example" + Owner = data.aws_caller_identity.current.user_id } } diff --git a/terraform/basic-reference/aws/networking.tf b/terraform/basic-reference/aws/networking.tf index e75112e..afa04e5 100644 --- a/terraform/basic-reference/aws/networking.tf +++ b/terraform/basic-reference/aws/networking.tf @@ -89,7 +89,8 @@ module "nms_alb" { tags = { - Environment = "NMS" + Environment = "Control Plane" + Owner = data.aws_caller_identity.current.user_id } } @@ -130,6 +131,7 @@ module "agents_alb" { ] tags = { - Environment = "Agents" + Environment = "Data Plane" + Owner = data.aws_caller_identity.current.user_id } } diff --git a/terraform/basic-reference/aws/providers.tf b/terraform/basic-reference/aws/providers.tf index ad9257d..3756b36 100644 --- a/terraform/basic-reference/aws/providers.tf +++ b/terraform/basic-reference/aws/providers.tf @@ -18,4 +18,11 @@ terraform { provider "aws" { region = var.aws_region + default_tags { + tags = { + Deployment = "NGINX Management Suite Basic Reference Architecture" + } + } } + +data "aws_caller_identity" "current" {} diff --git a/terraform/basic-reference/aws/security.tf b/terraform/basic-reference/aws/security.tf index 4907e6e..0fc65d7 100644 --- a/terraform/basic-reference/aws/security.tf +++ b/terraform/basic-reference/aws/security.tf @@ -33,7 +33,8 @@ resource "aws_security_group" "nms_alb_secgroup" { name = "nms-alb-secgroup" vpc_id = local.vpc_id tags = { - Name = "nms-alb-secgroup" + Name = "nms-alb-secgroup" + Owner = data.aws_caller_identity.current.user_id } ingress { @@ -59,7 +60,8 @@ resource "aws_security_group" "agent_alb_secgroup" { name = "agent-alb-secgroup" vpc_id = local.vpc_id tags = { - Name = "agent-alb-secgroup" + Name = "agent-alb-secgroup" + Owner = data.aws_caller_identity.current.user_id } ingress { @@ -92,7 +94,8 @@ resource "aws_security_group" "nms_secgroup" { name = "nms-secgroup" vpc_id = local.vpc_id tags = { - Name = "nms-secgroup" + Name = "nms-secgroup" + Owner = data.aws_caller_identity.current.user_id } ingress { @@ -125,7 +128,8 @@ resource "aws_security_group" "bastion_secgroup" { name = "bastion-secgroup" vpc_id = local.vpc_id tags = { - Name = "bastion-secgroup" + Name = "bastion-secgroup" + Owner = data.aws_caller_identity.current.user_id } ingress { @@ -151,7 +155,8 @@ resource "aws_security_group" "agent_secgroup" { name = "agent-secgroup" vpc_id = local.vpc_id tags = { - Name = "agent-secgroup" + Name = "agent-secgroup" + Owner = data.aws_caller_identity.current.user_id } ingress { diff --git a/terraform/basic-reference/aws/ssm.tf b/terraform/basic-reference/aws/ssm.tf index 72e28ea..40f4677 100644 --- a/terraform/basic-reference/aws/ssm.tf +++ b/terraform/basic-reference/aws/ssm.tf @@ -7,6 +7,9 @@ resource "aws_iam_role" "nms_ec2_assume_role" { name = "nms_ec2_assume_role" + tags = { + Owner = data.aws_caller_identity.current.user_ids + } assume_role_policy = <