|
| 1 | +--- |
| 2 | +subcategory: "Identity and Access Management (IAM)" |
| 3 | +--- |
| 4 | + |
| 5 | +# flexibleengine_identity_provider |
| 6 | + |
| 7 | +Manages the identity providers within FlexibleEngine IAM service. |
| 8 | + |
| 9 | +-> **NOTE:** You can create up to 10 identity providers. |
| 10 | + |
| 11 | +## Example Usage |
| 12 | + |
| 13 | +### Create a SAML protocol provider |
| 14 | + |
| 15 | +```hcl |
| 16 | +resource "flexibleengine_identity_provider" "provider_1" { |
| 17 | + name = "saml_idp_demo" |
| 18 | + protocol = "saml" |
| 19 | +} |
| 20 | +``` |
| 21 | + |
| 22 | +### Create a OpenID Connect protocol provider |
| 23 | + |
| 24 | +```hcl |
| 25 | +resource "flexibleengine_identity_provider" "provider_2" { |
| 26 | + name = "oidc_idp_demo" |
| 27 | + protocol = "oidc" |
| 28 | + |
| 29 | + openid_connect_config { |
| 30 | + access_type = "program_console" |
| 31 | + provider_url = "https://accounts.example.com" |
| 32 | + client_id = "your_client_id" |
| 33 | + authorization_endpoint = "https://accounts.example.com/o/oauth2/v2/auth" |
| 34 | + scopes = ["openid"] |
| 35 | + signing_key = jsonencode( |
| 36 | + { |
| 37 | + keys = [ |
| 38 | + { |
| 39 | + alg = "RS256" |
| 40 | + e = "AQAB" |
| 41 | + kid = "..." |
| 42 | + kty = "RSA" |
| 43 | + n = "..." |
| 44 | + use = "sig" |
| 45 | + }, |
| 46 | + ] |
| 47 | + } |
| 48 | + ) |
| 49 | + } |
| 50 | +} |
| 51 | +``` |
| 52 | + |
| 53 | +## Argument Reference |
| 54 | + |
| 55 | +The following arguments are supported: |
| 56 | + |
| 57 | +* `name` - (Required, String, ForceNew) Specifies the name of the identity provider to be registered. |
| 58 | + The maximum length is 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
| 59 | + The name is unique, it is recommended to include domain name information. |
| 60 | + Changing this creates a new resource. |
| 61 | + |
| 62 | +* `protocol` - (Required, String, ForceNew) Specifies the protocol of the identity provider. |
| 63 | + Valid values are *saml* and *oidc*. |
| 64 | + Changing this creates a new resource. |
| 65 | + |
| 66 | +* `enabled` - (Optional, Bool) Specifies the status for the identity provider. Defaults to true. |
| 67 | + |
| 68 | +* `description` - (Optional, String) Specifies the description of the identity provider. |
| 69 | + |
| 70 | +* `metadata` - (Optional, String) Specifies the metadata of the IDP(Identity Provider) server. |
| 71 | + To obtain the metadata file of your enterprise IDP, contact the enterprise administrator. |
| 72 | + This field is used to import a metadata file to IAM to implement federated identity authentication. |
| 73 | + This field is required only if the protocol is set to *saml*. |
| 74 | + The maximum length is 30,000 characters and it stores in the state with SHA1 algorithm. |
| 75 | + |
| 76 | + -> **NOTE:** |
| 77 | + The metadata file specifies API addresses and certificate information in compliance with the SAML 2.0 standard. |
| 78 | + It is usually stored in a file. In the TF script, you can import the metafile through the **file** function, |
| 79 | + for example: |
| 80 | + <br/>`metadata = file("/usr/local/data/files/metadata.txt")` |
| 81 | + |
| 82 | +* `openid_connect_config` - (Optional, List) Specifies the description of the identity provider. |
| 83 | + This field is required only if the protocol is set to *oidc*. |
| 84 | + |
| 85 | +The `openid_connect_config` block supports: |
| 86 | + |
| 87 | +* `access_type` - (Required, String) Specifies the access type of the identity provider. |
| 88 | + Available options are: |
| 89 | + + `program`: programmatic access only. |
| 90 | + + `program_console`: programmatic access and management console access. |
| 91 | + |
| 92 | +* `provider_url` - (Required, String) Specifies the URL of the identity provider. |
| 93 | + This field corresponds to the iss field in the ID token. |
| 94 | + |
| 95 | +* `client_id` - (Required, String) Specifies the ID of a client registered with the OpenID Connect identity provider. |
| 96 | + |
| 97 | +* `signing_key` - (Required, String) Public key used to sign the ID token of the OpenID Connect identity provider. |
| 98 | + This field is required only if the protocol is set to *oidc*. |
| 99 | + |
| 100 | +* `authorization_endpoint` - (Optional, String) Specifies the authorization endpoint of the OpenID Connect identity |
| 101 | + provider. This field is required only if the access type is set to `program_console`. |
| 102 | + |
| 103 | +* `scopes` - (Optional, List) Specifies the scopes of authorization requests. It is an array of one or more scopes. |
| 104 | + Valid values are *openid*, *email*, *profile* and other values defined by you. |
| 105 | + This field is required only if the access type is set to `program_console`. |
| 106 | + |
| 107 | +* `response_type` - (Optional, String) Response type. Valid values is *id_token*, default value is *id_token*. |
| 108 | + This field is required only if the access type is set to `program_console`. |
| 109 | + |
| 110 | +* `response_mode` - (Optional, String) Response mode. |
| 111 | + Valid values is *form_post* and *fragment*, default value is *form_post*. |
| 112 | + This field is required only if the access type is set to `program_console`. |
| 113 | + |
| 114 | +## Attributes Reference |
| 115 | + |
| 116 | +In addition to all arguments above, the following attributes are exported: |
| 117 | + |
| 118 | +* `id` - The resource ID which equals to the name. |
| 119 | + |
| 120 | +* `login_link` - The login link of the identity provider. |
| 121 | + |
| 122 | +* `sso_type` - The single sign-on type of the identity provider. |
| 123 | + |
| 124 | +* `conversion_rules` - The identity conversion rules of the identity provider. |
| 125 | + The [object](#conversion_rules) structure is documented below |
| 126 | + |
| 127 | +<a name="conversion_rules"></a> |
| 128 | +The `conversion_rules` block supports: |
| 129 | + |
| 130 | +* `local` - The federated user information on the cloud platform. |
| 131 | + |
| 132 | +* `remote` - The description of the identity provider. |
| 133 | + |
| 134 | +The `local` block supports: |
| 135 | + |
| 136 | +* `username` - The name of a federated user on the cloud platform. |
| 137 | + |
| 138 | +* `group` - The user group to which the federated user belongs on the cloud platform. |
| 139 | + |
| 140 | +The `remote` block supports: |
| 141 | + |
| 142 | +* `attribute` - The attribute in the IDP assertion. |
| 143 | + |
| 144 | +* `condition` - The condition of conversion rule. |
| 145 | + |
| 146 | +* `value` - The rule is matched only if the specified strings appear in the attribute type. |
| 147 | + |
| 148 | +## Import |
| 149 | + |
| 150 | +Identity provider can be imported using the `name`, e.g. |
| 151 | + |
| 152 | +``` |
| 153 | +$ terraform import flexibleengine_identity_provider.provider_1 example_com_provider_saml |
| 154 | +``` |
0 commit comments