This file contains 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
output "user_name" { | |
value = aws_iam_user.accountant.name | |
} |
This file contains 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_iam_policy" "read_only_access" { | |
arn = "arn:aws:iam::aws:policy/ReadOnlyAccess" | |
} | |
resource "aws_iam_user" "accountant" { | |
name = "just-looking" | |
} | |
resource "aws_iam_user_policy_attachment" "reading_is_fine" { | |
user = aws_iam_user.accountant |
This file contains 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
variable "vpc_id" { | |
type = string | |
description = "ID of VPC where all resources will be created in" | |
default = "this-would-be-a-real-id" | |
} | |
resource "aws_subnet" "main" { | |
vpc_id = var.vpc_id | |
cidr_block = "10.0.1.0/24" | |
} |
This file contains 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
locals { | |
common_tags = { | |
Service = "online-shop" | |
Owner = "janice-from-accounting" | |
} | |
} | |
locals { | |
ami = "ami-0233214e13e500f77" | |
instance_type = "t2.micro" |
This file contains 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_vpc" "main_vpc" { | |
cidr_block = "10.0.0.0/16" | |
} | |
resource "aws_subnet" "subnet1" { | |
vpc_id = aws_vpc.main_vpc.id | |
cidr_block = "10.0.1.0/24" | |
} |
This file contains 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
def scores(name, score, records = dict()): | |
records = dict() if not records else records | |
records[name] = "passed" if score > 60 else "failed" | |
return records, id(records) | |
print(scores("Timo", 55)) # ({'Timo': 'failed'}, 140216484423152) | |
print(scores("Andy", 80)) # ({'Andy': 'passed'}, 140216484423232) |
This file contains 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
import ctypes | |
def scores(name, score, records = dict()): | |
records[name] = "passed" if score > 60 else "failed" | |
return records, id(records) | |
_, address1 = scores("Timo", 55) | |
_, address2 = scores("Andy", 80) | |
print(address1 == address2) # True | |
print(ctypes.cast(address1, ctypes.py_object).value) # {'Timo': 'failed', 'Andy': 'passed'} |
This file contains 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
print(scores("Timo", 55)) # {'Timo': 'failed'} | |
print(scores("Andy", 80)) # {'Timo': 'failed', 'Andy': 'passed'} |
This file contains 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
def scores(name, score, records = dict()): | |
records[name] = "passed" if score > 60 else "failed" | |
return records |
This file contains 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_sns_topic_subscription" "sns_to_lambda" { | |
topic_arn = aws_sns_topic.lambda_trigger.arn | |
protocol = "lambda" | |
endpoint = aws_lambda_function.triggered_process.arn | |
} |
NewerOlder