Open deveshmehta opened 6 years ago
@deveshmehta
You should be able to get the autoscaling group name out of the module, but that's mostly going to depend on the module you're using and the outputs configured on it. If you can show me the specific module you're using, maybe even your .tf file, I may be able to help with it.
Regarding SSH to SRV, that's going to depend on whether your SSH client will use DNS SRV records. It's not something which I think is common. Typically you'd use an A or CNAME record for the server you want to SSH to.
Hi Brant,
Thanks for your reply.
I would like to create Route53 A record for the EC2 instance created by the using module terraform-aws-autoscaling.
Please help to get the autoscaling group name or Private IP of EC2 instance.
And Tried below things
autoscaling_group_names = ["${data.aws_autoscaling_groups.groups.names}",]
autoscaling_group_names = ["${module.autoscaling-bastion.groupname}",]
module "autoscaling-bastion" { source = "./Modules/terraform-aws-autoscaling"
name = "devmgmt-bastion"
# Launch configuration
#
# launch_configuration = "my-existing-launch-configuration" # Use the existing launch configuration
# create_lc = false # disables creation of launch configuration
lc_name = "devmgmt-bastion-lc"
image_id = "${data.aws_ami.amazon_linux.id}"
instance_type = "t2.micro"
security_groups = ["${data.aws_security_group.devmgmt-bastion-public-sg.id}"]
#associate_public_ip_address = true
ebs_block_device = [
{
device_name = "/dev/xvdz"
volume_type = "gp2"
volume_size = "50"
delete_on_termination = true
},
]
root_block_device = [
{
volume_size = "50"
volume_type = "gp2"
delete_on_termination = true
},
]
# Auto scaling group
asg_name = "devmgmt-bastion-asg"
vpc_zone_identifier = ["${module.vpc.public_subnets}"]
health_check_type = "EC2"
min_size = 0
max_size = 1
desired_capacity = 1
wait_for_capacity_timeout = 0
tags = [
{
key = "Name"
value = "devmgmt-bastion"
propagate_at_launch = true
},
{
key = "VPC"
value = "DevMgmt"
propagate_at_launch = true
},
]
tags_as_map = {
"scheduler:ebs-snapshot" = "False"
"scheduler:ec2-startstop" = "True"
// extra_tag3 = "extra_value3"
}
}
data "aws_autoscaling_groups" "groups" { filter { name = "key" values = ["devmgmt-bastion"] } }
module "autoscaling_srv" { source = "brantburnett/autoscaling-route53-srv/aws" version = "~> 0.1.0"
function_name = "${var.function_name}" hosted_zone_id = "${var.hosted_zone_id}" service_name = "bastion02" service_protocol = "tcp" service_port = 11210 autoscaling_group_names = [ "${data.aws_autoscaling_groups.groups.names}", ] }
Thanks in advance Devesh
From: Brant Burnett [mailto:notifications@github.com] Sent: 27 April 2018 19:45 To: brantburnett/terraform-aws-autoscaling-route53-srv terraform-aws-autoscaling-route53-srv@noreply.github.com Cc: Mehta, Devesh devesh.mehta@accenture.com; Mention mention@noreply.github.com Subject: [External] Re: [brantburnett/terraform-aws-autoscaling-route53-srv] How to get the auto scaling group names created by Module (#1)
You should be able to get the autoscaling group name out of the module, but that's mostly going to depend on the module you're using and the outputs configured on it. If you can show me the specific module you're using, maybe even your .tf file, I may be able to help with it.
Regarding SSH to SRV, that's going to depend on whether your SSH client will use DNS SRV records. It's not something which I think is common. Typically you'd use an A or CNAME record for the server you want to SSH to.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_brantburnett_terraform-2Daws-2Dautoscaling-2Droute53-2Dsrv_issues_1-23issuecomment-2D385060006&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=egyzlvn8nY2FYJtAHgjorQUSipRDCxGWm49U-nKRmvo&m=aZcTIbmh2Xr-jNk1-NRpOsHx8iMOpD18fYKOEO49ees&s=lLE7Jm3G77svTGeTe200JpbrM0iNVpaDj7WijIAroqQ&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AJXGZSaf639Y5e5aeTwo5qSyCfoW0Qllks5ts2c6gaJpZM4TqmNc&d=DwMFaQ&c=eIGjsITfXP_y-DLLX0uEHXJvU8nOHrUK8IrwNKOtkVU&r=egyzlvn8nY2FYJtAHgjorQUSipRDCxGWm49U-nKRmvo&m=aZcTIbmh2Xr-jNk1-NRpOsHx8iMOpD18fYKOEO49ees&s=-E-kpnz8C8vNCdiCqRgs1mr5O2x6CPme1eVcfbxKB5E&e=.
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
www.accenture.com
Well, the first thing is that this module doesn't create A records, it creates SRV records. So you'll need to find some other module, or make your own module based on this module.
As to getting out the name of the autoscaling group, I'm going to assume that this is the module you're using: https://registry.terraform.io/modules/terraform-aws-modules/autoscaling/aws/2.3.0. Your source is a local path, so I can't be sure. If so, then you would use "${module.autoscaling-bastion.this_autoscaling_group_name}"
. You can see a reference list of the output variables on the Outputs tab of the link above.
The example given in module shows that the main.tf it first create the resource resource "aws_autoscaling_group" "example" and then later use in module section "autoscaling_srv" as
autoscaling_group_names = ["${aws_autoscaling_group.example.name}", ]
In my case I have a module to create that creates the autoscaling group. So could you please suggest how to get the autoscaling group name from module.
I have tried this - autoscaling_group_names = ["${module.autoscaling_bastion.groupname}", ]
But it didn't worked.
Secondly this module creates the SRV (Service Locator) record in route53 which point to the private IP of EC2. I tried to SSH using SRV record but but getting error - Could not resolve the hostname.
Could you please suggest their solution.