-
Notifications
You must be signed in to change notification settings - Fork 9.3k
/
Copy pathresource_aws_sso_permission_set.go
148 lines (127 loc) · 3.91 KB
/
resource_aws_sso_permission_set.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
package aws
import (
// "fmt"
// "log"
// "time"
"regexp"
// "github.com/aws/aws-sdk-go/aws"
// "github.com/aws/aws-sdk-go/service/ssoadmin"
// "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
// "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags"
)
func resourceAwsSsoPermissionSet() *schema.Resource {
return &schema.Resource{
Create: resourceAwsSsoPermissionSetCreate,
Read: resourceAwsSsoPermissionSetRead,
Update: resourceAwsSsoPermissionSetUpdate,
Delete: resourceAwsSsoPermissionSetDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Schema: map[string]*schema.Schema{
"arn": {
Type: schema.TypeString,
Computed: true,
},
"created_date": {
Type: schema.TypeString,
Computed: true,
},
"provisioning_created_date": {
Type: schema.TypeString,
Computed: true,
},
"provisioning_failure_reason": {
Type: schema.TypeString,
Computed: true,
},
"provisioning_request_id": {
Type: schema.TypeString,
Computed: true,
},
"provisioning_status": {
Type: schema.TypeString,
Computed: true,
},
"instance_arn": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.All(
validation.StringLenBetween(10, 1224),
validation.StringMatch(regexp.MustCompile(`^arn:aws:sso:::instance/(sso)?ins-[a-zA-Z0-9-.]{16}$`), "must match arn:aws:sso:::instance/(sso)?ins-[a-zA-Z0-9-.]{16}"),
),
},
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.All(
validation.StringLenBetween(1, 32),
validation.StringMatch(regexp.MustCompile(`^[\w+=,.@-]+$`), "must match [\\w+=,.@-]"),
),
},
"description": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.All(
validation.StringLenBetween(1, 700),
validation.StringMatch(regexp.MustCompile(`^[\p{L}\p{M}\p{Z}\p{S}\p{N}\p{P}]*$`), "must match [\\p{L}\\p{M}\\p{Z}\\p{S}\\p{N}\\p{P}]"),
),
},
"session_duration": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringLenBetween(1, 100),
},
"relay_state": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.All(
validation.StringLenBetween(1, 240),
validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9&$@#\\\/%?=~\-_'"|!:,.;*+\[\]\(\)\{\} ]+$`), "must match [a-zA-Z0-9&$@#\\\\\\/%?=~\\-_'\"|!:,.;*+\\[\\]\\(\\)\\{\\} ]"),
),
},
"inline_policy": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateIAMPolicyJson,
DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs,
},
"managed_policies": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validateArn,
},
},
"tags": tagsSchema(),
},
}
}
func resourceAwsSsoPermissionSetCreate(d *schema.ResourceData, meta interface{}) error {
// conn := meta.(*AWSClient).ssoadminconn
// TODO
// d.SetId(*resp.PermissionSetArn)
return resourceAwsSsoPermissionSetRead(d, meta)
}
func resourceAwsSsoPermissionSetRead(d *schema.ResourceData, meta interface{}) error {
// conn := meta.(*AWSClient).ssoadminconn
// TODO
return nil
}
func resourceAwsSsoPermissionSetUpdate(d *schema.ResourceData, meta interface{}) error {
// conn := meta.(*AWSClient).ssoadminconn
// TODO
return resourceAwsSsoPermissionSetRead(d, meta)
}
func resourceAwsSsoPermissionSetDelete(d *schema.ResourceData, meta interface{}) error {
// conn := meta.(*AWSClient).ssoadminconn
// TODO
return nil
}
// func waitForPermissionSetProvisioning(conn *identitystore.IdentityStore, arn string) error {
// }