diff --git a/docs/discussions/knowledge-base/137.mdx b/docs/discussions/knowledge-base/137.mdx
index b89fc21d0b..31dd726dcc 100644
--- a/docs/discussions/knowledge-base/137.mdx
+++ b/docs/discussions/knowledge-base/137.mdx
@@ -14,7 +14,7 @@ import GitHub from "/src/components/GitHub"
I am trying to create an EC2 instance with an EBS volume attached to the said instance. However, to create the EBS volume and attach it to the instance I need to use some terraform code. e.g. Layout tree is: dev In the ebs.tf file we can have resource \"aws_ebs_volume\" \"this\" { resource \"aws_volume_attachment\" \"this\" { terragrunt.hcl locals { project_vars = read_terragrunt_config(find_in_parent_folders(\"project.hcl\")) } include { terraform { mock_outputs = { inputs = { name = \"ui01-${local.project}-${local.application}-${local.env}\" ami = \"ami-0bd2230cfb28832f7\" # Amazon Linux kernel 5.10 vpc_id = \"vpc-xxxxxxx\" vpc_security_group_ids = [\"${dependency.sg.outputs.security_group_id}\"] } Is it possible to use the output of the instance and pass this parameter/object to the ebs.tf file so that the ebs volume gets attached to the instance on the fly? Another question is, is it possible for the *.tf files to use the variables defined in the .hcl files? e.g. locals { env.hcl is: you can use the variable env as ${local.env} for your inputs OK so I have this almost working fully, well in fact it does work, I can grab the instance id and attach an ebs volume to this instance, but at the same time the ebs directory tries to create a new ec2 instance. This is not what I want as I have a ec2 directory looking after the entire ec2 instance creation. ├── ebs ebs.tf terragrunt.hcl terragrunt.hcl for the ec2 instance Not sure why the ebs/terragrunt.hcl file wants to create a new instance when I can successfully get the instance id returned from the ec2-linux-ui dependency? If I can fix that, we are done. I am trying to create an EC2 instance with an EBS volume attached to the said instance. However, to create the EBS volume and attach it to the instance I need to use some terraform code. e.g. Layout tree is: dev In the ebs.tf file we can have resource \"aws_ebs_volume\" \"this\" { resource \"aws_volume_attachment\" \"this\" { terragrunt.hcl locals { project_vars = read_terragrunt_config(find_in_parent_folders(\"project.hcl\")) } include { terraform { mock_outputs = { inputs = { name = \"ui01-${local.project}-${local.application}-${local.env}\" ami = \"ami-0bd2230cfb28832f7\" # Amazon Linux kernel 5.10 vpc_id = \"vpc-xxxxxxx\" vpc_security_group_ids = [\"${dependency.sg.outputs.security_group_id}\"] } Is it possible to use the output of the instance and pass this parameter/object to the ebs.tf file so that the ebs volume gets attached to the instance on the fly? Another question is, is it possible for the *.tf files to use the variables defined in the .hcl files? e.g. locals { env.hcl is: you can use the variable env as ${local.env} for your inputs OK so I have this almost working fully, well in fact it does work, I can grab the instance id and attach an ebs volume to this instance, but at the same time the ebs directory tries to create a new ec2 instance. This is not what I want as I have a ec2 directory looking after the entire ec2 instance creation. ├── ebs ebs.tf terragrunt.hcl terragrunt.hcl for the ec2 instance Not sure why the ebs/terragrunt.hcl file wants to create a new instance when I can successfully get the instance id returned from the ec2-linux-ui dependency? If I can fix that, we are done.Passing variables between Terragrunt and Terraform
-
\nI have the code to create the EC2 instance using terragrunt, and it works fine.
\n-ec2
\n--terragrunt.hcl
\n--ebs.tf\n
\n
\navailability_zone = \"ap-southeast-2a\"
\nsize = 20
\n}
\ndevice_name = \"/dev/sdh\"
\nvolume_id = aws_ebs_volume.this.id
\ninstance_id = <instance.parameter.from.terragrunt>
\n}\n
\n
\nenvironment_vars = read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))
\nenv = local.environment_vars.locals.environment
\nproject = local.project_vars.locals.project_name
\napplication = local.project_vars.locals.application_name
\npath = find_in_parent_folders()
\n}
\nsource = \"git::git@github.com:terraform-aws-modules/terraform-aws-ec2-instance.git?ref=v3.3.0\"
\n}
\n``
\ndependency \"sg\" {
\nconfig_path = \"../sg-ec2\"
\nsecurity_group_id = \"sg-xxxxxxxxxxxx\"
\n}
\n}
\ndescription = \"UI 01
\ninstance_type = \"c5.large\"
\nkey_name = \"key-test\" # This key is manually created
\nmonitoring = true
\niam_instance_profile = \"AmazonSSMRoleForInstancesQuickSetup\"
\nsubnet_id = \"subnet-xxxxxxxx\"
\nIf you call in terragrunt\n
\n
\nenvironment_vars = read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))
\nenv = local.environment_vars.locals.environment
\n}
\nlocals {
\nenvironment = \"dev\"
\n}
\nCan you call this variable in the .tf file in some way?
\n│ ├── ebs.tf
\n│ └── terragrunt.hcl
\n└── ec2-instance
\n└── terragrunt.hclvariable \"instance_id\" {\n type = string\n}\n\nresource \"aws_ebs_volume\" \"this\" {\n availability_zone = \"ap-southeast-2a\"\n size = 20\n}\n\nresource \"aws_volume_attachment\" \"this\" {\n device_name = \"/dev/sdh\"\n volume_id = aws_ebs_volume.this.id\n instance_id = \"${var.instance_id}\"\n}\nlocals { }\n\ninclude {\n path = find_in_parent_folders()\n}\n\nterraform {\n source = \"git::git@github.com:terraform-aws-modules/terraform-aws-ec2-instance.git?ref=v3.3.0\"\n}\n\ndependency \"ec2-linux-ui\" {\n config_path = \"../ec2-linux-ui\"\n mock_outputs = {\n instance_id = \"12345\"\n }\n}\n\ninputs = {\n instance_id = dependency.ec2-linux-ui.outputs.id\n}\nlocals {\n environment_vars = read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))\n env = local.environment_vars.locals.environment\n project_vars = read_terragrunt_config(find_in_parent_folders(\"project.hcl\"))\n project = local.project_vars.locals.project_name\n application = local.project_vars.locals.application_name\n}\n\ninclude {\n path = find_in_parent_folders()\n}\n\nterraform {\n source = \"git::git@github.com:terraform-aws-modules/terraform-aws-ec2-instance.git?ref=v3.3.0\"\n}\n\n# Need the output of the correct Security Group ID to attach to the RDS instance\ndependency \"sg\" {\n config_path = \"../sg-ec2\"\n\n mock_outputs = {\n security_group_id = \"sg-xxxxxxxxxx\"\n }\n}\n\ninputs = {\n\n # Naming\n name = \"ui01-${local.project}-${local.application}-${local.env}\"\n description = \"UI 01 ${local.project} ${local.application} Instance for ${local.env}\"\n\n # EC2 Config\n ami = \"ami-0bd2230cfb28832f7\" # Amazon Linux kernel 5.10\n instance_type = \"c5.large\"\n key_name = \"xxxxxxx\" \n monitoring = true\n\n\n # Networking\n vpc_id = \"xxxxxxx\" \n subnet_id = \"xxxxxxxx\"\n\n # Security Group\n vpc_security_group_ids = [\"${dependency.sg.outputs.security_group_id}\"]\n\n}\n
\nI have the code to create the EC2 instance using terragrunt, and it works fine.
\n-ec2
\n--terragrunt.hcl
\n--ebs.tf\n
\n
\navailability_zone = \"ap-southeast-2a\"
\nsize = 20
\n}
\ndevice_name = \"/dev/sdh\"
\nvolume_id = aws_ebs_volume.this.id
\ninstance_id = <instance.parameter.from.terragrunt>
\n}\n
\n
\nenvironment_vars = read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))
\nenv = local.environment_vars.locals.environment
\nproject = local.project_vars.locals.project_name
\napplication = local.project_vars.locals.application_name
\npath = find_in_parent_folders()
\n}
\nsource = \"git::git@github.com:terraform-aws-modules/terraform-aws-ec2-instance.git?ref=v3.3.0\"
\n}
\n``
\ndependency \"sg\" {
\nconfig_path = \"../sg-ec2\"
\nsecurity_group_id = \"sg-xxxxxxxxxxxx\"
\n}
\n}
\ndescription = \"UI 01
\ninstance_type = \"c5.large\"
\nkey_name = \"key-test\" # This key is manually created
\nmonitoring = true
\niam_instance_profile = \"AmazonSSMRoleForInstancesQuickSetup\"
\nsubnet_id = \"subnet-xxxxxxxx\"
\nIf you call in terragrunt\n
\n
\nenvironment_vars = read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))
\nenv = local.environment_vars.locals.environment
\n}
\nlocals {
\nenvironment = \"dev\"
\n}
\nCan you call this variable in the .tf file in some way?
\n│ ├── ebs.tf
\n│ └── terragrunt.hcl
\n└── ec2-instance
\n└── terragrunt.hclvariable \"instance_id\" {\n type = string\n}\n\nresource \"aws_ebs_volume\" \"this\" {\n availability_zone = \"ap-southeast-2a\"\n size = 20\n}\n\nresource \"aws_volume_attachment\" \"this\" {\n device_name = \"/dev/sdh\"\n volume_id = aws_ebs_volume.this.id\n instance_id = \"${var.instance_id}\"\n}\nlocals { }\n\ninclude {\n path = find_in_parent_folders()\n}\n\nterraform {\n source = \"git::git@github.com:terraform-aws-modules/terraform-aws-ec2-instance.git?ref=v3.3.0\"\n}\n\ndependency \"ec2-linux-ui\" {\n config_path = \"../ec2-linux-ui\"\n mock_outputs = {\n instance_id = \"12345\"\n }\n}\n\ninputs = {\n instance_id = dependency.ec2-linux-ui.outputs.id\n}\nlocals {\n environment_vars = read_terragrunt_config(find_in_parent_folders(\"env.hcl\"))\n env = local.environment_vars.locals.environment\n project_vars = read_terragrunt_config(find_in_parent_folders(\"project.hcl\"))\n project = local.project_vars.locals.project_name\n application = local.project_vars.locals.application_name\n}\n\ninclude {\n path = find_in_parent_folders()\n}\n\nterraform {\n source = \"git::git@github.com:terraform-aws-modules/terraform-aws-ec2-instance.git?ref=v3.3.0\"\n}\n\n# Need the output of the correct Security Group ID to attach to the RDS instance\ndependency \"sg\" {\n config_path = \"../sg-ec2\"\n\n mock_outputs = {\n security_group_id = \"sg-xxxxxxxxxx\"\n }\n}\n\ninputs = {\n\n # Naming\n name = \"ui01-${local.project}-${local.application}-${local.env}\"\n description = \"UI 01 ${local.project} ${local.application} Instance for ${local.env}\"\n\n # EC2 Config\n ami = \"ami-0bd2230cfb28832f7\" # Amazon Linux kernel 5.10\n instance_type = \"c5.large\"\n key_name = \"xxxxxxx\" \n monitoring = true\n\n\n # Networking\n vpc_id = \"xxxxxxx\" \n subnet_id = \"xxxxxxxx\"\n\n # Security Group\n vpc_security_group_ids = [\"${dependency.sg.outputs.security_group_id}\"]\n\n}\n
r:terraform-aws-ci-pipeline-example
\nThe Gruntworks pipe for the ref arch has plan and deploy steps bundled in the same job. This causes plan to be run when merging against master, even if it was ran moments ago when pushing the changes against the branch. For large plans, this creates a big overhead in terms of time. For example:
\nWhy are we running plan again when merging? We already know the plan, it ran as a result of creating the PR in the first place. Wouldn't it make more sense to have these steps split into separate jobs? For longer plans, the time savings could be huge when merging.
\nOne of our engineers responded internally with the following:
\n\n\nTerraform will run plan under the hood whenever you run apply - unless you give it the path to a saved plan output. It needs to do this in order to have the latest plan before applying. To fully answer this question, we need confirm that this is the same behavior that occurs with the ECS Deploy Runner's (Gruntwork Pipelines') internal usage for deploying new Reference Architectures.
\n
I'll also add that you're encouraged to re-configure the pipelines configurations however you'd like. If you want to pass a plan output between steps to avoid running plan again, you could use something like CircleCI Artifacts or GitHub Actions Artifacts.
\nOnce we've completed the internal research, we'll update this thread again.
"}}} /> + +Hi Team,
\nCurrently we can see 1) Public, 2) Private App and 3) Persistent Subnets Supported Subnetsare been supported and the logic is present in the VPC modules. If we need to add additional subnet apart from these what is the best approach.
\nAs per documentation extend the catalog its mentioned but not sure if this is right approach for this requirement. extend-service
Yes, extending by wrapping would be the correct approach. You might have to customize the cidr blocks, but you can use the outputs from the vpc-app module to create the necessary extra subnets & routes.
"}}} /> + +A customer asked:
\n\n\nHow can I ensure a given GitHub Personal Access Token (PAT) is still valid?
\n
gh command line toolOfficial installation instructions
\nGH_TOKENexport GH_TOKEN=<the-github-pat>
gh auth statusgh auth status
A customer asked:
\n\n\nHow can I determine which scopes are attached to a given GitHub Personal Access Token (PAT)?
\n
You can use the following command to make a call to GitHub's API, supplying the GitHub personal access token (PAT) in question and requesting that curl only return the response headers:
\ncurl -H \"Authorization: Bearer $GH_TOKEN\" https://api.github.com/user -Is | grep x-oauth-scopes
GitHub's API returns the scopes attached to a given token in the x-oauth-scopes response header, like so:
x-oauth-scopes: repo:invite, repo:status
The above response indicates the token set in $GH_TOKEN only had the repo:invite and repo:status permissions attached to it. If, instead ALL repo permissions had been attached, you'd find this header response from GitHub:
x-oauth-scopes: repo - which indicates that ALL permissions under the repo section have been applied to the token.