diff --git a/aws/data_source_aws_iam_saml_provider_test.go b/aws/data_source_aws_iam_saml_provider_test.go index d02c8dc66d25..1bbf882f2e22 100644 --- a/aws/data_source_aws_iam_saml_provider_test.go +++ b/aws/data_source_aws_iam_saml_provider_test.go @@ -1,11 +1,11 @@ package aws import ( -"fmt" -"testing" + "fmt" + "testing" -"github.com/hashicorp/terraform-plugin-sdk/helper/acctest" -"github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccAWSDataSourceSAMLProvider_basic(t *testing.T) { @@ -18,49 +18,26 @@ func TestAccAWSDataSourceSAMLProvider_basic(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccAwsIAMRoleConfig(roleName), + Config: testAccIAMSamlProviderDataConfig(providerName), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), - resource.TestCheckResourceAttrPair(dataSourceName, "assume_role_policy", resourceName, "assume_role_policy"), - resource.TestCheckResourceAttrPair(dataSourceName, "create_date", resourceName, "create_date"), - resource.TestCheckResourceAttrPair(dataSourceName, "description", resourceName, "description"), - resource.TestCheckResourceAttrPair(dataSourceName, "max_session_duration", resourceName, "max_session_duration"), - resource.TestCheckResourceAttrPair(dataSourceName, "name", resourceName, "name"), - resource.TestCheckResourceAttrPair(dataSourceName, "path", resourceName, "path"), - resource.TestCheckResourceAttrPair(dataSourceName, "unique_id", resourceName, "unique_id"), + resource.TestCheckResourceAttrPair(dataSourceName, "saml_metadata_document", resourceName, "saml_metadata_document"), + resource.TestCheckResourceAttrPair(dataSourceName, "valid_until", resourceName, "valid_until"), ), }, }, }) } -func testAccAwsIAMRoleConfig(roleName string) string { +func testAccIAMSamlProviderDataConfig(providerName string) string { return fmt.Sprintf(` -resource "aws_iam_role" "test" { - name = %[1]q - - assume_role_policy = < + <% content_for :sidebar do %> + + <% end %> + <%= yield %> +<% end %> diff --git a/website/docs/d/iam_saml_provider.html.markdown b/website/docs/d/iam_saml_provider.html.markdown new file mode 100644 index 000000000000..eaa1e555f9f9 --- /dev/null +++ b/website/docs/d/iam_saml_provider.html.markdown @@ -0,0 +1,32 @@ +--- +layout: "aws" +page_title: "AWS: aws_saml_provider" +description: |- + Get information on an IAM SAML provider. +--- + +# Data Source: aws_saml_provider + +This data source can be used to fetch information about a specific +IAM SAML provider. This will allow you to easily retrieve the metadata +document of an existing SAML provider. + +## Example Usage + +```hcl +data "aws_iam_saml_provider" "example" { + arn = "arn:aws:iam::123456789:saml-provider/myprovider" +} +``` + +## Argument Reference + +* `arn` - (Required) The ARN assigned by AWS for the provider. + +## Attributes Reference + +* `arn` - The ARN assigned by AWS for this provider. +* `saml_metadata_document` - The XML document generated by an identity provider that supports SAML 2.0. +* `create_date` - Creation date of the provider in RFC1123 format, e.g. `Mon, 02 Jan 2006 15:04:05 MST`. +* `valid_until` - The expiration date and time for the SAML provider in RFC1123 format, e.g. `Mon, 02 Jan 2007 15:04:05 MST`. +