https://pulumi.com logo
#python
Title
# python
p

proud-queen-14294

08/06/2020, 6:18 PM
Hi all, I'm using python on AWS. I'm having some issues with
directoryservice.Directory
If I copy and paste the python example here I've made MINOR adjustments, but the issue still remains. I get the following error:
Copy code
Diagnostics:
  aws:directoryservice:Directory (main):
    error: InvalidParameterException: Invalid directory name. The directory name must be between 2 and 64 characters, and can only contain alphanumeric characters, periods (.). or minus signs (-). Also, the directory name must begin and end with an alphanumeric character. : RequestId: 362da74b-62dc-4116-8785-e65cbacb52c3
    {
      RespMetadata: {
        StatusCode: 400,
        RequestID: "362da74b-62dc-4116-8785-e65cbacb52c3"
      },
      Message_: "Invalid directory name. The directory name must be between 2 and 64 characters, and can only contain alphanumeric characters, periods (.). or minus signs (-). Also, the directory name must begin and end with an alphanumeric character. : RequestId: 362da74b-62dc-4116-8785-e65cbacb52c3",
      RequestId: "362da74b-62dc-4116-8785-e65cbacb52c3"
    }
 
  pulumi:pulumi:Stack (training_workspaces-dev):
    error: update failed
I've tried overwriting the name to avoid the generated hex code being added by using the
name
parameter of
Directory
, but it just gives the same error. I find it odd that this is happening with example code from the docs. Any ideas? Full code added as snippet
l

lemon-agent-27707

08/06/2020, 7:12 PM
Looks like there may be a bug in our docs. Does this work if you remove the
/
in the name? perhaps try `"mainWorkspaces_directoryDirectory" instead?
I've filed an issue to track getting this fixed, thanks for reporting! https://github.com/pulumi/pulumi/issues/5123
p

proud-queen-14294

08/06/2020, 7:50 PM
The error occurs with
directoryservice.Directory
rather than the
workspaces.Directory
so it's something to do with
mainDirectory
and
main-dir
@lemon-agent-27707 Not entirely sure it's related to the
/
As it still happens with this snippet
l

lemon-agent-27707

08/06/2020, 8:36 PM
This is working for me:
Copy code
main_directory = aws.directoryservice.Directory("mainDirectory",
                                                password="#S1ncerely",
                                                size="Small",
                                                name='main.dir',
                                                vpc_settings={
                                                    "subnet_ids": [
                                                        private_a.id,
                                                        private_b.id,
                                                    ],
                                                    "vpc_id": main_vpc.id,
                                                })
Must be an issue with the validation. I will update the issue.
transfered the issue to pulumi-aws and updated it with my observations. Feel free to drop notes in there: https://github.com/pulumi/pulumi-aws/issues/1061
👍 1