Merge branch 'b-aws-sqs-defaults'

This commit is contained in:
stack72 2016-07-26 21:59:30 +01:00
commit 3d4e3e729a
No known key found for this signature in database
GPG Key ID: 8619A619B085CB16
3 changed files with 21 additions and 17 deletions

View File

@ -10,7 +10,7 @@ import (
)
func TestAccAWSSQSQueue_importBasic(t *testing.T) {
resourceName := "aws_sqs_queue.queue-with-defaults"
resourceName := "aws_sqs_queue.queue"
queueName := fmt.Sprintf("sqs-queue-%s", acctest.RandString(5))
resource.Test(t, resource.TestCase{
@ -26,9 +26,6 @@ func TestAccAWSSQSQueue_importBasic(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
//The name is never returned after the initial create of the queue.
//It is part of the URL and can be split down if needed
//ImportStateVerifyIgnore: []string{"name"},
},
},
})

View File

@ -50,27 +50,27 @@ func resourceAwsSqsQueue() *schema.Resource {
"delay_seconds": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
Default: 0,
},
"max_message_size": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
Default: 262144,
},
"message_retention_seconds": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
Default: 345600,
},
"receive_wait_time_seconds": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
Default: 0,
},
"visibility_timeout_seconds": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
Default: 30,
},
"policy": &schema.Schema{
Type: schema.TypeString,

View File

@ -22,13 +22,19 @@ func TestAccAWSSQSQueue_basic(t *testing.T) {
resource.TestStep{
Config: testAccAWSSQSConfigWithDefaults(queueName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSSQSExistsWithDefaults("aws_sqs_queue.queue-with-defaults"),
testAccCheckAWSSQSExistsWithDefaults("aws_sqs_queue.queue"),
),
},
resource.TestStep{
Config: testAccAWSSQSConfigWithOverrides,
Config: testAccAWSSQSConfigWithOverrides(queueName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSSQSExistsWithOverrides("aws_sqs_queue.queue-with-overrides"),
testAccCheckAWSSQSExistsWithOverrides("aws_sqs_queue.queue"),
),
},
resource.TestStep{
Config: testAccAWSSQSConfigWithDefaults(queueName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSSQSExistsWithDefaults("aws_sqs_queue.queue"),
),
},
},
@ -197,22 +203,23 @@ func testAccCheckAWSSQSExistsWithOverrides(n string) resource.TestCheckFunc {
func testAccAWSSQSConfigWithDefaults(r string) string {
return fmt.Sprintf(`
resource "aws_sqs_queue" "queue-with-defaults" {
resource "aws_sqs_queue" "queue" {
name = "%s"
}
`, r)
}
const testAccAWSSQSConfigWithOverrides = `
resource "aws_sqs_queue" "queue-with-overrides" {
name = "test-sqs-queue-with-overrides"
func testAccAWSSQSConfigWithOverrides(r string) string {
return fmt.Sprintf(`
resource "aws_sqs_queue" "queue" {
name = "%s"
delay_seconds = 90
max_message_size = 2048
message_retention_seconds = 86400
receive_wait_time_seconds = 10
visibility_timeout_seconds = 60
}`, r)
}
`
func testAccAWSSQSConfigWithRedrive(name string) string {
return fmt.Sprintf(`