cloudacademy / terraform-aws

Terraform 1.x AWS Course
117 stars 285 forks source link

For exercise 1 there is a var.workstation_ip variable that need to be set #5

Closed RaviKumarSingh-Mckinsey closed 2 years ago

RaviKumarSingh-Mckinsey commented 2 years ago

Hi Team,

I wanted to know for exercise 1 there is a var.workstation_ip variable that needs to be set. In the video of cloudacdemy this shown as the command set| grep TF_VAR , How do I set the same , what Ip I need to set , please help me with that

RaviKumarSingh-Mckinsey commented 2 years ago
image
jeremycook123 commented 2 years ago

The Terraform variable workstation_ip represents your external perimeter public IP address and needs to be represented using CIDR notation. This IP address is used later on within the Terraform infrastructure provisioning process to lock down SSH access on the instance(s) (provisioned by Terraform) - this is a security safety measure to prevent anyone else attempting SSH access. The public IP address will be different and unique for each user - the easiest way to get this address is to type "what is my ip address" in a google search on the workstation where SSH connections are going to be attempted from. As an example response, lets say Google responded with 202.10.23.16 - then the value assigned to the Terraform "workstation_ip" variable would be "202.10.23.16/32" (note the /32 is required - indicates that it is a single IP address)

Now - when it comes to setting the Terraform "workstation_ip" variable - this can be accomplished multiple ways, one of which is to prefix the variable name with "TFVAR" and have it then set as an environment variable within your shell, something like:

Linux export TF_VAR_workstation_ip=202.10.23.16/32

Windows set TF_VAR_workstation_ip=202.10.23.16/32

FYI - Terraform environment variables are documented here: https://www.terraform.io/cli/config/environment-variables

jeremycook123 commented 2 years ago

Ravi

Also note that the IP address (192.168.1.79) you are attempting to use is not valid - it's a private address (see RFC1918) and as such is non Internet routable. You need to use your external perimeter public IP address - the public IP address from which your Internet traffic leaves from.

Good luck!! Jeremy

RaviKumarSingh-Mckinsey commented 2 years ago

Thanks, Jeremy for the quick reply !!! Much appreciated. It helped and thanks for making me understand I was using a wrong IP One more follow-up question: I could not complete the exercise because I didn't have the AWS key and secret key for the key_name "cloudacademydemo"

I believed it would be provided somewhere in the exercise, but I didn't find it, AM I missing something here?

Ravi

RaviKumarSingh-Mckinsey commented 2 years ago

So , I was able to create the was user and was able to set the KEY ID and Secret KEY using AWS configure but still I'm facing issue when I run "terraform deploy" when I run with the below error . Where do I need to provide these key in the VSCODE ( in main.tf ) or somewhere else and what would be the "Key_name" that is cloudeacemdeydemo" in the terraform.tfvars

image
RaviKumarSingh-Mckinsey commented 2 years ago

I had changed the "key_name = "cloudacademydemo" value to "terraform_user" as I have crated a user in IAM with the "terraform_user" and have used it's access key and secret _ID , Need to understand what should be changed or where is needed what to make it work ?

RaviKumarSingh-Mckinsey commented 2 years ago

Hey Jermey,

Did you get chance to look into my query ??

Sent from my iPhone

On 06-Jul-2022, at 1:25 PM, Jeremy Cook @.***> wrote:



Ravi

Also note that the IP address (192.168.1.79) you are attempting to use is not valid - it's a private address (see RFC1918) and as such is non Internet routable. You need to use your external perimeter public IP address - the public IP address from which your Internet traffic leaves from.

Good luck!! Jeremy

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/cloudacademy/terraform-aws/issues/5*issuecomment-1175905077__;Iw!!EIXh2HjOrYMV!dOXkmZizl1iue62yBPsl2ASqBPD6CohgtmcwS8vnMfc1ffS3mfds4rxSMupMYUkYjq2GaoCb459NDXjRYlF_B1kQRIAFGrKC-A$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AQNLT6GA3JZD22E7ALHSS5DVSU3XZANCNFSM52YRVTQA__;!!EIXh2HjOrYMV!dOXkmZizl1iue62yBPsl2ASqBPD6CohgtmcwS8vnMfc1ffS3mfds4rxSMupMYUkYjq2GaoCb459NDXjRYlF_B1kQRIAfgUNP1w$. You are receiving this because you authored the thread.Message ID: @.***>

