This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity 0.8.22; | |
| // Requirements: | |
| // | |
| // - We want only the creator to create coins. | |
| // - Anyone can send coins to each other without a need for registering with a username and password. | |
| // All we need is an Ethereum keypair. | |
| // | |
| contract Coin { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| content_path = Rails.root.join('secret_content_file.txt.enc') | |
| encrypted_file = ActiveSupport::EncryptedFile.new( | |
| content_path: content_path, | |
| key_path: Rails.application.config.credentials.key_path, | |
| env_key: "RAILS_MASTER_KEY", | |
| raise_if_missing_key: true | |
| ) | |
| contents = encrypted_file.read |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| content_path = Rails.root.join('secret_content_file.txt') | |
| encrypted_file = ActiveSupport::EncryptedFile.new( | |
| content_path: "#{content_path}.enc", | |
| key_path: Rails.application.config.credentials.key_path, | |
| env_key: "RAILS_MASTER_KEY", | |
| raise_if_missing_key: true | |
| ) | |
| contents = File.read(content_path) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_route_table" "to_nat_gateway" { | |
| vpc_id = aws_vpc.private_and_public_subnets.id | |
| tags = { | |
| "Name" = "access-to-nat-gateway" | |
| } | |
| } | |
| resource "aws_route" "to_nat_gateway" { | |
| route_table_id = aws_route_table.to_nat_gateway.id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_eip" "nat_gateway" { | |
| depends_on = [aws_internet_gateway.private_and_public_subnets] | |
| } | |
| resource "aws_nat_gateway" "private_and_public_subnets" { | |
| connectivity_type = "public" | |
| allocation_id = aws_eip.nat_gateway.id | |
| subnet_id = aws_subnet.subnet_2.id # public subnet | |
| tags = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_key_pair" "internal_to_vpc" { | |
| key_name = "${local.project}-internal" | |
| public_key = file("${path.module}/id_rsa_internal.pub") | |
| tags = { | |
| "Name" = "${local.project}-internal" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_route_table" "to_internet_gateway" { | |
| vpc_id = aws_vpc.private_and_public_subnets.id | |
| tags = { | |
| "Name" = "access-to-internet" | |
| } | |
| } | |
| resource "aws_route" "to_internet_gateway" { | |
| route_table_id = aws_route_table.to_internet_gateway.id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_internet_gateway" "private_and_public_subnets" { | |
| vpc_id = aws_vpc.private_and_public_subnets.id | |
| tags = { | |
| "Name" = "igw" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_security_group" "ssh_access" { | |
| name = "${local.project}-ssh-access" | |
| description = "Allow SSH traffic from anywhere" | |
| vpc_id = aws_vpc.private_and_public_subnets.id | |
| ingress { | |
| description = "allow SSH from anywhere" | |
| from_port = 22 | |
| to_port = 22 | |
| protocol = "tcp" | |
| cidr_blocks = ["0.0.0.0/0"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data "aws_ami" "client" { | |
| most_recent = true | |
| filter { | |
| name = "architecture" | |
| values = ["x86_64"] | |
| } | |
| filter { | |
| name = "block-device-mapping.delete-on-termination" |