Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aws_iot_provisioning_template resource #12108

Merged
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Support importing"
This reverts commit 299451b.
ewbankkit committed Apr 1, 2022
commit 3b12806bfc804785149579625fb30f5c5b27c4c4
5 changes: 0 additions & 5 deletions aws/resource_aws_iot_provisioning_template.go
Original file line number Diff line number Diff line change
@@ -16,11 +16,6 @@ func resourceAwsIotProvisioningTemplate() *schema.Resource {
Read: resourceAwsIotProvisioningTemplateRead,
Update: resourceAwsIotProvisioningTemplateUpdate,
Delete: resourceAwsIotProvisioningTemplateDelete,

Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},

Schema: map[string]*schema.Schema{
"default_version_id": {
Type: schema.TypeInt,
25 changes: 9 additions & 16 deletions aws/resource_aws_iot_provisioning_template_test.go
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@ import (
)

func TestAccAWSIoTProvisioningTemplate_basic(t *testing.T) {
resourceName := "aws_iot_provisioning_template.fleet"
rName := acctest.RandomWithPrefix("Fleet-")

resource.ParallelTest(t, resource.TestCase{
@@ -24,27 +23,21 @@ func TestAccAWSIoTProvisioningTemplate_basic(t *testing.T) {
{
Config: testAccAWSIoTProvisioningTemplateConfigInitialState(rName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "default_version_id", "1"),
resource.TestCheckResourceAttr(resourceName, "description", "My provisioning template"),
resource.TestCheckResourceAttr(resourceName, "enabled", "false"),
resource.TestCheckResourceAttrSet(resourceName, "provisioning_role_arn"),
resource.TestCheckResourceAttrSet(resourceName, "template_arn"),
resource.TestCheckResourceAttr(resourceName, "template_name", rName),
resource.TestCheckResourceAttrSet(resourceName, "template_body"),
resource.TestCheckResourceAttr("aws_iot_provisioning_template.fleet", "default_version_id", "1"),
resource.TestCheckResourceAttr("aws_iot_provisioning_template.fleet", "description", "My provisioning template"),
resource.TestCheckResourceAttr("aws_iot_provisioning_template.fleet", "enabled", "false"),
resource.TestCheckResourceAttrSet("aws_iot_provisioning_template.fleet", "provisioning_role_arn"),
resource.TestCheckResourceAttrSet("aws_iot_provisioning_template.fleet", "template_arn"),
resource.TestCheckResourceAttr("aws_iot_provisioning_template.fleet", "template_name", rName),
resource.TestCheckResourceAttrSet("aws_iot_provisioning_template.fleet", "template_body"),
testAccAWSIoTProvisioningTemplateCheckVersionExists(rName, 1),
),
},
{
Config: testAccAWSIoTProvisioningTemplateConfigInitialState(rName),
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccAWSIoTProvisioningTemplateConfigTemplateBodyUpdate(rName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "default_version_id", "2"),
resource.TestCheckResourceAttrSet(resourceName, "template_body"),
resource.TestCheckResourceAttr("aws_iot_provisioning_template.fleet", "default_version_id", "2"),
resource.TestCheckResourceAttrSet("aws_iot_provisioning_template.fleet", "template_body"),
testAccAWSIoTProvisioningTemplateCheckVersionExists(rName, 2),
),
},
8 changes: 0 additions & 8 deletions website/docs/r/iot_provisioning_template.html.markdown
Original file line number Diff line number Diff line change
@@ -75,11 +75,3 @@ In addition to all arguments above, the following attributes are exported:

* `default_version_id` - The default version of the fleet provisioning template.
* `template_arn` - The ARN that identifies the provisioning template.

## Import

IoT fleet provisioning templates can be imported using the `template_name`, e.g.

```
$ terraform import aws_iot_provisioning_template.fleet FleetProvisioningTemplate
```