+=============================================================+ This email is confidential and may be privileged. If you have received it in error, please notify us immediately, delete the email, and do not copy it, disclose its contents or use it for any purpose. +=============================================================+

RaviKumarSingh-Mckinsey commented 2 years ago

 Hey Jermey,

Did you get chance to look into my query ??

Sent from my iPhone

On 06-Jul-2022, at 1:25 PM, Jeremy Cook @.***> wrote:



Ravi

Also note that the IP address (192.168.1.79) you are attempting to use is not valid - it's a private address (see RFC1918) and as such is non Internet routable. You need to use your external perimeter public IP address - the public IP address from which your Internet traffic leaves from.

Good luck!! Jeremy

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/cloudacademy/terraform-aws/issues/5*issuecomment-1175905077__;Iw!!EIXh2HjOrYMV!dOXkmZizl1iue62yBPsl2ASqBPD6CohgtmcwS8vnMfc1ffS3mfds4rxSMupMYUkYjq2GaoCb459NDXjRYlF_B1kQRIAFGrKC-A$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AQNLT6GA3JZD22E7ALHSS5DVSU3XZANCNFSM52YRVTQA__;!!EIXh2HjOrYMV!dOXkmZizl1iue62yBPsl2ASqBPD6CohgtmcwS8vnMfc1ffS3mfds4rxSMupMYUkYjq2GaoCb459NDXjRYlF_B1kQRIAfgUNP1w$. You are receiving this because you authored the thread.Message ID: @.***>

+=============================================================+ This email is confidential and may be privileged. If you have received it in error, please notify us immediately, delete the email, and do not copy it, disclose its contents or use it for any purpose. +=============================================================+

jeremycook123 commented 2 years ago

Hi Ravi

Apologies have been travelling.

key_name "cloudacademydemo" - stores the name of your SSH Keypair that you have pre-created within the AWS EC2 Console - this is later used for SSH access onto the bastion instance if needed

Good luck!! J

RaviKumarSingh-Mckinsey commented 2 years ago

Thanks Jeremy for the reply , Much appreciated , Hope you had a good and safe travel .

Ravi

From: Jeremy Cook @.> Sent: Thursday, July 21, 2022 12:27 PM To: cloudacademy/terraform-aws @.> Cc: Ravi Kumar Singh @.>; Author @.> Subject: [EXT]Re: [cloudacademy/terraform-aws] For exercise 1 there is a var.workstation_ip variable that need to be set (Issue #5)

Hi Ravi

Apologies have been travelling.

key_name "cloudacademydemo" - needs to be capture the name of your SSH keypair that you pre-create within the AWS EC2 Console - this is used to allow you to SSH into/onto the bastion instance

Good luck!! J

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/cloudacademy/terraform-aws/issues/5*issuecomment-1191114507__;Iw!!EIXh2HjOrYMV!c6aUF7Bv9amBORfwof5YB1t6v0zwJtQ0uBXSbetpDfSmKK8oTrDe1HaclMSKvYvxi1-DqYYNmxTNWuVpRQ8n2uMaoJrqWRy82w$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AQNLT6DVQYSJSMIKVAYPSQTVVDYERANCNFSM52YRVTQA__;!!EIXh2HjOrYMV!c6aUF7Bv9amBORfwof5YB1t6v0zwJtQ0uBXSbetpDfSmKK8oTrDe1HaclMSKvYvxi1-DqYYNmxTNWuVpRQ8n2uMaoJqnZ26wsQ$. You are receiving this because you authored the thread.Message ID: @.**@.>>

+=============================================================+ This email is confidential and may be privileged. If you have received it in error, please notify us immediately, delete the email, and do not copy it, disclose its contents or use it for any purpose. +=============================================================+