Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
TF - 0.13 upgrade (#5)
Browse files Browse the repository at this point in the history
* TF - 0.13 upgrade

* TF 0.13 upgrade

* TF 0.13 upgrade

* TF 0.13 upgrade

* TF 0.13 upgrade

* TF 0.13 upgrade
  • Loading branch information
Puneeth-n authored Mar 1, 2021
1 parent c0a631c commit fb9db4f
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 92 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM puneethn/terraform-test-workhorse:0.12.25
FROM puneethn/terraform-test-workhorse:0.13.5

WORKDIR /go/src/github.com/comtravo/terraform-aws-firehose
COPY . .
4 changes: 3 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ pipeline {
script {
try {
sh(label: 'Building docker image', script: "make build")
sh(label: 'Testing docker image', script: "make test-docker")
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'automated-infra-testing-account', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) {
sh(label: 'Testing docker image', script: "make test-docker")
}
} finally {
sh(label: 'Cleanup', script: "make clean")
}
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DOCKER_COMPOSE=docker-compose -f ./docker-compose.yml
DOCKER_COMPOSE_DEVELOP=$(DOCKER_COMPOSE) -f ./docker-compose.develop.yml

GENERATE_DOCS_COMMAND:=terraform-docs --sort-inputs-by-required markdown table . > README.md
GENERATE_DOCS_COMMAND:=terraform-docs markdown . > README.md

fmt:
@terraform fmt -recursive
Expand All @@ -16,7 +16,6 @@ build:
@$(DOCKER_COMPOSE) build

test:
@cd tests && go test -v -tags=unit
@cd tests && go test -v -tags=integration

test-docker:
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ MIT Licensed. See [LICENSE](LICENSE) for full details.

| Name | Version |
|------|---------|
| terraform | >= 0.12 |
| terraform | >= 0.13 |
| aws | ~> 3.0 |

## Providers
Expand All @@ -33,15 +33,14 @@ MIT Licensed. See [LICENSE](LICENSE) for full details.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| account\_id | AWS account ID | `string` | n/a | yes |
| name | Name of the firehose | `string` | n/a | yes |
| s3\_configuration | AWS S3 configuration | <pre>object({<br> bucket_arn = string,<br> buffer_interval = number,<br> buffer_size = number,<br> prefix = string<br> })</pre> | n/a | yes |
| destination | Kinesis Firehose Destination | `string` | `"s3"` | no |
| enable | Enable firehose | `bool` | `true` | no |
| name | Name of the firehose | `string` | n/a | yes |
| region | AWS region | `string` | `"eu-west-1"` | no |
| s3\_configuration | AWS S3 configuration | <pre>object({<br> bucket_arn = string,<br> buffer_interval = number,<br> buffer_size = number,<br> prefix = string<br> })</pre> | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| arn | ARN of the Kinesis Firehose |

9 changes: 2 additions & 7 deletions docker-compose.develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,5 @@ services:
command: bash
volumes:
- ./:/go/src/github.com/comtravo/terraform-aws-firehose

localstack:
ports:
- 4566:4566
- 4584-4597:4584-4597
- 4567-4583:4567-4583
- 8080:8080
environment:
- AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN}
21 changes: 2 additions & 19 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,5 @@ services:
environment:
- AWS_REGION=us-east-1
- AWS_DEFAULT_REGION=us-east-1
- AWS_ACCESS_KEY_ID=foo
- AWS_SECRET_ACCESS_KEY=bar
- LOCALSTACK_HOST=localstack
depends_on:
- localstack

localstack:
image: localstack/localstack:0.11.4
environment:
- SERVICES=s3,firehose,iam,sts
- DEFAULT_REGION=us-east-1
- DOCKER_HOST=unix:///var/run/docker.sock
- DATA_DIR=/tmp/localstack/data
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "localstack-data:/tmp/localstack"

volumes:
localstack-data:
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
13 changes: 9 additions & 4 deletions tests/firehose_integration_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@

// +build integration

package test

import (
"fmt"
"regexp"
"testing"

"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/stretchr/testify/assert"
"testing"
)

func TestFirehoseApply(t *testing.T) {
Expand All @@ -19,11 +21,14 @@ func TestFirehoseApply(t *testing.T) {
defer terraform.Destroy(t, terratestOptions)

output := terraform.InitAndApply(t, terratestOptions)
assert.Contains(t, output, "Apply complete! Resources: 4 added, 0 changed, 0 destroyed.")
assert.Contains(t, output, "Apply complete! Resources: 5 added, 0 changed, 0 destroyed.")

firehose_disabled_output := terraform.Output(t, terratestOptions, "firehose_disabled")
assert.Equal(t, firehose_disabled_output, "")

firehose_enabled_output := terraform.Output(t, terratestOptions, "firehose_enabled")
assert.Equal(t, firehose_enabled_output, "arn:aws:firehose:us-east-1:000000000000:deliverystream/firehose_enabled")
assert.Regexp(t,
regexp.MustCompile(fmt.Sprintf("arn:aws:firehose:us-east-1:\\d{12}:deliverystream/firehose_enabled")),
firehose_enabled_output,
)
}
24 changes: 0 additions & 24 deletions tests/firehose_unit_test.go

This file was deleted.

31 changes: 3 additions & 28 deletions tests/test.tf
Original file line number Diff line number Diff line change
@@ -1,39 +1,14 @@
provider "aws" {
s3_force_path_style = true
skip_credentials_validation = true
skip_metadata_api_check = true
skip_requesting_account_id = true
access_key = "This is not an actual access key."
secret_key = "This is not an actual secret key."
}

endpoints {
apigateway = "http://localstack:4567"
cloudformation = "http://localstack:4581"
cloudwatch = "http://localstack:4582"
dynamodb = "http://localstack:4569"
es = "http://localstack:4578"
firehose = "http://localstack:4573"
iam = "http://localstack:4593"
kinesis = "http://localstack:4568"
lambda = "http://localstack:4574"
route53 = "http://localstack:4580"
redshift = "http://localstack:4577"
s3 = "http://localstack:4572"
secretsmanager = "http://localstack:4584"
ses = "http://localstack:4579"
sns = "http://localstack:4575"
sqs = "http://localstack:4576"
ssm = "http://localstack:4583"
stepfunctions = "http://localstack:4585"
sts = "http://localstack:4592"
}
resource "random_pet" "s3_bucket" {
}

data "aws_caller_identity" "current" {}
data "aws_region" "current" {}

resource "aws_s3_bucket" "b" {
bucket = "my-tf-test-bucket"
bucket = "ct-firehose-test-${random_pet.s3_bucket.id}"
acl = "private"
}

Expand Down
7 changes: 5 additions & 2 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

terraform {
required_version = ">= 0.12"
required_version = ">= 0.13"
required_providers {
aws = "~> 3.0"
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
}

0 comments on commit fb9db4f

Please sign in to comment.