19
loading...
This website collects cookies to deliver better user experience
locals {
availability_zones = [
"us-east-1a",
"us-east-1b",
"us-east-1c",
"us-east-1d"
]
cidr_anywhere_block = "0.0.0.0/0"
...
}
local.cidr_anywhere_block
resource "aws_instance" "server" {
...
user_data = file("user-data.sh")
}
variable "subnet" {
description = "subnet ids"
type = object({
private = list(string)
public = list(string)
})
}
subnet = {
...
public = [
"subnet-01b36f97fa8490e43",
"subnet-0a4272a81af160127",
"subnet-03939599dd92f0f07",
"subnet-0b6f2c6a35b31e4d5"
]
}
resource "random_shuffle" "public_subnet" {
input = var.subnet.public
result_count = 1
}
subnet_id = random_shuffle.public_subnet.result[0]
resource "aws_subnet" "public" {
count = length(local.cidr_public_blocks)
cidr_block = local.cidr_public_blocks[count.index]
...
}
ngIf
for Angular. I mainly did this because when testing I didn't want to see empty sections drawn on the screen. Now they will be hidden if the values are not passed into the render_template
function.{% if db_host %}
<div class="section">
<span class="section-title">
Database Host
</span>
<span>{{ db_host }}</span>
</div>
{% endif %}
DEBUG
variable is set appropriately on the server.debug = os.environ.get('DEBUG')
debug = debug.lower() in ['1', 't', 'true', 'y', 'yes'] if debug is not None else False
...
try:
config = ini('postgres')
db_host = config['host']
db_version = select_version()
except Exception as e:
print('index() error:', e)
error = e if debug else "we're currently experiencing technical difficulties"
return render_template(
html,
error=error,
db_host=db_host,
db_version=db_version
)
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />
<title>CloudGuruChallenge_21.06</title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
{% extends 'base.html' %}
{% block content %}
...
<div class="section">
<span class="section-title">
Elapsed Time
</span>
<span>{{ g.request_time() }}</span>
</div>
{% endblock %}
gunicorn -D app:app
static
assets and url_for
as well to solidify that knowledge.<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />