Documentation
¶
Overview ¶
Package s3 provides post-apply assertions for AWS S3 resources created by Terraform modules under test.
All assertions follow the paired-method shape established in INV-0001: a context-aware variant ending in Context and a shim that calls the *Context variant with tb.Context(). The shim exists so module authors writing straight-line assertion code don't have to thread ctx through every line:
s3assert.BucketExists(t, cfg, name) s3assert.BucketExistsContext(t, ctx, cfg, name)
Every *Context assertion respects ctx cancellation — a cancelled ctx surfaces as a tb.Errorf call rather than a panic or a hang.
Import alias convention: callers typically alias this package as s3assert to avoid a naming collision with the AWS SDK's s3 package:
import (
s3assert "github.com/donaldgifford/libtftest/assert/s3"
s3sdk "github.com/aws/aws-sdk-go-v2/service/s3"
)
Index ¶
- func BucketBlocksPublicAccess(tb testing.TB, cfg aws.Config, name string)
- func BucketBlocksPublicAccessContext(tb testing.TB, ctx context.Context, cfg aws.Config, name string)
- func BucketExists(tb testing.TB, cfg aws.Config, name string)
- func BucketExistsContext(tb testing.TB, ctx context.Context, cfg aws.Config, name string)
- func BucketHasEncryption(tb testing.TB, cfg aws.Config, name, algo string)
- func BucketHasEncryptionContext(tb testing.TB, ctx context.Context, cfg aws.Config, name, algo string)
- func BucketHasTag(tb testing.TB, cfg aws.Config, name, key, want string)
- func BucketHasTagContext(tb testing.TB, ctx context.Context, cfg aws.Config, name, key, want string)
- func BucketHasVersioning(tb testing.TB, cfg aws.Config, name string)
- func BucketHasVersioningContext(tb testing.TB, ctx context.Context, cfg aws.Config, name string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BucketBlocksPublicAccess ¶
BucketBlocksPublicAccess is a shim that calls BucketBlocksPublicAccessContext with tb.Context().
func BucketBlocksPublicAccessContext ¶
func BucketBlocksPublicAccessContext(tb testing.TB, ctx context.Context, cfg aws.Config, name string)
BucketBlocksPublicAccessContext asserts that the named S3 bucket has all four public-access-block flags set to true.
func BucketExists ¶
BucketExists is a shim that calls BucketExistsContext with tb.Context().
func BucketExistsContext ¶
BucketExistsContext asserts that the named S3 bucket exists.
func BucketHasEncryption ¶
BucketHasEncryption is a shim that calls BucketHasEncryptionContext with tb.Context().
func BucketHasEncryptionContext ¶
func BucketHasEncryptionContext(tb testing.TB, ctx context.Context, cfg aws.Config, name, algo string)
BucketHasEncryptionContext asserts that the named S3 bucket has server-side encryption configured with the given algorithm.
func BucketHasTag ¶
BucketHasTag is a shim that calls BucketHasTagContext with tb.Context().
func BucketHasTagContext ¶
func BucketHasTagContext(tb testing.TB, ctx context.Context, cfg aws.Config, name, key, want string)
BucketHasTagContext asserts that the named S3 bucket carries the given tag key with the given value.
func BucketHasVersioning ¶
BucketHasVersioning is a shim that calls BucketHasVersioningContext with tb.Context().
Types ¶
This section is empty.