Skip to content

Instantly share code, notes, and snippets.

@subzero112233
subzero112233 / test.tf
Created December 11, 2017 20:53
terraform
data "external" "generate_priority_80" {
program = [
"python3",
"${path.module}/../helpers/alb_priority/generate_priority.py"]
query {
listener_arn = "${aws_alb_listener.test123-listener-80.arn}"
region = "eu-central-1"
component = "${aws_alb_listener_rule.test_rule_80.arn}"
}
}
import boto3
import logging
import json
import os
import smart_open
import requests
from botocore.exceptions import ClientError, ParamValidationError
import json
import mock
import os
import pytest
import responses
import requests
from moto import mock_dynamodb2
#!/bin/bash
set -e
function cleanup {
echo "Cleaning up..."
rm -rf .pytest_cache __pycache__ *.pyc
}
ENV=$1
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A lambda to upload to S3
Parameters:
Environment:
Type: String
AllowedValues:
- dev
- staging
- prod
import pytest
import boto3
from botocore.exceptions import ClientError, ParamValidationError
from moto import mock_dynamodb2
from dynamodb_get_item import get_from_dynamodb
@mock_dynamodb2
def test_get_from_dynamodb():
import logging
import boto3
from botocore.exceptions import ClientError, ParamValidationError
dynamodb2 = boto3.resource('dynamodb')
def get_from_dynamodb(table, key):
try:
#!/bin/bash
aws dynamodb create-table \
--table-name SanAntonioSpurs \
--attribute-definitions AttributeName=PlayerName,AttributeType=S AttributeName=JerseyNumber,AttributeType=N \
--key-schema AttributeName=PlayerName,KeyType=HASH AttributeName=JerseyNumber,KeyType=RANGE \
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
aws dynamodb put-item --table-name SanAntonioSpurs --item "{\"PlayerName\":{\"S\":\"Manu Ginobili\"},\"JerseyNumber\":{\"N\":\"20\"}, \"Position\":{\"S\":\"Shooting Guard\"}}"
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute"
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface"
package main
import (
"fmt"
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface"
"github.com/stretchr/testify/assert"