Skip to content

Commit

Permalink
fix dns records and tf alias
Browse files Browse the repository at this point in the history
  • Loading branch information
oussamaca committed Nov 4, 2022
1 parent 628da09 commit d51ebaf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions vscode-box/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ resource "aws_iam_instance_profile" "ec2" {
}

data "aws_route53_zone" "selected" {
name = "aws.padok.dojo"
name = "cs.padok.school"
}

resource "aws_route53_record" "vm" {
for_each = local.github_usernames

zone_id = data.aws_route53_zone.selected.zone_id
name = "${each.key}.aws.padok.dojo"
name = "${each.key}.cs.padok.school"
type = "A"
ttl = "300"
records = [aws_instance.dojo[each.key].public_ip]
Expand All @@ -145,5 +145,5 @@ resource "aws_route53_record" "vm" {
# Output

output "public_dns" {
value = {for user in local.github_usernames: user => "ssh ${user}@${user}.aws.padok.dojo"}
value = {for user in local.github_usernames: user => "ssh cs@${user}.cs.padok.school"}
}
5 changes: 2 additions & 3 deletions vscode-box/userdata.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ runcmd:
# https://www.terraform.io/downloads
- wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
- echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
- sudo apt update && sudo apt install terraform
- alias tf=terraform
- sudo apt update && sudo apt install terraform zip -y
- echo "alias tf='terraform'" >> /home/cs/.bashrc

# Install AWS CLI
# https://docs.aws.amazon.com/fr_fr/cli/latest/userguide/getting-started-install.html
Expand All @@ -51,6 +51,5 @@ runcmd:
# Clone the exercise repository
- git clone https://github.com/padok-team/dojo-terraform-aws-security.git /home/cs/dojo-terraform-aws-security
- sudo chown -R cs:cs /home/cs/dojo-terraform-aws-security/
- sudo chmod +r /home/cs/dojo-terraform-aws-security/

- curl "https://echo.dixneuf19.me/${github_username}" # telemetry
2 changes: 1 addition & 1 deletion vscode-box/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ locals {
common_tags = {
source = "Dojo VSCode Box"
}
env_name = "Anne-Flore"
env_name = "dojocs"
}

resource "aws_vpc" "vpc" {
Expand Down

0 comments on commit d51ebaf

Please sign in to comment.