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

Commit fb9db4f

Browse files
authored
TF - 0.13 upgrade (#5)
* TF - 0.13 upgrade * TF 0.13 upgrade * TF 0.13 upgrade * TF 0.13 upgrade * TF 0.13 upgrade * TF 0.13 upgrade
1 parent c0a631c commit fb9db4f

File tree

10 files changed

+29
-92
lines changed

10 files changed

+29
-92
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM puneethn/terraform-test-workhorse:0.12.25
1+
FROM puneethn/terraform-test-workhorse:0.13.5
22

33
WORKDIR /go/src/github.com/comtravo/terraform-aws-firehose
44
COPY . .

Jenkinsfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ pipeline {
2323
script {
2424
try {
2525
sh(label: 'Building docker image', script: "make build")
26-
sh(label: 'Testing docker image', script: "make test-docker")
26+
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'automated-infra-testing-account', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) {
27+
sh(label: 'Testing docker image', script: "make test-docker")
28+
}
2729
} finally {
2830
sh(label: 'Cleanup', script: "make clean")
2931
}

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
DOCKER_COMPOSE=docker-compose -f ./docker-compose.yml
44
DOCKER_COMPOSE_DEVELOP=$(DOCKER_COMPOSE) -f ./docker-compose.develop.yml
55

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

88
fmt:
99
@terraform fmt -recursive
@@ -16,7 +16,6 @@ build:
1616
@$(DOCKER_COMPOSE) build
1717

1818
test:
19-
@cd tests && go test -v -tags=unit
2019
@cd tests && go test -v -tags=integration
2120

2221
test-docker:

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ MIT Licensed. See [LICENSE](LICENSE) for full details.
1919

2020
| Name | Version |
2121
|------|---------|
22-
| terraform | >= 0.12 |
22+
| terraform | >= 0.13 |
2323
| aws | ~> 3.0 |
2424

2525
## Providers
@@ -33,15 +33,14 @@ MIT Licensed. See [LICENSE](LICENSE) for full details.
3333
| Name | Description | Type | Default | Required |
3434
|------|-------------|------|---------|:--------:|
3535
| account\_id | AWS account ID | `string` | n/a | yes |
36-
| name | Name of the firehose | `string` | n/a | yes |
37-
| 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 |
3836
| destination | Kinesis Firehose Destination | `string` | `"s3"` | no |
3937
| enable | Enable firehose | `bool` | `true` | no |
38+
| name | Name of the firehose | `string` | n/a | yes |
4039
| region | AWS region | `string` | `"eu-west-1"` | no |
40+
| 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 |
4141

4242
## Outputs
4343

4444
| Name | Description |
4545
|------|-------------|
4646
| arn | ARN of the Kinesis Firehose |
47-

docker-compose.develop.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,5 @@ services:
55
command: bash
66
volumes:
77
- ./:/go/src/github.com/comtravo/terraform-aws-firehose
8-
9-
localstack:
10-
ports:
11-
- 4566:4566
12-
- 4584-4597:4584-4597
13-
- 4567-4583:4567-4583
14-
- 8080:8080
8+
environment:
9+
- AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN}

docker-compose.yml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,5 @@ services:
99
environment:
1010
- AWS_REGION=us-east-1
1111
- AWS_DEFAULT_REGION=us-east-1
12-
- AWS_ACCESS_KEY_ID=foo
13-
- AWS_SECRET_ACCESS_KEY=bar
14-
- LOCALSTACK_HOST=localstack
15-
depends_on:
16-
- localstack
17-
18-
localstack:
19-
image: localstack/localstack:0.11.4
20-
environment:
21-
- SERVICES=s3,firehose,iam,sts
22-
- DEFAULT_REGION=us-east-1
23-
- DOCKER_HOST=unix:///var/run/docker.sock
24-
- DATA_DIR=/tmp/localstack/data
25-
volumes:
26-
- "/var/run/docker.sock:/var/run/docker.sock"
27-
- "localstack-data:/tmp/localstack"
28-
29-
volumes:
30-
localstack-data:
12+
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
13+
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}

tests/firehose_integration_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
21
// +build integration
32

43
package test
54

65
import (
6+
"fmt"
7+
"regexp"
8+
"testing"
9+
710
"github.com/gruntwork-io/terratest/modules/terraform"
811
"github.com/stretchr/testify/assert"
9-
"testing"
1012
)
1113

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

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

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

2729
firehose_enabled_output := terraform.Output(t, terratestOptions, "firehose_enabled")
28-
assert.Equal(t, firehose_enabled_output, "arn:aws:firehose:us-east-1:000000000000:deliverystream/firehose_enabled")
30+
assert.Regexp(t,
31+
regexp.MustCompile(fmt.Sprintf("arn:aws:firehose:us-east-1:\\d{12}:deliverystream/firehose_enabled")),
32+
firehose_enabled_output,
33+
)
2934
}

tests/firehose_unit_test.go

Lines changed: 0 additions & 24 deletions
This file was deleted.

tests/test.tf

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,14 @@
11
provider "aws" {
2-
s3_force_path_style = true
3-
skip_credentials_validation = true
4-
skip_metadata_api_check = true
5-
skip_requesting_account_id = true
6-
access_key = "This is not an actual access key."
7-
secret_key = "This is not an actual secret key."
2+
}
83

9-
endpoints {
10-
apigateway = "http://localstack:4567"
11-
cloudformation = "http://localstack:4581"
12-
cloudwatch = "http://localstack:4582"
13-
dynamodb = "http://localstack:4569"
14-
es = "http://localstack:4578"
15-
firehose = "http://localstack:4573"
16-
iam = "http://localstack:4593"
17-
kinesis = "http://localstack:4568"
18-
lambda = "http://localstack:4574"
19-
route53 = "http://localstack:4580"
20-
redshift = "http://localstack:4577"
21-
s3 = "http://localstack:4572"
22-
secretsmanager = "http://localstack:4584"
23-
ses = "http://localstack:4579"
24-
sns = "http://localstack:4575"
25-
sqs = "http://localstack:4576"
26-
ssm = "http://localstack:4583"
27-
stepfunctions = "http://localstack:4585"
28-
sts = "http://localstack:4592"
29-
}
4+
resource "random_pet" "s3_bucket" {
305
}
316

327
data "aws_caller_identity" "current" {}
338
data "aws_region" "current" {}
349

3510
resource "aws_s3_bucket" "b" {
36-
bucket = "my-tf-test-bucket"
11+
bucket = "ct-firehose-test-${random_pet.s3_bucket.id}"
3712
acl = "private"
3813
}
3914

versions.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11

22
terraform {
3-
required_version = ">= 0.12"
3+
required_version = ">= 0.13"
44
required_providers {
5-
aws = "~> 3.0"
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = "~> 3.0"
8+
}
69
}
710
}

0 commit comments

Comments
 (0)