Skip to content

Commit

Permalink
lightsail
Browse files Browse the repository at this point in the history
  • Loading branch information
gdavison committed Jan 17, 2025
1 parent d8faad7 commit bdebe6d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
1 change: 0 additions & 1 deletion .ci/semgrep/acctest/checks/arn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ rules:
paths:
exclude:
- "internal/service/controltower"
- "internal/service/lightsail"
- "internal/service/networkmanager"
- "internal/service/networkmonitor"
- "internal/service/oam"
Expand Down
4 changes: 3 additions & 1 deletion internal/service/lightsail/container_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/hashicorp/terraform-provider-aws/internal/conns"
tflightsail "github.com/hashicorp/terraform-provider-aws/internal/service/lightsail"
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
"github.com/hashicorp/terraform-provider-aws/internal/verify"
"github.com/hashicorp/terraform-provider-aws/names"
)

Expand All @@ -45,8 +46,9 @@ func TestAccLightsailContainerService_basic(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, names.AttrName, rName),
resource.TestCheckResourceAttr(resourceName, "power", string(types.ContainerServicePowerNameNano)),
resource.TestCheckResourceAttr(resourceName, "scale", "1"),
resource.TestCheckResourceAttrPair(resourceName, names.AttrID, resourceName, names.AttrName),
resource.TestCheckResourceAttr(resourceName, "is_disabled", acctest.CtFalse),
resource.TestCheckResourceAttrSet(resourceName, names.AttrARN),
acctest.MatchResourceAttrRegionalARN(ctx, resourceName, names.AttrARN, "lightsail", regexache.MustCompile(`ContainerService/`+verify.UUIDRegexPattern+`$`)),
resource.TestCheckResourceAttrSet(resourceName, names.AttrAvailabilityZone),
resource.TestCheckResourceAttrSet(resourceName, "power_id"),
resource.TestCheckResourceAttrSet(resourceName, "principal_arn"),
Expand Down
4 changes: 3 additions & 1 deletion internal/service/lightsail/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/hashicorp/terraform-provider-aws/internal/create"
tfsync "github.com/hashicorp/terraform-provider-aws/internal/experimental/sync"
tflightsail "github.com/hashicorp/terraform-provider-aws/internal/service/lightsail"
"github.com/hashicorp/terraform-provider-aws/internal/verify"
"github.com/hashicorp/terraform-provider-aws/names"
)

Expand Down Expand Up @@ -52,7 +53,7 @@ func testAccDatabase_basic(t *testing.T, semaphore tfsync.Semaphore) {
resource.TestCheckResourceAttr(resourceName, "master_database_name", "testdatabasename"),
resource.TestCheckResourceAttr(resourceName, "master_username", "test"),
resource.TestCheckResourceAttrSet(resourceName, names.AttrAvailabilityZone),
resource.TestCheckResourceAttrSet(resourceName, names.AttrARN),
acctest.MatchResourceAttrRegionalARN(ctx, resourceName, names.AttrARN, "lightsail", regexache.MustCompile(`RelationalDatabase/`+verify.UUIDRegexPattern+`$`)),
resource.TestCheckResourceAttrSet(resourceName, names.AttrCreatedAt),
resource.TestCheckResourceAttrSet(resourceName, names.AttrEngine),
resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion),
Expand All @@ -62,6 +63,7 @@ func testAccDatabase_basic(t *testing.T, semaphore tfsync.Semaphore) {
resource.TestCheckResourceAttrSet(resourceName, "master_endpoint_port"),
resource.TestCheckResourceAttrSet(resourceName, "master_endpoint_address"),
resource.TestCheckResourceAttrSet(resourceName, "support_code"),
resource.TestCheckResourceAttrPair(resourceName, names.AttrID, resourceName, "relational_database_name"),
),
},
{
Expand Down
9 changes: 6 additions & 3 deletions internal/service/lightsail/key_pair_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"strings"
"testing"

"github.com/YakDriver/regexache"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/lightsail"
sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest"
Expand All @@ -18,6 +19,7 @@ import (
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
"github.com/hashicorp/terraform-provider-aws/internal/conns"
tflightsail "github.com/hashicorp/terraform-provider-aws/internal/service/lightsail"
"github.com/hashicorp/terraform-provider-aws/internal/verify"
"github.com/hashicorp/terraform-provider-aws/names"
)

Expand All @@ -41,7 +43,7 @@ func TestAccLightsailKeyPair_basic(t *testing.T) {
Config: testAccKeyPairConfig_basic(rName),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckKeyPairExists(ctx, resourceName),
resource.TestCheckResourceAttrSet(resourceName, names.AttrARN),
acctest.MatchResourceAttrRegionalARN(ctx, resourceName, names.AttrARN, "lightsail", regexache.MustCompile(`KeyPair/`+verify.UUIDRegexPattern+`$`)),
resource.TestCheckResourceAttrSet(resourceName, "fingerprint"),
resource.TestCheckResourceAttr(resourceName, names.AttrName, rName),
resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, ""),
Expand Down Expand Up @@ -78,7 +80,7 @@ func TestAccLightsailKeyPair_publicKey(t *testing.T) {
Config: testAccKeyPairConfig_imported(rName, publicKey),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckKeyPairExists(ctx, resourceName),
resource.TestCheckResourceAttrSet(resourceName, names.AttrARN),
acctest.MatchResourceAttrRegionalARN(ctx, resourceName, names.AttrARN, "lightsail", regexache.MustCompile(`KeyPair/`+verify.UUIDRegexPattern+`$`)),
resource.TestCheckResourceAttrSet(resourceName, "fingerprint"),
resource.TestCheckResourceAttrSet(resourceName, names.AttrPublicKey),
resource.TestCheckNoResourceAttr(resourceName, "encrypted_fingerprint"),
Expand Down Expand Up @@ -110,10 +112,11 @@ func TestAccLightsailKeyPair_encrypted(t *testing.T) {
Config: testAccKeyPairConfig_encrypted(rName, testKeyPairPubKey1),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckKeyPairExists(ctx, resourceName),
resource.TestCheckResourceAttrSet(resourceName, names.AttrARN),
acctest.MatchResourceAttrRegionalARN(ctx, resourceName, names.AttrARN, "lightsail", regexache.MustCompile(`KeyPair/`+verify.UUIDRegexPattern+`$`)),
resource.TestCheckResourceAttrSet(resourceName, "fingerprint"),
resource.TestCheckResourceAttrSet(resourceName, "encrypted_fingerprint"),
resource.TestCheckResourceAttrSet(resourceName, "encrypted_private_key"),
resource.TestCheckResourceAttrPair(resourceName, names.AttrID, resourceName, names.AttrName),
resource.TestCheckResourceAttrSet(resourceName, names.AttrPublicKey),
resource.TestCheckNoResourceAttr(resourceName, names.AttrPrivateKey),
),
Expand Down

0 comments on commit bdebe6d

Please sign in to comment.