Merge branch 'b-aws-sqs-defaults'
This commit is contained in:
commit
3d4e3e729a
|
@ -10,7 +10,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccAWSSQSQueue_importBasic(t *testing.T) {
|
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))
|
queueName := fmt.Sprintf("sqs-queue-%s", acctest.RandString(5))
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
|
@ -26,9 +26,6 @@ func TestAccAWSSQSQueue_importBasic(t *testing.T) {
|
||||||
ResourceName: resourceName,
|
ResourceName: resourceName,
|
||||||
ImportState: true,
|
ImportState: true,
|
||||||
ImportStateVerify: 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"},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -50,27 +50,27 @@ func resourceAwsSqsQueue() *schema.Resource {
|
||||||
"delay_seconds": &schema.Schema{
|
"delay_seconds": &schema.Schema{
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Default: 0,
|
||||||
},
|
},
|
||||||
"max_message_size": &schema.Schema{
|
"max_message_size": &schema.Schema{
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Default: 262144,
|
||||||
},
|
},
|
||||||
"message_retention_seconds": &schema.Schema{
|
"message_retention_seconds": &schema.Schema{
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Default: 345600,
|
||||||
},
|
},
|
||||||
"receive_wait_time_seconds": &schema.Schema{
|
"receive_wait_time_seconds": &schema.Schema{
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Default: 0,
|
||||||
},
|
},
|
||||||
"visibility_timeout_seconds": &schema.Schema{
|
"visibility_timeout_seconds": &schema.Schema{
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Default: 30,
|
||||||
},
|
},
|
||||||
"policy": &schema.Schema{
|
"policy": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
|
|
|
@ -22,13 +22,19 @@ func TestAccAWSSQSQueue_basic(t *testing.T) {
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
Config: testAccAWSSQSConfigWithDefaults(queueName),
|
Config: testAccAWSSQSConfigWithDefaults(queueName),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckAWSSQSExistsWithDefaults("aws_sqs_queue.queue-with-defaults"),
|
testAccCheckAWSSQSExistsWithDefaults("aws_sqs_queue.queue"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
Config: testAccAWSSQSConfigWithOverrides,
|
Config: testAccAWSSQSConfigWithOverrides(queueName),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
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 {
|
func testAccAWSSQSConfigWithDefaults(r string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "aws_sqs_queue" "queue-with-defaults" {
|
resource "aws_sqs_queue" "queue" {
|
||||||
name = "%s"
|
name = "%s"
|
||||||
}
|
}
|
||||||
`, r)
|
`, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
const testAccAWSSQSConfigWithOverrides = `
|
func testAccAWSSQSConfigWithOverrides(r string) string {
|
||||||
resource "aws_sqs_queue" "queue-with-overrides" {
|
return fmt.Sprintf(`
|
||||||
name = "test-sqs-queue-with-overrides"
|
resource "aws_sqs_queue" "queue" {
|
||||||
|
name = "%s"
|
||||||
delay_seconds = 90
|
delay_seconds = 90
|
||||||
max_message_size = 2048
|
max_message_size = 2048
|
||||||
message_retention_seconds = 86400
|
message_retention_seconds = 86400
|
||||||
receive_wait_time_seconds = 10
|
receive_wait_time_seconds = 10
|
||||||
visibility_timeout_seconds = 60
|
visibility_timeout_seconds = 60
|
||||||
|
}`, r)
|
||||||
}
|
}
|
||||||
`
|
|
||||||
|
|
||||||
func testAccAWSSQSConfigWithRedrive(name string) string {
|
func testAccAWSSQSConfigWithRedrive(name string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
|
|
Loading…
Reference in New Issue