Skip to content

Instantly share code, notes, and snippets.

View timo-boehm's full-sized avatar

Timo Böhm timo-boehm

  • Cologne, Germany
View GitHub Profile
output "user_name" {
value = aws_iam_user.accountant.name
}
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
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"
}
locals {
common_tags = {
Service = "online-shop"
Owner = "janice-from-accounting"
}
}
locals {
ami = "ami-0233214e13e500f77"
instance_type = "t2.micro"
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"
}
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)
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'}
print(scores("Timo", 55)) # {'Timo': 'failed'}
print(scores("Andy", 80)) # {'Timo': 'failed', 'Andy': 'passed'}
def scores(name, score, records = dict()):
records[name] = "passed" if score > 60 else "failed"
return records
@timo-boehm
timo-boehm / subscription.tf
Created May 27, 2020 08:35
Terraform Snippet for Subscription to SNS Topic
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
}