Skip to content

Instantly share code, notes, and snippets.

View dinhanhhuy's full-sized avatar

Đinh Anh Huy dinhanhhuy

View GitHub Profile
$ mount --bind /root/sql-dependencies /root/sql-dependencies-v1
# create mount namespace "some-sql"
$ unshare --mount some-sql start
# mount the host folder to "some-sql" namespace
# similar to docker command --volume
$ mount --bind /var/lib/mysql /my/own/datadir
$ terraform plan
...
Cost estimation:
Resources: 1 of 3 estimated
$9.4303999999999992/mo +$0.0
deny_network_acl_rule_0_0_0_0_0 {
denied_actions = ["aws_network_acl_rule.create"]
# This rule is triggered if any AWS network ACL rule allows IP range 0.0.0.0/0
rule = any tfplan.resource_changes as _, rc {
rc.type is "aws_network_acl_rule" and
rc.change.after.addresses is ["0.0.0.0/0"]
}
}
$ terraform plan
...
# aws_instance.web will be updated in-place
~ resource "aws_instance" "web" {
id = "i-07caf923df8e31740"
~ tags = {
~ "Name" = "what-is-this" -> "The first ec2"
}
}
Plan: 0 to add, 1 to change, 0 to destroy.
$ aws ec2 create-tags --resources i-07caf923df8e31740 --tags Key=Name,Value=what-is-this
{
"resources": [
{
"instances": [
{
"attributes": {
"arn": ".../i-07caf923df8e31740",
...
$ curl --request POST api-example.aws.com/ec2/new
{ "ec2_id": "i-07caf923df8e31740", ... }
$ terraform apply
# here some code
resource "aws_instance" "web" {
instance_type = "t3.micro"
...
}